Skip to content

Commit 0e33420

Browse files
authored
Merge pull request #3971 from ocaisa/mpitrampoline
add gmpit toolchain definition (GCC + MPItrampoline)
2 parents 907e625 + 515573f commit 0e33420

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

easybuild/toolchains/gmpit.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
##
2+
# Copyright 2022-2022 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 gmpit compiler toolchain (includes GCC and MPItrampoline).
27+
28+
:author: Alan O'Cais (CECAM)
29+
"""
30+
from distutils.version import LooseVersion
31+
import re
32+
33+
from easybuild.toolchains.gcc import GccToolchain
34+
from easybuild.toolchains.mpi.mpitrampoline import MPItrampoline
35+
36+
37+
class Gmpit(GccToolchain, MPItrampoline):
38+
"""Compiler toolchain with GCC and MPItrampoline."""
39+
NAME = 'gmpit'
40+
SUBTOOLCHAIN = GccToolchain.NAME
41+
42+
def is_deprecated(self):
43+
"""Return whether or not this toolchain is deprecated."""
44+
# need to transform a version like '2018b' with something that is safe to compare with '2019'
45+
# comparing subversions that include letters causes TypeErrors in Python 3
46+
# 'a' is assumed to be equivalent with '.01' (January), and 'b' with '.07' (June) (good enough for this purpose)
47+
version = self.version.replace('a', '.01').replace('b', '.07')
48+
49+
deprecated = False
50+
51+
# make sure a non-symbolic version (e.g., 'system') is used before making comparisons using LooseVersion
52+
if re.match('^[0-9]', version):
53+
if LooseVersion(version) < LooseVersion('2019'):
54+
deprecated = True
55+
56+
return deprecated
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
##
2+
# Copyright 2022-2022 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 MPItrampoline as toolchain MPI library.
27+
28+
:author: Alan O'Cais (CECAM)
29+
"""
30+
31+
from easybuild.tools.toolchain.constants import COMPILER_VARIABLES, MPI_COMPILER_VARIABLES
32+
from easybuild.tools.toolchain.mpi import Mpi
33+
from easybuild.tools.toolchain.variables import CommandFlagList
34+
35+
36+
TC_CONSTANT_MPITRAMPOLINE = "MPItrampoline"
37+
TC_CONSTANT_MPI_TYPE_MPITRAMPOLINE = "MPI_TYPE_MPITRAMPOLINE"
38+
39+
40+
class MPItrampoline(Mpi):
41+
"""MPItrampoline MPI class"""
42+
MPI_MODULE_NAME = ['MPItrampoline']
43+
MPI_FAMILY = TC_CONSTANT_MPITRAMPOLINE
44+
MPI_TYPE = TC_CONSTANT_MPI_TYPE_MPITRAMPOLINE
45+
46+
MPI_LIBRARY_NAME = 'mpi'
47+
48+
# May be version-dependent, so defined at runtime
49+
MPI_COMPILER_MPIF77 = None
50+
MPI_COMPILER_MPIF90 = None
51+
MPI_COMPILER_MPIFC = None
52+
53+
# MPItrampoline reads from CC etc env variables
54+
MPI_SHARED_OPTION_MAP = dict([('_opt_%s' % var, '') for var, _ in MPI_COMPILER_VARIABLES])
55+
56+
MPI_LINK_INFO_OPTION = '-showme:link'
57+
58+
def __init__(self, *args, **kwargs):
59+
"""Toolchain constructor"""
60+
super(MPItrampoline, self).__init__(*args, **kwargs)
61+
62+
def _set_mpi_compiler_variables(self):
63+
"""Define MPI wrapper commands and add MPITRAMPOLINE_* variables to set."""
64+
65+
self.MPI_COMPILER_MPIF77 = 'mpifort'
66+
self.MPI_COMPILER_MPIF90 = 'mpifort'
67+
self.MPI_COMPILER_MPIFC = 'mpifort'
68+
69+
# this needs to be done first, otherwise e.g., CC is set to MPICC if the usempi toolchain option is enabled
70+
for var, _ in COMPILER_VARIABLES:
71+
self.variables.nappend(
72+
'MPITRAMPOLINE_%s' % var, str(self.variables[var].get_first()),
73+
var_class=CommandFlagList
74+
)
75+
76+
super(MPItrampoline, self)._set_mpi_compiler_variables()

easybuild/tools/toolchain/mpi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def get_mpi_cmd_template(mpi_family, params, mpi_version=None):
6868
toolchain.MVAPICH2: mpirun_n_cmd,
6969
toolchain.MPICH: mpirun_n_cmd,
7070
toolchain.MPICH2: mpirun_n_cmd,
71+
toolchain.MPITRAMPOLINE: "mpiexec -n %(nr_ranks)s %(cmd)s",
7172
}
7273

7374
# Intel MPI mpirun needs more work

0 commit comments

Comments
 (0)