Merge remote-tracking branch 'upstream/develop' into pkg-numdiff

This commit is contained in:
Kelly (KT) Thompson 2016-03-22 08:32:56 -06:00
commit 6e0e6d2654
17 changed files with 259 additions and 72 deletions

View file

@ -225,7 +225,7 @@ def set_module_variables_for_package(pkg, module):
m.spack_cc = join_path(link_dir, pkg.compiler.link_paths['cc'])
m.spack_cxx = join_path(link_dir, pkg.compiler.link_paths['cxx'])
m.spack_f77 = join_path(link_dir, pkg.compiler.link_paths['f77'])
m.spack_f90 = join_path(link_dir, pkg.compiler.link_paths['fc'])
m.spack_fc = join_path(link_dir, pkg.compiler.link_paths['fc'])
# Emulate some shell commands for convenience
m.pwd = os.getcwd
@ -270,32 +270,56 @@ def parent_class_modules(cls):
return result
def setup_module_variables_for_dag(pkg):
"""Set module-scope variables for all packages in the DAG."""
for spec in pkg.spec.traverse(order='post'):
# If a user makes their own package repo, e.g.
# spack.repos.mystuff.libelf.Libelf, and they inherit from
# an existing class like spack.repos.original.libelf.Libelf,
# then set the module variables for both classes so the
# parent class can still use them if it gets called.
spkg = spec.package
modules = parent_class_modules(spkg.__class__)
for mod in modules:
set_module_variables_for_package(spkg, mod)
set_module_variables_for_package(spkg, spkg.module)
def setup_package(pkg):
"""Execute all environment setup routines."""
spack_env = EnvironmentModifications()
run_env = EnvironmentModifications()
# Before proceeding, ensure that specs and packages are consistent
#
# This is a confusing behavior due to how packages are
# constructed. `setup_dependent_package` may set attributes on
# specs in the DAG for use by other packages' install
# method. However, spec.package will look up a package via
# spack.repo, which defensively copies specs into packages. This
# code ensures that all packages in the DAG have pieces of the
# same spec object at build time.
#
# This is safe for the build process, b/c the build process is a
# throwaway environment, but it is kind of dirty.
#
# TODO: Think about how to avoid this fix and do something cleaner.
for s in pkg.spec.traverse(): s.package.spec = s
set_compiler_environment_variables(pkg, spack_env)
set_build_environment_variables(pkg, spack_env)
# If a user makes their own package repo, e.g.
# spack.repos.mystuff.libelf.Libelf, and they inherit from
# an existing class like spack.repos.original.libelf.Libelf,
# then set the module variables for both classes so the
# parent class can still use them if it gets called.
modules = parent_class_modules(pkg.__class__)
for mod in modules:
set_module_variables_for_package(pkg, mod)
setup_module_variables_for_dag(pkg)
# Allow dependencies to modify the module
for dependency_spec in pkg.spec.traverse(root=False):
spec = pkg.spec
for dependency_spec in spec.traverse(root=False):
dpkg = dependency_spec.package
dpkg.setup_dependent_python_module(pkg.module, pkg.spec)
dpkg.setup_dependent_package(pkg.module, spec)
# Allow dependencies to set up environment as well
for dependency_spec in pkg.spec.traverse(root=False):
for dependency_spec in spec.traverse(root=False):
dpkg = dependency_spec.package
dpkg.setup_dependent_environment(spack_env, run_env, pkg.spec)
dpkg.setup_dependent_environment(spack_env, run_env, spec)
# Allow the package to apply some settings.
pkg.setup_environment(spack_env, run_env)

View file

