Skip to content

Commit 8d8cacd

Browse files
add toolchain definition for fujitsu toolchain
1 parent 89ff20d commit 8d8cacd

File tree

7 files changed

+382
-6
lines changed

7 files changed

+382
-6
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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 easybuild.tools.systemtools as systemtools
33+
from easybuild.tools.toolchain.compiler import Compiler, DEFAULT_OPT_LEVEL
34+
35+
TC_CONSTANT_FUJITSU = 'Fujitsu'
36+
37+
38+
class FujitsuCompiler(Compiler):
39+
"""Generic support for using Fujitsu compiler drivers."""
40+
TOOLCHAIN_FAMILY = TC_CONSTANT_FUJITSU
41+
42+
# compiler module name is lang (with version e.g. tcsds-1.2.31)
43+
COMPILER_MODULE_NAME = ['lang']
44+
COMPILER_FAMILY = TC_CONSTANT_FUJITSU
45+
46+
COMPILER_CC = 'fcc'
47+
COMPILER_CXX = 'FCC'
48+
COMPILER_F77 = 'frt'
49+
COMPILER_F90 = 'frt'
50+
COMPILER_FC = 'frt'
51+
52+
COMPILER_UNIQUE_OPTION_MAP = {
53+
DEFAULT_OPT_LEVEL: 'Kfast',
54+
'optarch': '', # Fujitsu compiler by default generates code for the arch it is running on
55+
'openmp': 'Kopenmp',
56+
'unroll': 'funroll-loops',
57+
'strict': ['Kfp_precision'],
58+
'precise': ['Kfp_precision'],
59+
'defaultprec': [],
60+
'loose': ['Kfp_relaxed'],
61+
'veryloose': ['Kfp_relaxed'],
62+
'vectorize': {False: 'KNOSVE', True: 'KSVE'},
63+
}
64+
65+
# used when 'optarch' toolchain option is enabled (and --optarch is not specified)
66+
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = {
67+
# -march=archi[+features]. At least on Fugaku, these are set by default (-march=armv8.3-a+sve and -mcpu=a64fx)
68+
(systemtools.AARCH64, systemtools.ARM): '',
69+
}
70+
71+
# used with --optarch=GENERIC
72+
COMPILER_GENERIC_OPTION = {
73+
(systemtools.AARCH64, systemtools.ARM): '-mcpu=generic -mtune=generic',
74+
}
75+
76+
def _set_compiler_vars(self):
77+
super(FujitsuCompiler, self)._set_compiler_vars()
78+
79+
self.variables.nappend('CFLAGS', ['Nclang'])
80+
self.variables.nappend('CXXFLAGS', ['Nclang'])

easybuild/toolchains/ffmpi.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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.linalg.fujitsussl import FujitsuSSL
32+
from easybuild.toolchains.mpi.fujitsumpi import FujitsuMPI
33+
34+
35+
class ffmpi(FujitsuCompiler, FujitsuMPI, FujitsuSSL):
36+
"""Compiler toolchain with Fujitsu Compiler and MPI."""
37+
NAME = 'ffmpi'
38+
SUBTOOLCHAIN = FujitsuCompiler.NAME

easybuild/toolchains/fft/fftw.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ class Fftw(Fft):
3939
"""FFTW FFT library"""
4040

4141
FFT_MODULE_NAME = ['FFTW']
42+
FFTW_API_VERSION = ''
4243

4344
def _set_fftw_variables(self):
4445

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'
46+
suffix = self.FFTW_API_VERSION
47+
if not suffix:
48+
version = self.get_software_version(self.FFT_MODULE_NAME)[0]
49+
if LooseVersion(version) < LooseVersion('2') or LooseVersion(version) >= LooseVersion('4'):
50+
raise EasyBuildError("_set_fft_variables: FFTW unsupported version %s (major should be 2 or 3)",
51+
version)
52+
elif LooseVersion(version) > LooseVersion('2'):
53+
suffix = '3'
5154

