Skip to content

Commit

Permalink
Merge pull request #3971 from ocaisa/mpitrampoline
Browse files Browse the repository at this point in the history
add gmpit toolchain definition (GCC + MPItrampoline)
  • Loading branch information
boegel authored Mar 1, 2022
2 parents 907e625 + 515573f commit 0e33420
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
56 changes: 56 additions & 0 deletions easybuild/toolchains/gmpit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
##
# Copyright 2022-2022 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 gmpit compiler toolchain (includes GCC and MPItrampoline).
:author: Alan O'Cais (CECAM)
"""
from distutils.version import LooseVersion
import re

from easybuild.toolchains.gcc import GccToolchain
from easybuild.toolchains.mpi.mpitrampoline import MPItrampoline


class Gmpit(GccToolchain, MPItrampoline):
"""Compiler toolchain with GCC and MPItrampoline."""
NAME = 'gmpit'
SUBTOOLCHAIN = GccToolchain.NAME

def is_deprecated(self):
"""Return whether or not this toolchain is deprecated."""
# need to transform a version like '2018b' with something that is safe to compare with '2019'
# comparing subversions that include letters causes TypeErrors in Python 3
# 'a' is assumed to be equivalent with '.01' (January), and 'b' with '.07' (June) (good enough for this purpose)
version = self.version.replace('a', '.01').replace('b', '.07')

deprecated = False

# make sure a non-symbolic version (e.g., 'system') is used before making comparisons using LooseVersion
if re.match('^[0-9]', version):
if LooseVersion(version) < LooseVersion('2019'):
deprecated = True

return deprecated
76 changes: 76 additions & 0 deletions easybuild/toolchains/mpi/mpitrampoline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
##
# Copyright 2022-2022 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 MPItrampoline as toolchain MPI library.
:author: Alan O'Cais (CECAM)
"""

from easybuild.tools.toolchain.constants import COMPILER_VARIABLES, MPI_COMPILER_VARIABLES
from easybuild.tools.toolchain.mpi import Mpi
from easybuild.tools.toolchain.variables import CommandFlagList


TC_CONSTANT_MPITRAMPOLINE = "MPItrampoline"
TC_CONSTANT_MPI_TYPE_MPITRAMPOLINE = "MPI_TYPE_MPITRAMPOLINE"


class MPItrampoline(Mpi):
"""MPItrampoline MPI class"""
MPI_MODULE_NAME = ['MPItrampoline']
MPI_FAMILY = TC_CONSTANT_MPITRAMPOLINE
MPI_TYPE = TC_CONSTANT_MPI_TYPE_MPITRAMPOLINE

MPI_LIBRARY_NAME = 'mpi'

# May be version-dependent, so defined at runtime
MPI_COMPILER_MPIF77 = None
MPI_COMPILER_MPIF90 = None
MPI_COMPILER_MPIFC = None

# MPItrampoline reads from CC etc env variables
MPI_SHARED_OPTION_MAP = dict([('_opt_%s' % var, '') for var, _ in MPI_COMPILER_VARIABLES])

MPI_LINK_INFO_OPTION = '-showme:link'

def __init__(self, *args, **kwargs):
"""Toolchain constructor"""
super(MPItrampoline, self).__init__(*args, **kwargs)

def _set_mpi_compiler_variables(self):
"""Define MPI wrapper commands and add MPITRAMPOLINE_* variables to set."""

self.MPI_COMPILER_MPIF77 = 'mpifort'
self.MPI_COMPILER_MPIF90 = 'mpifort'
self.MPI_COMPILER_MPIFC = 'mpifort'

# this needs to be done first, otherwise e.g., CC is set to MPICC if the usempi toolchain option is enabled
for var, _ in COMPILER_VARIABLES:
self.variables.nappend(
'MPITRAMPOLINE_%s' % var, str(self.variables[var].get_first()),
var_class=CommandFlagList
)

super(MPItrampoline, self)._set_mpi_compiler_variables()
1 change: 1 addition & 0 deletions easybuild/tools/toolchain/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def get_mpi_cmd_template(mpi_family, params, mpi_version=None):
toolchain.MVAPICH2: mpirun_n_cmd,
toolchain.MPICH: mpirun_n_cmd,
toolchain.MPICH2: mpirun_n_cmd,
toolchain.MPITRAMPOLINE: "mpiexec -n %(nr_ranks)s %(cmd)s",
}

# Intel MPI mpirun needs more work
Expand Down

0 comments on commit 0e33420

Please sign in to comment.