Merge pull request #893 from davydden/mpi_dependent_env
Introduce variables for MPI compiler wrappers and document their usage
This commit is contained in:
commit
10b0cb108c
@ -1831,6 +1831,23 @@ successfully find ``libdwarf.h`` and ``libdwarf.so``, without the
|
|||||||
packager having to provide ``--with-libdwarf=/path/to/libdwarf`` on
|
packager having to provide ``--with-libdwarf=/path/to/libdwarf`` on
|
||||||
the command line.
|
the command line.
|
||||||
|
|
||||||
|
Message Parsing Interface (MPI)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
It is common for high performance computing software/packages to use ``MPI``.
|
||||||
|
As a result of conretization, a given package can be built using different
|
||||||
|
implementations of MPI such as ``Openmpi``, ``MPICH`` or ``IntelMPI``.
|
||||||
|
In some scenarios to configure a package one have to provide it with appropriate MPI
|
||||||
|
compiler wrappers such as ``mpicc``, ``mpic++``.
|
||||||
|
However different implementations of ``MPI`` may have different names for those
|
||||||
|
wrappers. In order to make package's ``install()`` method indifferent to the
|
||||||
|
choice ``MPI`` implementation, each package which implements ``MPI`` sets up
|
||||||
|
``self.spec.mpicc``, ``self.spec.mpicxx``, ``self.spec.mpifc`` and ``self.spec.mpif77``
|
||||||
|
to point to ``C``, ``C++``, ``Fortran 90`` and ``Fortran 77`` ``MPI`` wrappers.
|
||||||
|
Package developers are advised to use these variables, for example ``self.spec['mpi'].mpicc``
|
||||||
|
instead of hard-coding ``join_path(self.spec['mpi'].prefix.bin, 'mpicc')`` for
|
||||||
|
the reasons outlined above.
|
||||||
|
|
||||||
|
|
||||||
Forking ``install()``
|
Forking ``install()``
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -55,9 +55,10 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
|||||||
spack_env.set('MPICH_FC', spack_fc)
|
spack_env.set('MPICH_FC', spack_fc)
|
||||||
|
|
||||||
def setup_dependent_package(self, module, dep_spec):
|
def setup_dependent_package(self, module, dep_spec):
|
||||||
"""For dependencies, make mpicc's use spack wrapper."""
|
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||||
# FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
|
self.spec.mpicxx = join_path(self.prefix.bin, 'mpic++')
|
||||||
module.mpicc = join_path(self.prefix.bin, 'mpicc')
|
self.spec.mpifc = join_path(self.prefix.bin, 'mpif90')
|
||||||
|
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
config_args = ["--prefix=" + prefix,
|
config_args = ["--prefix=" + prefix,
|
||||||
|
@ -147,6 +147,12 @@ def setup_dependent_environment(self, spack_env, run_env, extension_spec):
|
|||||||
spack_env.set('MPICH_F90', spack_fc)
|
spack_env.set('MPICH_F90', spack_fc)
|
||||||
spack_env.set('MPICH_FC', spack_fc)
|
spack_env.set('MPICH_FC', spack_fc)
|
||||||
|
|
||||||
|
def setup_dependent_package(self, module, dep_spec):
|
||||||
|
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||||
|
self.spec.mpicxx = join_path(self.prefix.bin, 'mpicxx')
|
||||||
|
self.spec.mpifc = join_path(self.prefix.bin, 'mpif90')
|
||||||
|
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
# we'll set different configure flags depending on our environment
|
# we'll set different configure flags depending on our environment
|
||||||
configure_args = [
|
configure_args = [
|
||||||
|
@ -47,6 +47,12 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
|||||||
spack_env.set('OMPI_FC', spack_fc)
|
spack_env.set('OMPI_FC', spack_fc)
|
||||||
spack_env.set('OMPI_F77', spack_f77)
|
spack_env.set('OMPI_F77', spack_f77)
|
||||||
|
|
||||||
|
def setup_dependent_package(self, module, dep_spec):
|
||||||
|
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||||
|
self.spec.mpicxx = join_path(self.prefix.bin, 'mpic++')
|
||||||
|
self.spec.mpifc = join_path(self.prefix.bin, 'mpif90')
|
||||||
|
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
|
||||||
|
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
config_args = ["--prefix=%s" % prefix,
|
config_args = ["--prefix=%s" % prefix,
|
||||||
|
@ -26,10 +26,10 @@ def install(self, spec, prefix):
|
|||||||
'--without-blas',
|
'--without-blas',
|
||||||
'CPPFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL',
|
'CPPFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL',
|
||||||
'CFLAGS=-O2',
|
'CFLAGS=-O2',
|
||||||
'CC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # TODO: use ENV variables or MPI class wrappers
|
'CC=%s' % self.spec['mpi'].mpicc,
|
||||||
'CXX=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
|
'CXX=%s' % self.spec['mpi'].mpicxx,
|
||||||
'FC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
|
'FC=%s' % self.spec['mpi'].mpifc,
|
||||||
'F77=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif77'),
|
'F77=%s' % self.spec['mpi'].mpif77
|
||||||
]
|
]
|
||||||
|
|
||||||
configure('--prefix=%s' % prefix, *options)
|
configure('--prefix=%s' % prefix, *options)
|
||||||
|
Loading…
Reference in New Issue
Block a user