Skip to content

Commit 648363c

Browse files
add toolchain definition for fujitsu toolchain
1 parent 89ff20d commit 648363c

File tree

6 files changed

+419
-0
lines changed

6 files changed

+419
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
##
2+
# Copyright 2014-2021 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
Support for the Fujitsu compiler drivers (aka fcc, frt).
27+
28+
The basic concept the same as for the Cray Programming Environment.
29+
30+
:author: Miguel Dias Costa (National University of Singapore)
31+
"""
32+
import os
33+
34+
import easybuild.tools.environment as env
35+
import easybuild.tools.systemtools as systemtools
36+
from easybuild.tools.toolchain.compiler import Compiler, DEFAULT_OPT_LEVEL
37+
38+
TC_CONSTANT_FUJITSU = 'Fujitsu'
39+
40+
41+
class FujitsuCompiler(Compiler):
42+
"""Generic support for using Fujitsu compiler drivers."""
43+
TOOLCHAIN_FAMILY = TC_CONSTANT_FUJITSU
44+
45+
# compiler module name is lang (with version e.g. tcsds-1.2.31)
46+
COMPILER_MODULE_NAME = ['lang']
47+
COMPILER_FAMILY = TC_CONSTANT_FUJITSU
48+
49+
COMPILER_CC = 'fcc -Nclang'
50+
COMPILER_CXX = 'FCC -Nclang'
51+
52+
COMPILER_F77 = 'frt'
53+
COMPILER_F90 = 'frt'
54+
COMPILER_FC = 'frt'
55+
56+
COMPILER_UNIQUE_OPTION_MAP = {
57+
DEFAULT_OPT_LEVEL: 'Kfast',
58+
'optarch': '', # Fujitsu compiler by default generates code for the arch it is running on
59+
'openmp': 'Kopenmp',
60+
'unroll': 'funroll-loops',
61+
'strict': ['Kfp_precision'],
62+
'precise': ['Kfp_precision'],
63+
'defaultprec': [],
64+
'loose': ['Kfp_relaxed'],
65+
'veryloose': ['Kfp_relaxed'],
66+
'vectorize': {False: 'KNOSVE', True: 'KSVE'},
67+
}
68+
69+
# used when 'optarch' toolchain option is enabled (and --optarch is not specified)
70+
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = {
71+
# -march=archi[+features]. At least on Fugaku, these are set by default (-march=armv8.3-a+sve and -mcpu=a64fx)
72+
(systemtools.AARCH64, systemtools.ARM): '',
73+
}
74+
75+
# used with --optarch=GENERIC
76+
COMPILER_GENERIC_OPTION = {
77+
(systemtools.AARCH64, systemtools.ARM): '-mcpu=generic -mtune=generic',
78+
}
79+
80+
def _set_compiler_vars(self):
81+
super(FujitsuCompiler, self)._set_compiler_vars()
82+
83+
# TODO: check for a better way
84+
env.setvar('CPP', os.path.join(os.getenv('FJSVXTCLANGA'), 'lib', 'cpp'))

easybuild/toolchains/ffmpi.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
##
2+
# Copyright 2012-2021 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
EasyBuild support for fompi compiler toolchain (includes Fujitsu Compiler and MPI).
27+
28+
:author: Miguel Dias Costa (National University of Singapore)
29+
"""
30+
from easybuild.toolchains.compiler.fujitsu import FujitsuCompiler
31+
from easybuild.toolchains.mpi.fujitsumpi import FujitsuMPI
32+
33+
34+
class ffmpi(FujitsuCompiler, FujitsuMPI):
35+
"""Compiler toolchain with Fujitsu Compiler and MPI."""
36+
NAME = 'ffmpi'
37+
SUBTOOLCHAIN = FujitsuCompiler.NAME
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
##
2+
# Copyright 2012-2021 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
Support for FFTW (Fastest Fourier Transform in the West) as toolchain FFT library.
27+
28+
:author: Stijn De Weirdt (Ghent University)
29+
:author: Kenneth Hoste (Ghent University)
30+
"""
31+
32+
from distutils.version import LooseVersion
33+
34+
from easybuild.tools.build_log import EasyBuildError
35+
from easybuild.tools.toolchain.fft import Fft
36+
37+
38+
class FujitsuFFTW(Fft):
39+
"""FFTW FFT library"""
40+
41+
FFT_MODULE_NAME = ['FFTW3-sve']
42+
43+
def _set_fftw_variables(self):
44+
45+
suffix = ''
46+
version = self.get_software_version(self.FFT_MODULE_NAME)[0]
47+
if LooseVersion(version) < LooseVersion('2') or LooseVersion(version) >= LooseVersion('4'):
48+
raise EasyBuildError("_set_fft_variables: FFTW unsupported version %s (major should be 2 or 3)", version)
49+
elif LooseVersion(version) > LooseVersion('2'):
50+
suffix = '3'
51+
52+
# order matters!
53+
fftw_libs = ["fftw%s" % suffix]
54+
if self.options.get('usempi', False):
55+
fftw_libs.insert(0, "fftw%s_mpi" % suffix)
56+
fftw_libs_mt = ["fftw%s" % suffix]
57+
if self.options.get('openmp', False):
58+
fftw_libs_mt.insert(0, "fftw%s_omp" % suffix)
59+
60+
self.FFT_LIB = fftw_libs
61+
self.FFT_LIB_MT = fftw_libs_mt
62+
63+
def _set_fft_variables(self):
64+
self._set_fftw_variables()
65+
66+
super(Fft, self)._set_fft_variables()
67+
68+
# TODO can these be replaced with the FFT ones?
69+
self.variables.join('FFTW_INC_DIR', 'FFT_INC_DIR')
70+
self.variables.join('FFTW_LIB_DIR', 'FFT_LIB_DIR')
71+
if 'FFT_STATIC_LIBS' in self.variables:
72+
self.variables.join('FFTW_STATIC_LIBS', 'FFT_STATIC_LIBS')
73+
if 'FFT_STATIC_LIBS_MT' in self.variables:
74+
self.variables.join('FFTW_STATIC_LIBS_MT', 'FFT_STATIC_LIBS_MT')

easybuild/toolchains/fujitsu.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##
2+
# Copyright 2014-2021 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
Fujitsu toolchain: Fujitsu compilers (CCE) and MPI via Fujitsu compiler drivers + Fujitsu SSL2 and Fujitsu FFTW
27+
28+
:author: Miguel Dias Costa (National University of Singapore)
29+
"""
30+
from easybuild.toolchains.compiler.fujitsu import FujitsuCompiler
31+
from easybuild.toolchains.linalg.fujitsussl import FujitsuSSL
32+
from easybuild.toolchains.ffmpi import ffmpi
33+
from easybuild.toolchains.fft.fujitsufftw import FujitsuFFTW
34+
from easybuild.toolchains.mpi.fujitsumpi import FujitsuMPI
35+
36+
37+
class Fujitsu(FujitsuCompiler, FujitsuMPI, FujitsuSSL, FujitsuFFTW):
38+
"""Compiler toolchain for Fujitsu."""
39+
NAME = 'Fujitsu'
40+
SUBTOOLCHAIN = ffmpi.NAME
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
##
2+
# Copyright 2014-2021 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
Support for Fujitsu's SSL library, which provides BLAS/LAPACK support.
27+
28+
:author: Miguel Dias Costa (National University of Singapore)
29+
"""
30+
import os
31+
32+
from easybuild.tools.build_log import EasyBuildError
33+
from easybuild.tools.toolchain.linalg import LinAlg
34+
35+
36+
FUJITSU_SSL_MODULE_NAME = None
37+
TC_CONSTANT_FUJITSU_SSL = 'FujitsuSSL'
38+
39+
40+
class FujitsuSSL(LinAlg):
41+
"""Support for Fujitsu's SSL library, which provides BLAS/LAPACK support."""
42+
# BLAS/LAPACK support
43+
# via lang/tcsds module
44+
BLAS_MODULE_NAME = ['lang']
45+
46+
# no need to specify libraries, compiler driver takes care of linking the right libraries
47+
BLAS_LIB = ['']
48+
BLAS_LIB_MT = ['']
49+
BLAS_FAMILY = TC_CONSTANT_FUJITSU_SSL
50+
51+
LAPACK_MODULE_NAME = None
52+
LAPACK_IS_BLAS = True
53+
LAPACK_FAMILY = TC_CONSTANT_FUJITSU_SSL
54+
55+
BLACS_MODULE_NAME = []
56+
SCALAPACK_MODULE_NAME = []
57+
58+
def _get_software_root(self, name):
59+
"""Get install prefix for specified software name; special treatment for Fujitsu modules."""
60+
if name == 'lang':
61+
# Fujitsu-provided module
62+
env_var = 'FJSVXTCLANGA'
63+
root = os.getenv(env_var, None)
64+
if root is None:
65+
raise EasyBuildError("Failed to determine install prefix for %s via $%s", name, env_var)
66+
else:
67+
self.log.debug("Obtained install prefix for %s via $%s: %s", name, env_var, root)
68+
else:
69+
root = super(FujitsuSSL, self)._get_software_root(name)
70+
71+
return root
72+
73+
def _set_blas_variables(self):
74+
"""Set link flags."""
75+
if self.options.get('openmp', None):
76+
self.variables.append('LDFLAGS', '-SSL2BLAMP')
77+
else:
78+
self.variables.append('LDFLAGS', '-SSL2')
79+
super(FujitsuSSL, self)._set_blas_variables()
80+
81+
def _set_blacs_variables(self):
82+
"""Skip setting BLACS related variables"""
83+
pass
84+
85+
def _set_scalapack_variables(self):
86+
"""Skip setting ScaLAPACK related variables"""
87+
pass
88+
89+
def definition(self):
90+
"""
91+
Filter BLAS module from toolchain definition.
92+
The SSL2 module is loaded indirectly (and versionless) via the tcsds module,
93+
and thus is not a direct toolchain component.
94+
"""
95+
tc_def = super(FujitsuSSL, self).definition()
96+
tc_def['BLAS'] = []
97+
tc_def['LAPACK'] = []
98+
return tc_def

0 commit comments

Comments
 (0)