-
Notifications
You must be signed in to change notification settings - Fork 305
Make cdft lib compilation optional for Intel MKL, by detecting MPI availability #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
c9ffe6a
7a34a18
347aa50
dae5f8a
a70eda7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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']: | ||
| 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'): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 We should initialize |
||
| # 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 | ||
|
|
@@ -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: | ||
|
|
@@ -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'] | ||
|
|
||
|
|
@@ -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']: | ||
|
|
||
There was a problem hiding this comment.
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)