Skip to content

Commit fce5c9b

Browse files
committed
PGI: adding Cray's PrgEnv-pgi (cscs)
1 parent a4f2495 commit fce5c9b

3 files changed

Lines changed: 127 additions & 0 deletions

File tree

easybuild/toolchains/compiler/craype.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import easybuild.tools.environment as env
4343
from easybuild.toolchains.compiler.gcc import TC_CONSTANT_GCC, Gcc
4444
from easybuild.toolchains.compiler.inteliccifort import TC_CONSTANT_INTELCOMP, IntelIccIfort
45+
from easybuild.toolchains.compiler.pgi import TC_CONSTANT_PGI, Pgi
4546
from easybuild.tools.build_log import EasyBuildError
4647
from easybuild.tools.config import build_option
4748
from easybuild.tools.toolchain.compiler import Compiler
@@ -152,6 +153,18 @@ def __init__(self, *args, **kwargs):
152153
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = IntelIccIfort.COMPILER_UNIQUE_OPTION_MAP[precflag]
153154

154155

156+
class CrayPEPGI(CrayPECompiler):
157+
"""Support for using the Cray PGI compiler wrappers."""
158+
PRGENV_MODULE_NAME_SUFFIX = 'pgi' # PrgEnv-pgi
159+
COMPILER_FAMILY = TC_CONSTANT_PGI
160+
161+
def __init__(self, *args, **kwargs):
162+
"""CrayPEPGI constructor."""
163+
super(CrayPEPGI, self).__init__(*args, **kwargs)
164+
for precflag in self.COMPILER_PREC_FLAGS:
165+
self.COMPILER_UNIQUE_OPTION_MAP[precflag] = Pgi.COMPILER_UNIQUE_OPTION_MAP[precflag]
166+
167+
155168
class CrayPECray(CrayPECompiler):
156169
"""Support for using the Cray CCE compiler wrappers."""
157170
PRGENV_MODULE_NAME_SUFFIX = 'cray' # PrgEnv-cray

easybuild/toolchains/craypgi.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
##
2+
# Copyright 2014-2015 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://vscentrum.be/nl/en),
8+
# the Hercules foundation (http://www.herculesstichting.be/in_English)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# http://github.com/hpcugent/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+
CrayPGI toolchain: Cray compilers (PGI) and MPI via Cray compiler drivers (PrgEnv-pgi) minus LibSci minus Cray FFTW
27+
@author: jgp (CSCS)
28+
"""
29+
from easybuild.toolchains.compiler.craype import CrayPEPGI
30+
from easybuild.toolchains.mpi.craympich import CrayMPICH
31+
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME
32+
33+
class CrayPGI(CrayPEPGI, CrayMPICH):
34+
"""Compiler toolchain for Cray Programming Environment for Cray Compiling Environment (PGI) (PrgEnv-pgi)."""
35+
NAME = 'CrayPGI'
36+
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME
37+
38+
def prepare(self, *args, **kwargs):
39+
"""Prepare to use this toolchain; marked as experimental."""
40+
self.log.experimental("Using %s toolchain", self.NAME)
41+
super(CrayPGI, self).prepare(*args, **kwargs)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
##
2+
# Copyright 2015-2015 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://vscentrum.be/nl/en),
8+
# the Hercules foundation (http://www.herculesstichting.be/in_English)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# http://github.com/hpcugent/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 installing Cray toolchains, implemented as an easyblock
27+
28+
@author: Kenneth Hoste (Ghent University)
29+
"""
30+
31+
from easybuild.easyblocks.generic.bundle import Bundle
32+
33+
34+
KNOWN_PRGENVS = ['PrgEnv-cray', 'PrgEnv-gnu', 'PrgEnv-intel', 'PrgEnv-pgi']
35+
36+
37+
class CrayToolchain(Bundle):
38+
"""
39+
Compiler toolchain: generate module file only, nothing to build/install
40+
"""
41+
def make_module_dep(self):
42+
"""
43+
Generate load/swap statements for dependencies in the module file
44+
"""
45+
# build dict with info for 'module swap' statements for dependencies,
46+
# i.e. a mapping of full module name to the module name to unload before loading
47+
# for example: {'fftw/3.3.4.1': 'fftw', 'cray-libsci/13.0.4': 'cray-libsci'}
48+
unload_info = {}
49+
for dep in self.toolchain.dependencies:
50+
mod_name = dep['full_mod_name']
51+
# determine versionless module name, e.g. 'fftw/3.3.4.1' => 'fftw'
52+
depname = '/'.join(mod_name.split('/')[:-1])
53+
if not mod_name.startswith('PrgEnv-'):
54+
unload_info.update({mod_name: depname})
55+
else:
56+
my_prgenv_short = depname
57+
my_prgenv_full = dep['full_mod_name']
58+
59+
self.log.debug("Swap info for dependencies of %s: %s", self.full_mod_name, unload_info)
60+
txt = super(CrayToolchain, self).make_module_dep(unload_info=unload_info)
61+
swap_prgenv = "if { [ is-loaded " + my_prgenv_short + " ] } { \n"
62+
swap_prgenv += " module swap " + my_prgenv_short + " " + my_prgenv_full + "\n}\n"
63+
64+
# unload statements for PrgEnv-* modules must be included *first*
65+
comment = self.module_generator.comment("first, unload any PrgEnv module that may be loaded").strip()
66+
prgenv_unloads = ['', comment]
67+
for prgenv in KNOWN_PRGENVS:
68+
if prgenv not in my_prgenv_short:
69+
prgenv_unloads.append(self.module_generator.unload_module(prgenv).strip())
70+
71+
comment = self.module_generator.comment("next, load toolchain components")
72+
txt = '\n'.join(prgenv_unloads) + '\n\n' + comment + swap_prgenv + txt
73+
return txt

0 commit comments

Comments
 (0)