2014-01-08 17:21:02 +08:00
|
|
|
##############################################################################
|
2016-05-12 12:22:25 +08:00
|
|
|
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
|
2014-01-08 17:21:02 +08:00
|
|
|
# Produced at the Lawrence Livermore National Laboratory.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# This file is part of Spack.
|
2016-05-12 12:22:25 +08:00
|
|
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
2014-01-08 17:21:02 +08:00
|
|
|
# LLNL-CODE-647188
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2015-12-09 17:24:15 +08:00
|
|
|
# For details, see https://github.com/llnl/spack
|
2014-01-08 17:21:02 +08:00
|
|
|
# Please also see the LICENSE file for our notice and the LGPL.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2016-05-12 12:22:25 +08:00
|
|
|
# it under the terms of the GNU Lesser General Public License (as
|
|
|
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2014-01-08 17:21:02 +08:00
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
|
2016-05-12 12:22:25 +08:00
|
|
|
# conditions of the GNU Lesser General Public License for more details.
|
2014-01-13 01:19:18 +08:00
|
|
|
#
|
2016-05-12 12:22:25 +08:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2014-01-08 17:21:02 +08:00
|
|
|
##############################################################################
|
2013-10-15 18:04:25 +08:00
|
|
|
from spack import *
|
2016-10-15 03:00:43 +08:00
|
|
|
import os
|
2013-10-15 18:04:25 +08:00
|
|
|
|
2016-03-16 22:19:13 +08:00
|
|
|
|
2013-10-15 18:04:25 +08:00
|
|
|
class Mpich(Package):
|
2013-12-12 17:04:32 +08:00
|
|
|
"""MPICH is a high performance and widely portable implementation of
|
2016-10-11 17:16:01 +08:00
|
|
|
the Message Passing Interface (MPI) standard."""
|
|
|
|
|
2013-10-15 18:04:25 +08:00
|
|
|
homepage = "http://www.mpich.org"
|
2016-10-11 17:16:01 +08:00
|
|
|
url = "http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz"
|
2016-06-15 19:29:30 +08:00
|
|
|
list_url = "http://www.mpich.org/static/downloads/"
|
2013-12-09 11:26:29 +08:00
|
|
|
list_depth = 2
|
|
|
|
|
2016-01-14 01:44:51 +08:00
|
|
|
version('3.2', 'f414cfa77099cd1fa1a5ae4e22db508a')
|
2015-09-25 16:44:47 +08:00
|
|
|
version('3.1.4', '2ab544607986486562e076b83937bba2')
|
|
|
|
version('3.1.3', '93cb17f91ac758cbf9174ecb03563778')
|
|
|
|
version('3.1.2', '7fbf4b81dcb74b07ae85939d1ceee7f1')
|
|
|
|
version('3.1.1', '40dc408b1e03cc36d80209baaa2d32b7')
|
2016-01-14 01:44:51 +08:00
|
|
|
version('3.1', '5643dd176499bfb7d25079aaff25f2ec')
|
2014-07-31 14:30:07 +08:00
|
|
|
version('3.0.4', '9c5d5d4fe1e17dd12153f40bc5b6dbc0')
|
2013-12-12 17:04:32 +08:00
|
|
|
|
2016-10-11 17:16:01 +08:00
|
|
|
variant('hydra', default=True, description='Build the hydra process manager')
|
|
|
|
variant('pmi', default=True, description='Build with PMI support')
|
|
|
|
variant('romio', default=True, description='Enable ROMIO MPI I/O implementation')
|
|
|
|
variant('verbs', default=False, description='Build support for OpenFabrics verbs.')
|
2016-01-19 06:03:41 +08:00
|
|
|
|
2015-10-17 19:06:06 +08:00
|
|
|
provides('mpi@:3.0', when='@3:')
|
|
|
|
provides('mpi@:1.3', when='@1:')
|
2013-12-12 17:04:32 +08:00
|
|
|
|
2016-04-07 05:51:47 +08:00
|
|
|
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
2016-06-23 23:08:40 +08:00
|
|
|
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
|
|
|
|
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpic++'))
|
|
|
|
spack_env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
|
|
|
|
spack_env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
|
|
|
|
|
2016-04-07 05:51:47 +08:00
|
|
|
spack_env.set('MPICH_CC', spack_cc)
|
|
|
|
spack_env.set('MPICH_CXX', spack_cxx)
|
|
|
|
spack_env.set('MPICH_F77', spack_f77)
|
|
|
|
spack_env.set('MPICH_F90', spack_fc)
|
|
|
|
spack_env.set('MPICH_FC', spack_fc)
|
2016-03-16 22:19:13 +08:00
|
|
|
|
2016-05-05 16:24:32 +08:00
|
|
|
def setup_dependent_package(self, module, dep_spec):
|
2016-10-11 08:57:35 +08:00
|
|
|
# Is this a Cray machine? (TODO: We need a better test than this.)
|
|
|
|
if os.environ.get('CRAYPE_VERSION'):
|
|
|
|
self.spec.mpicc = spack_cc
|
|
|
|
self.spec.mpicxx = spack_cxx
|
|
|
|
self.spec.mpifc = spack_fc
|
|
|
|
self.spec.mpif77 = spack_f77
|
|
|
|
else:
|
|
|
|
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')
|
|
|
|
|
2016-09-03 23:13:47 +08:00
|
|
|
self.spec.mpicxx_shared_libs = [
|
|
|
|
join_path(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)),
|
|
|
|
join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
|
|
|
|
]
|
2016-05-04 16:37:52 +08:00
|
|
|
|
2013-12-26 09:19:51 +08:00
|
|
|
def install(self, spec, prefix):
|
2016-10-11 17:16:01 +08:00
|
|
|
config_args = [
|
|
|
|
'--prefix={0}'.format(prefix),
|
|
|
|
'--enable-shared',
|
|
|
|
'--with-pm={0}'.format('hydra' if '+hydra' in spec else 'no'),
|
|
|
|
'--with-pmi={0}'.format('yes' if '+pmi' in spec else 'no'),
|
|
|
|
'--{0}-romio'.format('enable' if '+romio' in spec else 'disable'),
|
|
|
|
'--{0}-ibverbs'.format('with' if '+verbs' in spec else 'without')
|
|
|
|
]
|
2016-01-19 06:03:41 +08:00
|
|
|
|
2014-09-24 05:59:30 +08:00
|
|
|
# TODO: Spack should make it so that you can't actually find
|
|
|
|
# these compilers if they're "disabled" for the current
|
|
|
|
# compiler configuration.
|
|
|
|
if not self.compiler.f77:
|
|
|
|
config_args.append("--disable-f77")
|
|
|
|
|
|
|
|
if not self.compiler.fc:
|
|
|
|
config_args.append("--disable-fc")
|
|
|
|
|
2016-03-31 05:19:29 +08:00
|
|
|
if not self.compiler.fc and not self.compiler.f77:
|
|
|
|
config_args.append("--disable-fortran")
|
|
|
|
|
2014-09-24 05:59:30 +08:00
|
|
|
configure(*config_args)
|
2016-10-11 17:16:01 +08:00
|
|
|
|
2013-10-15 18:04:25 +08:00
|
|
|
make()
|
2016-10-11 17:16:01 +08:00
|
|
|
make('check')
|
|
|
|
make('install')
|
2014-09-28 11:47:38 +08:00
|
|
|
|
2016-10-11 17:16:01 +08:00
|
|
|
self.filter_compilers(prefix)
|
2014-09-28 11:47:38 +08:00
|
|
|
|
2016-10-11 17:16:01 +08:00
|
|
|
def filter_compilers(self, prefix):
|
2014-09-28 11:47:38 +08:00
|
|
|
"""Run after install to make the MPI compilers use the
|
2016-10-11 17:16:01 +08:00
|
|
|
compilers that Spack built the package with.
|
|
|
|
|
|
|
|
If this isn't done, they'll have CC, CXX, F77, and FC set
|
|
|
|
to Spack's generic cc, c++, f77, and f90. We want them to
|
|
|
|
be bound to whatever compiler they were built with."""
|
|
|
|
|
|
|
|
mpicc = join_path(prefix.bin, 'mpicc')
|
|
|
|
mpicxx = join_path(prefix.bin, 'mpicxx')
|
|
|
|
mpif77 = join_path(prefix.bin, 'mpif77')
|
|
|
|
mpif90 = join_path(prefix.bin, 'mpif90')
|
2016-06-15 19:16:29 +08:00
|
|
|
|
|
|
|
# Substitute Spack compile wrappers for the real
|
|
|
|
# underlying compiler
|
2016-06-15 19:29:30 +08:00
|
|
|
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
|
2016-10-11 17:16:01 +08:00
|
|
|
filter_file(env['CC'], self.compiler.cc, mpicc, **kwargs)
|
2016-06-16 03:37:12 +08:00
|
|
|
filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs)
|
|
|
|
filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs)
|
2016-10-11 17:16:01 +08:00
|
|
|
filter_file(env['FC'], self.compiler.fc, mpif90, **kwargs)
|
2016-06-15 19:16:29 +08:00
|
|
|
|
|
|
|
# Remove this linking flag if present
|
|
|
|
# (it turns RPATH into RUNPATH)
|
|
|
|
for wrapper in (mpicc, mpicxx, mpif77, mpif90):
|
|
|
|
filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
|