Skip to content

Commit 1d75e61

Browse files
authored
Merge pull request #2082 from bartoldeman/linalg_without_mpi
support use of linalg without MPI, add iimkl toolchain definition
2 parents 9e71fe0 + 732b2a4 commit 1d75e61

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

easybuild/toolchains/fft/intelfftw.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ def _set_fftw_variables(self):
6666
else:
6767
raise EasyBuildError("Not using Intel compilers, PGI nor GCC, don't know compiler suffix for FFTW libraries.")
6868

69-
fftw_libs = ["fftw3xc%s%s" % (compsuff, picsuff)]
70-
if self.options['usempi']:
69+
interface_lib = "fftw3xc%s%s" % (compsuff, picsuff)
70+
fftw_libs = [interface_lib]
71+
cluster_interface_lib = None
72+
if self.options.get('usempi', False):
7173
# add cluster interface for recent imkl versions
72-
if LooseVersion(imklver) >= LooseVersion("11.0.2"):
73-
fftw_libs.append("fftw3x_cdft%s%s" % (bitsuff, picsuff))
74-
elif LooseVersion(imklver) >= LooseVersion("10.3"):
75-
fftw_libs.append("fftw3x_cdft%s" % picsuff)
74+
if LooseVersion(imklver) >= LooseVersion('10.3'):
75+
suff = picsuff
76+
if LooseVersion(imklver) >= LooseVersion('11.0.2'):
77+
suff = bitsuff + suff
78+
cluster_interface_lib = 'fftw3x_cdft%s' % suff
79+
fftw_libs.append(cluster_interface_lib)
7680
fftw_libs.append("mkl_cdft_core") # add cluster dft
7781
fftw_libs.extend(self.variables['LIBBLACS'].flatten()) # add BLACS; use flatten because ListOfList
7882

@@ -90,6 +94,13 @@ def _set_fftw_variables(self):
9094
# filter out libraries from list of FFTW libraries to check for if they are not provided by Intel MKL
9195
check_fftw_libs = [lib for lib in fftw_libs if lib not in ['dl', 'gfortran']]
9296
fftw_lib_exists = lambda x: any([os.path.exists(os.path.join(d, "lib%s.a" % x)) for d in fft_lib_dirs])
97+
if not fftw_lib_exists(interface_lib) and LooseVersion(imklver) >= LooseVersion("10.2"):
98+
# interface libs can be optional:
99+
# MKL >= 10.2 include fftw3xc and fftw3xf interfaces in LIBBLAS=libmkl_gf/libmkl_intel
100+
# See https://software.intel.com/en-us/articles/intel-mkl-main-libraries-contain-fftw3-interfaces
101+
# The cluster interface libs (libfftw3x_cdft*) can be omitted if the toolchain does not provide MPI-FFTW
102+
# interfaces.
103+
check_fftw_libs = [l for l in check_fftw_libs if l not in [interface_lib, cluster_interface_lib]]
93104
if all([fftw_lib_exists(lib) for lib in check_fftw_libs]):
94105
self.FFT_LIB = fftw_libs
95106
else:

easybuild/toolchains/iimkl.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
##
2+
# Copyright 2012-2016 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+
# 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 iimkl compiler toolchain (includes Intel compilers (icc, ifort),
27+
Intel Math Kernel Library (MKL), and Intel FFTW wrappers.
28+
29+
:author: Stijn De Weirdt (Ghent University)
30+
:author: Kenneth Hoste (Ghent University)
31+
:author: Bart Oldeman (McGill University, Calcul Quebec, Compute Canada)
32+
"""
33+
34+
from easybuild.toolchains.iccifort import IccIfort
35+
from easybuild.toolchains.fft.intelfftw import IntelFFTW
36+
from easybuild.toolchains.linalg.intelmkl import IntelMKL
37+
38+
39+
class Iimkl(IccIfort, IntelMKL, IntelFFTW):
40+
"""
41+
Compiler toolchain with Intel compilers (icc/ifort),
42+
Intel Math Kernel Library (MKL) and Intel FFTW wrappers.
43+
"""
44+
NAME = 'iimkl'
45+
SUBTOOLCHAIN = IccIfort.NAME

easybuild/tools/toolchain/linalg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ def set_variables(self):
9090
## TODO is link order fully preserved with this order ?
9191
self._set_blas_variables()
9292
self._set_lapack_variables()
93-
self._set_blacs_variables()
94-
self._set_scalapack_variables()
93+
if getattr(self, 'MPI_MODULE_NAME', None):
94+
self._set_blacs_variables()
95+
self._set_scalapack_variables()
9596

9697
self.log.debug('set_variables: LinAlg variables %s' % self.variables)
9798

0 commit comments

Comments
 (0)