-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add toolchain definition for fujitsu toolchain
- Loading branch information
1 parent
89ff20d
commit 648363c
Showing
6 changed files
with
419 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
## | ||
# Copyright 2014-2021 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
""" | ||
Support for the Fujitsu compiler drivers (aka fcc, frt). | ||
The basic concept the same as for the Cray Programming Environment. | ||
:author: Miguel Dias Costa (National University of Singapore) | ||
""" | ||
import os | ||
|
||
import easybuild.tools.environment as env | ||
import easybuild.tools.systemtools as systemtools | ||
from easybuild.tools.toolchain.compiler import Compiler, DEFAULT_OPT_LEVEL | ||
|
||
TC_CONSTANT_FUJITSU = 'Fujitsu' | ||
|
||
|
||
class FujitsuCompiler(Compiler): | ||
"""Generic support for using Fujitsu compiler drivers.""" | ||
TOOLCHAIN_FAMILY = TC_CONSTANT_FUJITSU | ||
|
||
# compiler module name is lang (with version e.g. tcsds-1.2.31) | ||
COMPILER_MODULE_NAME = ['lang'] | ||
COMPILER_FAMILY = TC_CONSTANT_FUJITSU | ||
|
||
COMPILER_CC = 'fcc -Nclang' | ||
COMPILER_CXX = 'FCC -Nclang' | ||
|
||
COMPILER_F77 = 'frt' | ||
COMPILER_F90 = 'frt' | ||
COMPILER_FC = 'frt' | ||
|
||
COMPILER_UNIQUE_OPTION_MAP = { | ||
DEFAULT_OPT_LEVEL: 'Kfast', | ||
'optarch': '', # Fujitsu compiler by default generates code for the arch it is running on | ||
'openmp': 'Kopenmp', | ||
'unroll': 'funroll-loops', | ||
'strict': ['Kfp_precision'], | ||
'precise': ['Kfp_precision'], | ||
'defaultprec': [], | ||
'loose': ['Kfp_relaxed'], | ||
'veryloose': ['Kfp_relaxed'], | ||
'vectorize': {False: 'KNOSVE', True: 'KSVE'}, | ||
} | ||
|
||
# used when 'optarch' toolchain option is enabled (and --optarch is not specified) | ||
COMPILER_OPTIMAL_ARCHITECTURE_OPTION = { | ||
# -march=archi[+features]. At least on Fugaku, these are set by default (-march=armv8.3-a+sve and -mcpu=a64fx) | ||
(systemtools.AARCH64, systemtools.ARM): '', | ||
} | ||
|
||
# used with --optarch=GENERIC | ||
COMPILER_GENERIC_OPTION = { | ||
(systemtools.AARCH64, systemtools.ARM): '-mcpu=generic -mtune=generic', | ||
} | ||
|
||
def _set_compiler_vars(self): | ||
super(FujitsuCompiler, self)._set_compiler_vars() | ||
|
||
# TODO: check for a better way | ||
env.setvar('CPP', os.path.join(os.getenv('FJSVXTCLANGA'), 'lib', 'cpp')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## | ||
# Copyright 2012-2021 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
""" | ||
EasyBuild support for fompi compiler toolchain (includes Fujitsu Compiler and MPI). | ||
:author: Miguel Dias Costa (National University of Singapore) | ||
""" | ||
from easybuild.toolchains.compiler.fujitsu import FujitsuCompiler | ||
from easybuild.toolchains.mpi.fujitsumpi import FujitsuMPI | ||
|
||
|
||
class ffmpi(FujitsuCompiler, FujitsuMPI): | ||
"""Compiler toolchain with Fujitsu Compiler and MPI.""" | ||
NAME = 'ffmpi' | ||
SUBTOOLCHAIN = FujitsuCompiler.NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
## | ||
# Copyright 2012-2021 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
""" | ||
Support for FFTW (Fastest Fourier Transform in the West) as toolchain FFT library. | ||
:author: Stijn De Weirdt (Ghent University) | ||
:author: Kenneth Hoste (Ghent University) | ||
""" | ||
|
||
from distutils.version import LooseVersion | ||
|
||
from easybuild.tools.build_log import EasyBuildError | ||
from easybuild.tools.toolchain.fft import Fft | ||
|
||
|
||
class FujitsuFFTW(Fft): | ||
"""FFTW FFT library""" | ||
|
||
FFT_MODULE_NAME = ['FFTW3-sve'] | ||
|
||
def _set_fftw_variables(self): | ||
|
||
suffix = '' | ||
version = self.get_software_version(self.FFT_MODULE_NAME)[0] | ||
if LooseVersion(version) < LooseVersion('2') or LooseVersion(version) >= LooseVersion('4'): | ||
raise EasyBuildError("_set_fft_variables: FFTW unsupported version %s (major should be 2 or 3)", version) | ||
elif LooseVersion(version) > LooseVersion('2'): | ||
suffix = '3' | ||
|
||
# order matters! | ||
fftw_libs = ["fftw%s" % suffix] | ||
if self.options.get('usempi', False): | ||
fftw_libs.insert(0, "fftw%s_mpi" % suffix) | ||
fftw_libs_mt = ["fftw%s" % suffix] | ||
if self.options.get('openmp', False): | ||
fftw_libs_mt.insert(0, "fftw%s_omp" % suffix) | ||
|
||
self.FFT_LIB = fftw_libs | ||
self.FFT_LIB_MT = fftw_libs_mt | ||
|
||
def _set_fft_variables(self): | ||
self._set_fftw_variables() | ||
|
||
super(Fft, self)._set_fft_variables() | ||
|
||
# TODO can these be replaced with the FFT ones? | ||
self.variables.join('FFTW_INC_DIR', 'FFT_INC_DIR') | ||
self.variables.join('FFTW_LIB_DIR', 'FFT_LIB_DIR') | ||
if 'FFT_STATIC_LIBS' in self.variables: | ||
self.variables.join('FFTW_STATIC_LIBS', 'FFT_STATIC_LIBS') | ||
if 'FFT_STATIC_LIBS_MT' in self.variables: | ||
self.variables.join('FFTW_STATIC_LIBS_MT', 'FFT_STATIC_LIBS_MT') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## | ||
# Copyright 2014-2021 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
""" | ||
Fujitsu toolchain: Fujitsu compilers (CCE) and MPI via Fujitsu compiler drivers + Fujitsu SSL2 and Fujitsu FFTW | ||
:author: Miguel Dias Costa (National University of Singapore) | ||
""" | ||
from easybuild.toolchains.compiler.fujitsu import FujitsuCompiler | ||
from easybuild.toolchains.linalg.fujitsussl import FujitsuSSL | ||
from easybuild.toolchains.ffmpi import ffmpi | ||
from easybuild.toolchains.fft.fujitsufftw import FujitsuFFTW | ||
from easybuild.toolchains.mpi.fujitsumpi import FujitsuMPI | ||
|
||
|
||
class Fujitsu(FujitsuCompiler, FujitsuMPI, FujitsuSSL, FujitsuFFTW): | ||
"""Compiler toolchain for Fujitsu.""" | ||
NAME = 'Fujitsu' | ||
SUBTOOLCHAIN = ffmpi.NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
## | ||
# Copyright 2014-2021 Ghent University | ||
# | ||
# This file is part of EasyBuild, | ||
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
# with support of Ghent University (http://ugent.be/hpc), | ||
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
# Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
# | ||
# https://github.com/easybuilders/easybuild | ||
# | ||
# EasyBuild is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation v2. | ||
# | ||
# EasyBuild is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
""" | ||
Support for Fujitsu's SSL library, which provides BLAS/LAPACK support. | ||
:author: Miguel Dias Costa (National University of Singapore) | ||
""" | ||
import os | ||
|
||
from easybuild.tools.build_log import EasyBuildError | ||
from easybuild.tools.toolchain.linalg import LinAlg | ||
|
||
|
||
FUJITSU_SSL_MODULE_NAME = None | ||
TC_CONSTANT_FUJITSU_SSL = 'FujitsuSSL' | ||
|
||
|
||
class FujitsuSSL(LinAlg): | ||
"""Support for Fujitsu's SSL library, which provides BLAS/LAPACK support.""" | ||
# BLAS/LAPACK support | ||
# via lang/tcsds module | ||
BLAS_MODULE_NAME = ['lang'] | ||
|
||
# no need to specify libraries, compiler driver takes care of linking the right libraries | ||
BLAS_LIB = [''] | ||
BLAS_LIB_MT = [''] | ||
BLAS_FAMILY = TC_CONSTANT_FUJITSU_SSL | ||
|
||
LAPACK_MODULE_NAME = None | ||
LAPACK_IS_BLAS = True | ||
LAPACK_FAMILY = TC_CONSTANT_FUJITSU_SSL | ||
|
||
BLACS_MODULE_NAME = [] | ||
SCALAPACK_MODULE_NAME = [] | ||
|
||
def _get_software_root(self, name): | ||
"""Get install prefix for specified software name; special treatment for Fujitsu modules.""" | ||
if name == 'lang': | ||
# Fujitsu-provided module | ||
env_var = 'FJSVXTCLANGA' | ||
root = os.getenv(env_var, None) | ||
if root is None: | ||
raise EasyBuildError("Failed to determine install prefix for %s via $%s", name, env_var) | ||
else: | ||
self.log.debug("Obtained install prefix for %s via $%s: %s", name, env_var, root) | ||
else: | ||
root = super(FujitsuSSL, self)._get_software_root(name) | ||
|
||
return root | ||
|
||
def _set_blas_variables(self): | ||
"""Set link flags.""" | ||
if self.options.get('openmp', None): | ||
self.variables.append('LDFLAGS', '-SSL2BLAMP') | ||
else: | ||
self.variables.append('LDFLAGS', '-SSL2') | ||
super(FujitsuSSL, self)._set_blas_variables() | ||
|
||
def _set_blacs_variables(self): | ||
"""Skip setting BLACS related variables""" | ||
pass | ||
|
||
def _set_scalapack_variables(self): | ||
"""Skip setting ScaLAPACK related variables""" | ||
pass | ||
|
||
def definition(self): | ||
""" | ||
Filter BLAS module from toolchain definition. | ||
The SSL2 module is loaded indirectly (and versionless) via the tcsds module, | ||
and thus is not a direct toolchain component. | ||
""" | ||
tc_def = super(FujitsuSSL, self).definition() | ||
tc_def['BLAS'] = [] | ||
tc_def['LAPACK'] = [] | ||
return tc_def |
Oops, something went wrong.