@ -1075,7 +1075,7 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
self.setup_environment(spack_env, run_env)
def setup_dependent_python_module(self, module, dependent_spec):
def setup_dependent_package(self, module, dependent_spec):
"""Set up Python module-scope variables for dependent packages.
Called before the install() method of dependents.

View file

@ -35,6 +35,10 @@ class ArpackNg(Package):
variant('shared', default=True, description='Enables the build of shared libraries')
variant('mpi', default=False, description='Activates MPI support')
# The function pdlamch10 does not set the return variable. This is fixed upstream
# see https://github.com/opencollab/arpack-ng/issues/34
patch('pdlamch10.patch', when='@3.3:')
depends_on('blas')
depends_on('lapack')
depends_on('mpi', when='+mpi')

View file

@ -0,0 +1,15 @@
diff --git a/PARPACK/SRC/MPI/pdlamch10.f b/PARPACK/SRC/MPI/pdlamch10.f
index 6571da9..2882c2e 100644
--- a/PARPACK/SRC/MPI/pdlamch10.f
+++ b/PARPACK/SRC/MPI/pdlamch10.f
@@ -86,8 +86,8 @@
TEMP = TEMP1
END IF
*
- PDLAMCH = TEMP
+ PDLAMCH10 = TEMP
*
-* End of PDLAMCH
+* End of PDLAMCH10
*
END

View file

@ -48,7 +48,7 @@ class Eigen(Package):
depends_on('metis', when='+metis')
depends_on('scotch', when='+scotch')
depends_on('fftw', when='+fftw')
depends_on('SuiteSparse', when='+suitesparse')
depends_on('suite-sparse', when='+suitesparse')
depends_on('mpfr@2.3.0:') # Eigen 3.2.7 requires at least 2.3.0
depends_on('gmp')

View file

@ -52,7 +52,7 @@ class Llvm(Package):
depends_on('cmake @2.8.12.2:')
# Universal dependency
depends_on('python@2.7:')
depends_on('python@2.7:2.8') # Seems not to support python 3.X.Y
# lldb dependencies
depends_on('ncurses', when='+lldb')
@ -132,6 +132,21 @@ class Llvm(Package):
'llvm-libunwind' : 'http://llvm.org/svn/llvm-project/libunwind/trunk',
}
},
{
'version' : '3.8.0',
'md5':'07a7a74f3c6bd65de4702bf941b511a0',
'resources' : {
'compiler-rt' : 'd6fcbe14352ffb708e4d1ac2e48bb025',
'openmp' : '8fd7cc35d48051613cf1e750e9f22e40',
'polly' : '1b3b20f52d34a4024e21a4ea7112caa7',
'libcxx' : 'd6e0bdbbee39f7907ad74fd56d03b88a',
'libcxxabi' : 'bbe6b4d72c7c5978550d370af529bcf7',
'clang' : 'cc99e7019bb74e6459e80863606250c5',
'clang-tools-extra' : 'c2344f50e0eea0b402f0092a80ddc036',
'lldb' : 'a5da35ed9cc8c8817ee854e3dbfba00e',
'llvm-libunwind' : '162ade468607f153cca12be90b5194fa',
}
},
{
'version' : '3.7.1',
'md5':'bf8b3a2c79e61212c5409041dfdbd319',

View file

@ -54,7 +54,7 @@ def setup_dependent_environment(self, env, dependent_spec):
env.set('MPICH_F90', spack_f90)
env.set('MPICH_FC', spack_fc)
def setup_dependent_python_module(self, module, spec, dep_spec):
def setup_dependent_package(self, module, dep_spec):
"""For dependencies, make mpicc's use spack wrapper."""
# FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
module.mpicc = join_path(self.prefix.bin, 'mpicc')

View file

