Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 51 additions & 41 deletions easybuild/easyblocks/i/imkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,38 @@ def __init__(self, *args, **kwargs):
# make sure $MKLROOT isn't set, it's known to cause problems with the installation
self.cfg.update('unwanted_env_vars', ['MKLROOT'])

# build the mkl interfaces, if desired
if self.cfg['interfaces']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartoldeman One more minor style issues: add an empty line above (and maybe also a comment explaining what's going on in the block below)

self.cdftlibs = ['fftw2x_cdft']
if LooseVersion(self.version) >= LooseVersion('10.3'):
self.cdftlibs.append('fftw3x_cdft')
self.mpi_spec = None
# check whether MPI_FAMILY constant is defined, so mpi_family() can be used
if hasattr(self.toolchain, 'MPI_FAMILY') and self.toolchain.MPI_FAMILY is not None:
mpi_spec_by_fam = {
toolchain.MPICH: 'mpich2', # MPICH is MPICH v3.x, which is MPICH2 compatible
toolchain.MPICH2: 'mpich2',
toolchain.MVAPICH2: 'mpich2',
toolchain.OPENMPI: 'openmpi',
}
mpi_fam = self.toolchain.mpi_family()
self.mpi_spec = mpi_spec_by_fam.get(mpi_fam)
debugstr = "MPI toolchain component"
else:
# can't use toolchain.mpi_family, because of dummy toolchain
if get_software_root('MPICH2') or get_software_root('MVAPICH2'):
self.mpi_spec = 'mpich2'
elif get_software_root('OpenMPI'):
self.mpi_spec = 'openmpi'
elif not get_software_root('impi'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartoldeman At this point, the modules for the dependencies are not loaded yet (that's done in prepare_step), so each of these get_software_root calls will return None...

We should initialize self.cdftlibs and self.mpi_spec in __init__, and move this whole block to prepare_step, after the super(EB_imkl, self).prepare_step call

# no compatible MPI found: do not build cdft
self.cdftlibs = []
debugstr = "loaded MPI module"
if self.mpi_spec:
self.log.debug("Determined MPI specification based on %s: %s", debugstr, self.mpi_spec)
else:
self.log.debug("No MPI or no compatible MPI found: do not build CDFT")

def prepare_step(self, *args, **kwargs):
if LooseVersion(self.version) >= LooseVersion('2017.2.174'):
kwargs['requires_runtime_license'] = False
Expand Down Expand Up @@ -218,9 +250,6 @@ def post_install_step(self):
# blas95 and lapack also need include/.mod to be processed
fftw2libs = ['fftw2xc', 'fftw2xf']
fftw3libs = ['fftw3xc', 'fftw3xf']
cdftlibs = ['fftw2x_cdft']
if LooseVersion(self.version) >= LooseVersion('10.3'):
cdftlibs.append('fftw3x_cdft')

interfacedir = os.path.join(self.installdir, intsubdir)
try:
Expand Down Expand Up @@ -257,44 +286,24 @@ def post_install_step(self):
('-Wall', ''),
('-Werror', ''),
]
for lib in cdftlibs:
for lib in self.cdftlibs:
apply_regex_substitutions(os.path.join(interfacedir, lib, 'makefile'), regex_subs)

for lib in fftw2libs + fftw3libs + cdftlibs:
for lib in fftw2libs + fftw3libs + self.cdftlibs:
buildopts = [compopt]
if lib in fftw3libs:
buildopts.append('install_to=$INSTALL_DIR')
elif lib in cdftlibs:
mpi_spec = None
# check whether MPI_FAMILY constant is defined, so mpi_family() can be used
if hasattr(self.toolchain, 'MPI_FAMILY') and self.toolchain.MPI_FAMILY is not None:
mpi_spec_by_fam = {
toolchain.MPICH: 'mpich2', # MPICH is MPICH v3.x, which is MPICH2 compatible
toolchain.MPICH2: 'mpich2',
toolchain.MVAPICH2: 'mpich2',
toolchain.OPENMPI: 'openmpi',
}
mpi_fam = self.toolchain.mpi_family()
mpi_spec = mpi_spec_by_fam.get(mpi_fam)
self.log.debug("Determined MPI specification based on MPI toolchain component: %s" % mpi_spec)
else:
# can't use toolchain.mpi_family, because of dummy toolchain
if get_software_root('MPICH2') or get_software_root('MVAPICH2'):
mpi_spec = 'mpich2'
elif get_software_root('OpenMPI'):
mpi_spec = 'openmpi'
self.log.debug("Determined MPI specification based on loaded MPI module: %s" % mpi_spec)

if mpi_spec is not None:
buildopts.append('mpi=%s' % mpi_spec)
elif lib in self.cdftlibs:
if self.mpi_spec is not None:
buildopts.append('mpi=%s' % self.mpi_spec)

precflags = ['']
if lib.startswith('fftw2x') and not self.cfg['m32']:
# build both single and double precision variants
precflags = ['PRECISION=MKL_DOUBLE', 'PRECISION=MKL_SINGLE']

intflags = ['']
if lib in cdftlibs and not self.cfg['m32']:
if lib in self.cdftlibs and not self.cfg['m32']:
# build both 32-bit and 64-bit interfaces
intflags = ['interface=lp64', 'interface=ilp64']

Expand Down Expand Up @@ -374,19 +383,20 @@ def sanity_check_step(self):
pics = ['', '_pic']
libs = ['libfftw%s%s%s.a' % (fftwver, compsuff, pic) for fftwver in fftw_vers for pic in pics]

fftw_cdft_vers = ['2x_cdft_DOUBLE']
if not self.cfg['m32']:
fftw_cdft_vers.append('2x_cdft_SINGLE')
if ver >= LooseVersion('10.3'):
fftw_cdft_vers.append('3x_cdft')
if ver >= LooseVersion('11.0.2'):
bits = ['_lp64']
if self.cdftlibs:
fftw_cdft_vers = ['2x_cdft_DOUBLE']
if not self.cfg['m32']:
bits.append('_ilp64')
else:
# no bits suffix in cdft libs before imkl v11.0.2
bits = ['']
libs += ['libfftw%s%s%s.a' % x for x in itertools.product(fftw_cdft_vers, bits, pics)]
fftw_cdft_vers.append('2x_cdft_SINGLE')
if ver >= LooseVersion('10.3'):
fftw_cdft_vers.append('3x_cdft')
if ver >= LooseVersion('11.0.2'):
bits = ['_lp64']
if not self.cfg['m32']:
bits.append('_ilp64')
else:
# no bits suffix in cdft libs before imkl v11.0.2
bits = ['']
libs += ['libfftw%s%s%s.a' % x for x in itertools.product(fftw_cdft_vers, bits, pics)]

if ver >= LooseVersion('10.3'):
if self.cfg['m32']:
Expand Down