5255
# order matters!
5356
fftw_libs = ["fftw%s" % suffix]
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+
Support for Fujitsu FFTW as toolchain FFT library.
27+
28+
:author: Miguel Dias Costa (National University of Singapore)
29+
"""
30+
from easybuild.toolchains.fft.fftw import Fftw
31+
32+
33+
class FujitsuFFTW(Fftw):
34+
"""Fujitsu FFTW FFT library"""
35+
36+
FFT_MODULE_NAME = ['FFTW3-sve']
37+
FFTW_API_VERSION = '3'

easybuild/toolchains/fujitsu.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 and MPI + Fujitsu SSL2 and Fujitsu FFTW
27+
28+
:author: Miguel Dias Costa (National University of Singapore)
29+
"""
30+
from easybuild.toolchains.ffmpi import ffmpi
31+
from easybuild.toolchains.fft.fujitsufftw import FujitsuFFTW
32+
33+
34+
class Fujitsu(ffmpi, FujitsuFFTW):
35+
"""Compiler toolchain for Fujitsu."""
36+
NAME = 'Fujitsu'
37+
SUBTOOLCHAIN = ffmpi.NAME
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
33+
from easybuild.tools.build_log import EasyBuildError
34+
from easybuild.tools.toolchain.constants import COMPILER_FLAGS
35+
from easybuild.tools.toolchain.linalg import LinAlg
36+
37+
38+
FUJITSU_SSL_MODULE_NAME = None
39+
TC_CONSTANT_FUJITSU_SSL = 'FujitsuSSL'
40+
41+
42+
class FujitsuSSL(LinAlg):
43+
"""Support for Fujitsu's SSL library, which provides BLAS/LAPACK support."""
44+
# BLAS/LAPACK support
45+
# via lang/tcsds module
46+
BLAS_MODULE_NAME = ['lang']
47+
48+
# no need to specify libraries, compiler driver takes care of linking the right libraries
49+
BLAS_LIB = ['']
50+
BLAS_LIB_MT = ['']
51+
BLAS_FAMILY = TC_CONSTANT_FUJITSU_SSL
52+
53+
LAPACK_MODULE_NAME = None
54+
LAPACK_IS_BLAS = True
55+
LAPACK_FAMILY = TC_CONSTANT_FUJITSU_SSL
56+
57+
BLACS_MODULE_NAME = None
58+
59+
SCALAPACK_MODULE_NAME = BLAS_MODULE_NAME
60+
SCALAPACK_LIB = ['']
61+
SCALAPACK_LIB_MT = ['']
62+
SCALAPACK_FAMILY = TC_CONSTANT_FUJITSU_SSL
63+
64+
def _get_software_root(self, name):
65+
"""Get install prefix for specified software name; special treatment for Fujitsu modules."""
66+
if name == 'lang':
67+
# Fujitsu-provided module
68+
env_var = 'FJSVXTCLANGA'
69+
root = os.getenv(env_var, None)
70+
if root is None:
71+
raise EasyBuildError("Failed to determine install prefix for %s via $%s", name, env_var)
72+
else:
73+
self.log.debug("Obtained install prefix for %s via $%s: %s", name, env_var, root)
74+
else:
75+
root = super(FujitsuSSL, self)._get_software_root(name)
76+
77+
return root
78+
79+
def _set_blas_variables(self):
80+
"""Setting FujitsuSSL specific BLAS related variables"""
81+
super(FujitsuSSL, self)._set_blas_variables()
82+
if self.options.get('openmp', None):
83+
for flags_var, _ in COMPILER_FLAGS:
84+
self.variables.nappend(flags_var, ['SSL2BLAMP'])
85+
else:
86+
for flags_var, _ in COMPILER_FLAGS:
87+
self.variables.nappend(flags_var, ['SSL2'])
88+
89+
def _set_scalapack_variables(self):
90+
"""Setting FujitsuSSL specific SCALAPACK related variables"""
91+
super(FujitsuSSL, self)._set_scalapack_variables()
92+
for flags_var, _ in COMPILER_FLAGS:
93+
self.variables.nappend(flags_var, ['SCALAPACK'])
94+
95+
def definition(self):
96+
"""
97+
Filter BLAS module from toolchain definition.
98+
The SSL2 module is loaded indirectly (and versionless) via the lang module,
99+
and thus is not a direct toolchain component.
100+
"""
101+
tc_def = super(FujitsuSSL, self).definition()
102+
tc_def['BLAS'] = []
103+
tc_def['LAPACK'] = []
104+
tc_def['SCALAPACK'] = []
105+
return tc_def
106+
107+
def set_variables(self):
108+
"""Set the variables"""
109+
self._set_blas_variables()
110+
self._set_lapack_variables()
111+
self._set_scalapack_variables()
112+
113+
self.log.devel('set_variables: LinAlg variables %s', self.variables)
114+
115+
super(FujitsuSSL, self).set_variables()

0 commit comments

Comments
 (0)