@ -20,10 +20,10 @@ class Mumps(Package):
variant('complex', default=True, description='Activate the compilation of cmumps and/or zmumps')
variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
depends_on('scotch + esmumps', when='~ptscotch+scotch')
depends_on('scotch + esmumps + mpi', when='+ptscotch')
depends_on('metis', when='~parmetis+metis')
depends_on('metis', when='+metis')
depends_on('parmetis', when="+parmetis")
depends_on('blas')
depends_on('lapack')
@ -38,11 +38,11 @@ class Mumps(Package):
def write_makefile_inc(self):
if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
makefile_conf = ["LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib]
orderings = ['-Dpord']
if '+ptscotch' in self.spec or '+scotch' in self.spec:
join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
makefile_conf.extend(
@ -54,15 +54,19 @@ def write_makefile_inc(self):
if '+ptscotch' in self.spec:
orderings.append('-Dptscotch')
if '+parmetis' in self.spec or '+metis' in self.spec:
if '+parmetis' in self.spec and '+metis' in self.spec:
libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
makefile_conf.extend(
["IMETIS = -I%s" % self.spec[libname].prefix.include,
"LMETIS = -L%s -l%s" % (self.spec[libname].prefix.lib, libname)])
["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
"LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
orderings.append('-Dparmetis')
elif '+metis' in self.spec:
makefile_conf.extend(
["IMETIS = -I%s" % self.spec['metis'].prefix.include,
"LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
orderings.append('-Dmetis')
if '+parmetis' in self.spec:
orderings.append('-Dparmetis')
makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
@ -101,12 +105,12 @@ def write_makefile_inc(self):
# compiler possible values are -DAdd_, -DAdd__ and/or -DUPPER
makefile_conf.append("CDEFS = -DAdd_")
makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
'Makefile.inc')
with open(makefile_inc_template, "r") as fh:
makefile_conf.extend(fh.read().split('\n'))
with working_dir('.'):
with open("Makefile.inc", "w") as fh:
makefile_inc = '\n'.join(makefile_conf)
@ -130,7 +134,7 @@ def install(self, spec, prefix):
make_libs.append('zexamples')
self.write_makefile_inc()
make(*make_libs)
install_tree('lib', prefix.lib)

View file

@ -20,13 +20,13 @@ class NetlibLapack(Package):
version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
variant('shared', default=False, description="Build shared library version")
variant('fpic', default=False, description="Build with -fpic compiler option")
# virtual dependency
provides('lapack')
# blas is a virtual dependency.
depends_on('blas')
depends_on('cmake')
# Doesn't always build correctly in parallel
@ -37,24 +37,23 @@ def get_blas_libs(self):
blas = self.spec['netlib-blas']
return [join_path(blas.prefix.lib, 'blas.a')]
@when('^atlas')
def get_blas_libs(self):
blas = self.spec['atlas']
return [join_path(blas.prefix.lib, l)
for l in ('libf77blas.a', 'libatlas.a')]
def install(self, spec, prefix):
blas_libs = ";".join(self.get_blas_libs())
cmake_args = [".", '-DBLAS_LIBRARIES=' + blas_libs]
if '+shared' in spec:
cmake_args.append('-DBUILD_SHARED_LIBS=ON')
if '+fpic' in spec:
cmake_args.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')
cmake_args += std_cmake_args
cmake(*cmake_args)
make()
make("install")

View file

@ -1,4 +1,5 @@
from spack import *
import sys
class NetlibScalapack(Package):
"""ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
@ -11,16 +12,16 @@ class NetlibScalapack(Package):
version('2.0.0', '9e76ae7b291be27faaad47cfc256cbfe')
# versions before 2.0.0 are not using cmake and requires blacs as
# a separated package
variant('shared', default=True, description='Build the shared library version')
variant('fpic', default=False, description="Build with -fpic compiler option")
provides('scalapack')
depends_on('mpi')
depends_on('lapack')
def install(self, spec, prefix):
def install(self, spec, prefix):
options = [
"-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'),
"-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else 'ON'),
@ -40,10 +41,11 @@ def install(self, spec, prefix):
make()
make("install")
def setup_dependent_python_module(self, module, spec, dependent_spec):
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
lib_suffix = lib_dsuffix if '+shared' in spec['scalapack'] else '.a'
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
spec['scalapack'].fc_link = '-L%s -lscalapack' % spec['scalapack'].prefix.lib
spec['scalapack'].cc_link = spec['scalapack'].fc_link
spec['scalapack'].libraries = [join_path(spec['scalapack'].prefix.lib, 'libscalapack%s' % lib_suffix)]
spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
spec.cc_link = spec.fc_link
spec.libraries = [join_path(spec.prefix.lib, 'libscalapack%s' % lib_suffix)]

View file

@ -62,7 +62,7 @@ class Octave(Package):
depends_on('qrupdate', when='+qrupdate')
#depends_on('qscintilla', when='+qscintilla) # TODO: add package
depends_on('qt', when='+qt')
depends_on('SuiteSparse', when='+suitesparse')
depends_on('suite-sparse',when='+suitesparse')
depends_on('zlib', when='+zlib')

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca945dd..1bf94e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,7 +33,7 @@ include_directories(${GKLIB_PATH})
include_directories(${METIS_PATH}/include)
# List of directories that cmake will look for CMakeLists.txt
-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
+#add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
add_subdirectory(include)
add_subdirectory(libparmetis)
add_subdirectory(programs)

View file

@ -25,9 +25,6 @@
from spack import *
# FIXME : lot of code is duplicated from packages/metis/package.py . Inheriting from there may reduce
# FIXME : the installation rules to just a few lines
class Parmetis(Package):
"""
@ -43,13 +40,17 @@ class Parmetis(Package):
variant('debug', default=False, description='Builds the library in debug mode')
variant('gdb', default=False, description='Enables gdb support')
variant('idx64', default=False, description='Use int64_t as default index type')
variant('double', default=False, description='Use double precision floating point types')
depends_on('cmake @2.8:') # build dependency
depends_on('mpi')
# FIXME : this should conflict with metis as it builds its own version internally
patch('enable_external_metis.patch')
depends_on('metis')
# bug fixes from PETSc developers
# https://bitbucket.org/petsc/pkg-parmetis/commits/1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b/raw/
patch('pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch')
# https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/
patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch')
depends_on('gdb', when='+gdb')
@ -63,8 +64,8 @@ def install(self, spec, prefix):
# FIXME : Once a contract is defined, MPI compilers should be retrieved indirectly via spec['mpi'] in case
# FIXME : they use a non-standard name
options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source),
'-DMETIS_PATH:PATH={metis_source}'.format(metis_source=metis_source),
options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source), # still need headers from METIS source, and they are not installed with METIS. shame...
'-DMETIS_PATH:PATH={metis_source}'.format(metis_source=spec['metis'].prefix),
'-DCMAKE_C_COMPILER:STRING=mpicc',
'-DCMAKE_CXX_COMPILER:STRING=mpicxx'])
@ -78,18 +79,7 @@ def install(self, spec, prefix):
if '+gdb' in spec:
options.append('-DGDB:BOOL=ON')
metis_header = join_path(metis_source, 'include', 'metis.h')
if '+idx64' in spec:
filter_file('IDXTYPEWIDTH 32', 'IDXTYPEWIDTH 64', metis_header)
if '+double' in spec:
filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header)
with working_dir(build_directory, create=True):
cmake(source_directory, *options)
make()
make("install")
# Parmetis build system doesn't allow for an external metis to be used, but doesn't copy the required
# metis header either
install(metis_header, self.prefix.include)

