From 46433b9eb33bf5ec6bf6dec59c5f43481ef0d507 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 26 Oct 2016 18:12:26 +0200 Subject: require fortran for MPI providers to avoid delayed compiler errors (#1937) * openmpi: require fortran for now * mpich: requre fortran for now * mvapich2: require fortran for now * openmpi: flake8 fixes --- var/spack/repos/builtin/packages/mpich/package.py | 7 ++++++ .../repos/builtin/packages/mvapich2/package.py | 7 ++++++ .../repos/builtin/packages/openmpi/package.py | 25 ++++++---------------- 3 files changed, 21 insertions(+), 18 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py index 940a44a1b4..e4ff29c00a 100644 --- a/var/spack/repos/builtin/packages/mpich/package.py +++ b/var/spack/repos/builtin/packages/mpich/package.py @@ -82,6 +82,13 @@ class Mpich(Package): ] def install(self, spec, prefix): + # Until we can pass variants such as +fortran through virtual + # dependencies depends_on('mpi'), require Fortran compiler to + # avoid delayed build errors in dependents. + if (self.compiler.f77 is None) or (self.compiler.fc is None): + raise InstallError('Mpich requires both C and Fortran ', + 'compilers!') + config_args = [ '--prefix={0}'.format(prefix), '--enable-shared', diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py index 06678bf08b..18f2ebe0bb 100644 --- a/var/spack/repos/builtin/packages/mvapich2/package.py +++ b/var/spack/repos/builtin/packages/mvapich2/package.py @@ -232,6 +232,13 @@ class Mvapich2(Package): ] def install(self, spec, prefix): + # Until we can pass variants such as +fortran through virtual + # dependencies depends_on('mpi'), require Fortran compiler to + # avoid delayed build errors in dependents. + if (self.compiler.f77 is None) or (self.compiler.fc is None): + raise InstallError('Mvapich2 requires both C and Fortran ', + 'compilers!') + # we'll set different configure flags depending on our # environment configure_args = [ diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index bb356aaccc..72b9b8dbd2 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -23,9 +23,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import os - -import llnl.util.tty as tty - from spack import * @@ -135,21 +132,6 @@ class Openmpi(Package): join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix)) ] - def setup_environment(self, spack_env, run_env): - # As of 06/2016 there is no mechanism to specify that packages which - # depends on MPI need C or/and Fortran implementation. For now - # require both. - if (self.compiler.f77 is None) or (self.compiler.fc is None): - tty.warn('OpenMPI : FORTRAN compiler not found') - tty.warn('OpenMPI : FORTRAN bindings will be disabled') - spack_env.unset('FC') - spack_env.unset('F77') - # Setting an attribute here and using it in the 'install' - # method is needed to ensure tty.warn is actually displayed - # to user and not redirected to spack-build.out - self.config_extra = ['--enable-mpi-fortran=none', - '--disable-oshmem-fortran'] - @property def verbs(self): # Up through version 1.6, this option was previously named @@ -161,6 +143,13 @@ class Openmpi(Package): return 'verbs' def install(self, spec, prefix): + # Until we can pass variants such as +fortran through virtual + # dependencies depends_on('mpi'), require Fortran compiler to + # avoid delayed build errors in dependents. + if (self.compiler.f77 is None) or (self.compiler.fc is None): + raise InstallError('OpenMPI requires both C and Fortran ', + 'compilers!') + config_args = ["--prefix=%s" % prefix, "--with-hwloc=%s" % spec['hwloc'].prefix, "--enable-shared", -- cgit v1.2.3-60-g2f50