Skip to content

Commit f2454ea

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

File tree

6 files changed

+394
-0
lines changed

6 files changed

+394
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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_UNIQUE_OPTS = {
47+
}
48+
49+
COMPILER_CC = 'fcc'
50+
COMPILER_CXX = 'FCC'
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+
}

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: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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 = None
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 = 'LANG_DIR'
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_blacs_variables(self):
74+
"""Skip setting BLACS related variables"""
75+
pass
76+
77+
def _set_scalapack_variables(self):
78+
"""Skip setting ScaLAPACK related variables"""
79+
pass
80+
81+
def definition(self):
82+
"""
83+
Filter BLAS module from toolchain definition.
84+
The SSL2 module is loaded indirectly (and versionless) via the tcsds module,
85+
and thus is not a direct toolchain component.
86+
"""
87+
tc_def = super(FujitsuSSL, self).definition()
88+
tc_def['BLAS'] = []
89+
tc_def['LAPACK'] = []
90+
return tc_def
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
MPI support for Fujitsu 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.openmpi import TC_CONSTANT_OPENMPI, TC_CONSTANT_MPI_TYPE_OPENMPI
32+
from easybuild.tools.build_log import EasyBuildError
33+
from easybuild.tools.toolchain.constants import COMPILER_VARIABLES, MPI_COMPILER_TEMPLATE, MPI_COMPILER_VARIABLES
34+
from easybuild.tools.toolchain.constants import SEQ_COMPILER_TEMPLATE
35+
from easybuild.tools.toolchain.mpi import Mpi
36+
37+
38+
class FujitsuMPI(Mpi):
39+
"""Generic support for using Fujitsu compiler wrappers"""
40+
# MPI support
41+
# no separate module, Fujitsu compiler drivers always provide MPI support
42+
MPI_MODULE_NAME = None
43+
MPI_FAMILY = TC_CONSTANT_OPENMPI
44+
MPI_TYPE = TC_CONSTANT_MPI_TYPE_OPENMPI
45+
46+
MPI_COMPILER_MPICC = FujitsuCompiler.COMPILER_CC
47+
MPI_COMPILER_MPICXX = FujitsuCompiler.COMPILER_CXX
48+
MPI_COMPILER_MPIF77 = FujitsuCompiler.COMPILER_F77
49+
MPI_COMPILER_MPIF90 = FujitsuCompiler.COMPILER_F90
50+
MPI_COMPILER_MPIFC = FujitsuCompiler.COMPILER_FC
51+
52+
# no MPI wrappers, so no need to specify serial compiler
53+
MPI_SHARED_OPTION_MAP = dict([('_opt_%s' % var, '') for var, _ in MPI_COMPILER_VARIABLES])
54+
55+
def _set_mpi_compiler_variables(self):
56+
"""Set the MPI compiler variables"""
57+
for var_tuple in COMPILER_VARIABLES:
58+
c_var = var_tuple[0] # [1] is the description
59+
var = MPI_COMPILER_TEMPLATE % {'c_var': c_var}
60+
61+
value = getattr(self, 'MPI_COMPILER_%s' % var.upper(), None)
62+
if value is None:
63+
raise EasyBuildError("_set_mpi_compiler_variables: mpi compiler variable %s undefined", var)
64+
self.variables.nappend_el(var, value)
65+
66+
if self.options.get('usempi', None):
67+
var_seq = SEQ_COMPILER_TEMPLATE % {'c_var': c_var}
68+
seq_comp = self.variables[c_var]
69+
self.log.debug('_set_mpi_compiler_variables: usempi set: defining %s as %s', var_seq, seq_comp)
70+
self.variables[var_seq] = seq_comp
71+
72+
if self.options.get('cciscxx', None):
73+
self.log.debug("_set_mpi_compiler_variables: cciscxx set: switching MPICXX %s for MPICC value %s" %
74+
(self.variables['MPICXX'], self.variables['MPICC']))
75+
self.variables['MPICXX'] = self.variables['MPICC']

0 commit comments

Comments
 (0)