View file

@ -0,0 +1,77 @@
From 1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b Mon Sep 17 00:00:00 2001
From: Jed Brown <jed@59A2.org>
Date: Fri, 12 Oct 2012 15:45:10 -0500
Subject: [PATCH] ParMetis bug fixes reported by John Fettig [petsc-maint
#133631]
'''
I have also reported to to Karypis but have received zero
response and he hasn't released any updates to the original release
either. At least he approved my forum posting so that other people
can see the bug and the fix.
http://glaros.dtc.umn.edu/gkhome/node/837
'''
Hg-commit: 1c2b9fe39201d404b493885093b5992028b9b8d4
---
libparmetis/xyzpart.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
index 3a2c289..63abfcb 100644
--- a/libparmetis/xyzpart.c
+++ b/libparmetis/xyzpart.c
@@ -104,7 +104,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
for (i=0; i<nbins; i++)
emarkers[i] = gmin + (gmax-gmin)*i/nbins;
- emarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
+ emarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
/* get into a iterative backet boundary refinement */
for (l=0; l<5; l++) {
@@ -152,7 +152,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
}
}
nemarkers[0] = gmin;
- nemarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
+ nemarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
rcopy(nbins+1, nemarkers, emarkers);
}
@@ -218,7 +218,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
emarkers[0] = gmin;
emarkers[1] = gsum/gnvtxs;
- emarkers[2] = gmax*(1.0+2.0*REAL_EPSILON);
+ emarkers[2] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
cnbins = 2;
/* get into a iterative backet boundary refinement */
@@ -227,7 +227,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
iset(cnbins, 0, lcounts);
rset(cnbins, 0, lsums);
for (j=0, i=0; i<nvtxs;) {
- if (cand[i].key < emarkers[j+1]) {
+ if (cand[i].key <= emarkers[j+1]) {
lcounts[j]++;
lsums[j] += cand[i].key;
i++;
@@ -272,12 +272,12 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
rsorti(cnbins, nemarkers);
rcopy(cnbins, nemarkers, emarkers);
- emarkers[cnbins] = gmax*(1.0+2.0*REAL_EPSILON);
+ emarkers[cnbins] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
}
/* assign the coordinate to the appropriate bin */
for (j=0, i=0; i<nvtxs;) {
- if (cand[i].key < emarkers[j+1]) {
+ if (cand[i].key <= emarkers[j+1]) {
bxyz[cand[i].val*ndims+k] = j;
i++;
}
--
2.1.1.1.g1fb337f

View file

@ -0,0 +1,35 @@
From 82409d68aa1d6cbc70740d0f35024aae17f7d5cb Mon Sep 17 00:00:00 2001
From: Sean Farley <sean@mcs.anl.gov>
Date: Tue, 20 Mar 2012 11:59:44 -0500
Subject: [PATCH] parmetis: fix bug reported by jfettig; '<' to '<=' in xyzpart
Hg-commit: 2dd2eae596acaabbc80e0ef875182616f868dbc2
---
libparmetis/xyzpart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
index 307aed9..3a2c289 100644
--- a/libparmetis/xyzpart.c
+++ b/libparmetis/xyzpart.c
@@ -111,7 +111,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
/* determine bucket counts */
iset(nbins, 0, lcounts);
for (j=0, i=0; i<nvtxs;) {
- if (cand[i].key < emarkers[j+1]) {
+ if (cand[i].key <= emarkers[j+1]) {
lcounts[j]++;
i++;
}
@@ -158,7 +158,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
/* assign the coordinate to the appropriate bin */
for (j=0, i=0; i<nvtxs;) {
- if (cand[i].key < emarkers[j+1]) {
+ if (cand[i].key <= emarkers[j+1]) {
bxyz[cand[i].val*ndims+k] = j;
i++;
}
--
2.1.1.1.g1fb337f

View file

@ -61,14 +61,24 @@ def mpi_dependent_options(self):
errors = ['incompatible variants given'] + errors
raise RuntimeError('\n'.join(errors))
else:
compiler_opts = [
'--with-mpi=1',
'--with-mpi-dir=%s' % self.spec['mpi'].prefix,
]
if self.compiler.name == "clang":
compiler_opts = [
'--with-mpi=1',
'--with-cc=%s -Qunused-arguments' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # Avoid confusing PETSc config by clang: warning: argument unused during compilation
'--with-cxx=%s -Qunused-arguments' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
'--with-fc=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
'--with-f77=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif77'),
]
else:
compiler_opts = [
'--with-mpi=1',
'--with-mpi-dir=%s' % self.spec['mpi'].prefix,
]
return compiler_opts
def install(self, spec, prefix):
options = []
options = ['--with-debugging=0',
'--with-ssl=0']
options.extend(self.mpi_dependent_options())
options.extend([
'--with-precision=%s' % ('double' if '+double' in spec else 'single'),

View file

@ -1,7 +1,7 @@
from spack import *
class Suitesparse(Package):
class SuiteSparse(Package):
"""
SuiteSparse is a suite of sparse matrix algorithms
"""
@ -24,4 +24,3 @@ def install(self, spec, prefix):
# FIXME : this actually uses the current workaround
# FIXME : (blas / lapack always provide libblas and liblapack as aliases)
make('install', 'INSTALL=%s' % prefix, 'BLAS=-lblas', 'LAPACK=-llapack')