spack/var/spack/repos/builtin/packages/zoltan/package.py
Aaron Fisher b62ed20f3f CEED 1.0 (#7423)
* ceed bundle package including OCCA, MAGMA, Nek5000, mfem, and PETSc

Very preliminary, a lot of ad hoc decisions, fragile, missing functionality
All packages do build on my MacOS laptop with Cuda

Funded-by: ECP
Project: CEED
Time: 4 hours
Reported-by: Tzanio Kolev <kolev1@llnl.gov>

* Some adjustments in a few CEED-related packages.

This is still very preliminary, but with these changes I'm able to build from
scratch on a Mac laptop and a Linux desktop (RHEL7).

Note that there doesn't seem to be a good way to support CUDA in Spack, so
you'll have to install that manually yourself. You will also need a Fortran
compiler, in particular on a Mac where you also have to make sure that it
is being picked up in ~/.spack/darwin/compilers.yaml.

* ceed bundle package including OCCA, MAGMA, Nek5000, mfem, and PETSc

Very preliminary, a lot of ad hoc decisions, fragile, missing functionality
All packages do build on my MacOS laptop with Cuda

Funded-by: ECP
Project: CEED
Time: 4 hours
Reported-by: Tzanio Kolev <kolev1@llnl.gov>

* Reverting Mac-related CUDA checks in the OCCA and MAGMA packages.

A much better solution is to install CUDA manually and add it to
~/.spack/darwin/packages.yaml:

packages:
    cuda:
        paths:
            cuda@8.0.54: /usr/local/cuda

* Fix flake8 warnings

Funded-by: CEED
Project: CEED/Spack

* remove unneeded commented out code

Funded-by: CEED
Project: CEED/Spack

* Don't have PETSc use MUMPS to speedup install time, try parallel installs for Magma

Funded-by: CEED
Project: CEED/Spack

* Added libceed package and made changes to get the ceed metapackage up and running.

* Get the ceed package up and running and added installing the .h file in the libceed package.

* All packages are now pointed at specific versions (either tagged or git hashed.

* Changed some of the specific versions in the CEED metapackage.

* Some version updates.

* Applied Cameron Smith's patch for the latest pumi.

* Merge

* Nek5000: Use tarball instead of git tag

* Major update of the mfem package - needs more testing. Add a testing
shell script for mfem, test_builds.sh, in the mfem directory. It builds
a number of mfem configurations to ensure they all work.

Add 'suite-sparse' variant to petsc.

Add 'develop' version of libceed.

Add 'metis' variant of laghos.

Update the dependencies of ceed.

* Changes in petsc's handling of zlib to make the latest build work on Mac.

* [MFEM] When using '+libunwind', mfem needs '-ldl'.

* [OCCA] Remove debug print statements.

* [PETSc] Replace the check ('zlib' in spec) with ('+zlib' in spec) - the
latter checks if 'zlib' variant of petsc is enabled which is incorrect;
the former checks if petsc is configured to depend on 'zlib'.

* [MFEM] Add conduit variant.

* [libCEED] Enable testing using 'make prove'.

* [MFEM] Tweak test_builds.sh - all builds pass on fedora 27.

* Add a post install test

* Add a post installation check for NekCEM

* pumi: bump git hash, remove unused patch

* Fixed testing of Laghos package

* Adding variants in CEED package

* Empty file for URL didn't work on LLNL/LC. Replacing with bundle-package.txt -> README.md.

* [MFEM] If the spec defines the 'cxxflags' compiler flags, use that value
to set the CXXFLAGS value in the mfem build system.

* Disabling HDF5 by default.

You can still build it with "spack install ceed+hdf5".

* libceed: fix use of prefix versus DESTDIR

* Added cuda variant for libCEED (off by default)

* [libCEED] When building v0.1, fix ceed.pc before installing it.

* [CEED] Add variants for OCCA and PUMI. Replace the hdf5 variant with
a variant called quickbuild that disables variants in packages to
speedup the build - currently hdf5, boost, and superlu-dist in PETSc.

* [libCEED] Remove unused 'import os'.

* [MAGMA] Add version 2.3.0.

* [OCCA] Major update of occa/package.py.

* [libCEED] Several improvements.

* [CEED] Use fixed versions for occa and libceed.

* [OCCA] Fix a bug in CUDA setup.

* NekCEM doesn't need depends_on('python')

* [OCCA,libCEED,MFEM,CEED] Update occa and libceed versions plus a few
tweaks in occa and mfem.

* Switching to gslib-1.0.2 to fix summitdev bug.

* [Nek5000] Use the Fortran 77 compiler instead of the 'fc' compiler.
Propagate any 'fflags' and 'cflags' specifications to the Nek tools.

* [MFEM] Tweak for 'ppc64le'.

* attempt to override fips compatibility error for md5

* Compiler option changes in libCEED to fix summitdev build.

* Disable the nekcem install test until it can be fixed.

* [NekCEM] Major update of the package to fix various issues.

* [NekCEM] Fix formatting

* zoltan: remove non-portable -g0 flag

the pgi compiler does not accept it

* pumi: specify dependency on cmake > 3

* [Nek5000] Add dependency on libx11 when needed. Various hacks to
support IBM XL compilers.

* [NekCEM] Link with the pthreads library - it is required.

* [MAGMA] Add a patch for magma v2.3.0 when building with gcc <= 4.8.
Add dependency on BLAS.

* [CEED] Update to magma 2.3.0. When building with gcc < 4.9 constrain
the used suite-sparse version to <= 5.1.0 - starting with v5.2.0,
suite-sparse requires gcc >= 4.9.

* Small updates

* [libceed, gslib] Fix style

* [Nek5000] Need 'libxt' as a dependency as well.

* [MUMPS] Temporary workaround for ray.

* Updating occa and libceed to laters pre-1.0.0 and pre-0.2 hashes

* petsc: add pkg-config patch for variable quoting

Variable definitions in pkg-config are processed more like make than a
shell, so don't need quoting.  Older versions of pkg-config (<= 0.28)
did not remove the quotes when printing the value.

Freedesktop #67904 (https://bugs.freedesktop.org/show_bug.cgi?id=67904)

Reported-by: Tzanio Kolev <kolev1@llnl.gov>

* petsc: add 3.8.4 and myself as co-maintainer

* Updating libceed to latest pre-0.2 hash.

* [PETSc] Add the 'headers' and 'libs' properties.

* [MFEM] Explicitly add rpaths to link flags for external packages.
This is necessary when MFEM's exported options (in config.mk) are
used outside of Spack for linking against MFEM.

* Unset MFEM_DIR before building MFEM

* [PETSc] As observed by @jedbrown, there is no need to define the 'libs'
property explicitly - the default handler works fine too.

* Build MAGMA shared by default, install a few additional headers

* Forgot a self

* Switching to OCCA tag v1.0.0-alpha.4.

Adding urls for OCCA and libCEED ('spack uninstall' complains otherwise).

* Removed FIXMEs for OCCA tag

* [occa] Cleaned up tagged versions

* [libceed] Updated occa to v1.0.0-alpha.5

* [ceed] Updated occa to v1.0.0-alpha.5

* [libCEED] Always define the 'NDEBUG' makefile option based on the
'debug' variant setting - this should always work regardless of the
default setting inside the libceed makefile.

* [MUMPS] Revert a temporary workaround.

* [CEED, libCEED] Minor tweaks.

* libCEED v0.2 release

* [CEED] Use version 0.2 of libCEED.

* [HPGMG] Remove duplicate version.

* [CEED] Update the hpgmg version

* hpgmg: use tarball for 0.3

The Git repository contains somewhat heavy documentation so the tarballs
are much faster.

* hpgmg: +fe was default for the 0.3 release

* hpgmg: explicitly name build directory to avoid use of ambient PETSC_ARCH

* [HPGMG] Fix flake8 formatting

* libceed@0.2: work around occaFree issue
2018-03-31 00:47:32 -07:00

165 lines
7.3 KiB
Python

##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# 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
# conditions of the GNU Lesser General Public License for more details.
#
# 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
##############################################################################
from spack import *
import re
import os
import glob
class Zoltan(Package):
"""The Zoltan library is a toolkit of parallel combinatorial algorithms
for parallel, unstructured, and/or adaptive scientific
applications. Zoltan's largest component is a suite of dynamic
load-balancing and partitioning algorithms that increase
applications' parallel performance by reducing idle time. Zoltan
also has graph coloring and graph ordering algorithms, which are
useful in task schedulers and parallel preconditioners.
"""
homepage = "http://www.cs.sandia.gov/zoltan"
url = "http://www.cs.sandia.gov/~kddevin/Zoltan_Distributions/zoltan_distrib_v3.83.tar.gz"
version('3.83', '1ff1bc93f91e12f2c533ddb01f2c095f')
version('3.8', '9d8fba8a990896881b85351d4327c4a9')
version('3.6', '9cce794f7241ecd8dbea36c3d7a880f9')
version('3.3', '5eb8f00bda634b25ceefa0122bd18d65')
variant('debug', default=False, description='Builds a debug version of the library.')
variant('shared', default=True, description='Builds a shared version of the library.')
variant('fortran', default=True, description='Enable Fortran support.')
variant('mpi', default=True, description='Enable MPI support.')
variant('parmetis', default=False, description='Enable ParMETIS support.')
depends_on('mpi', when='+mpi')
depends_on('parmetis@4:', when='+parmetis')
conflicts('+parmetis', when='~mpi')
def install(self, spec, prefix):
# FIXME: The older Zoltan versions fail to compile the F90 MPI wrappers
# because of some complicated generic type problem.
if spec.satisfies('@:3.6+fortran+mpi'):
raise RuntimeError(('Cannot build Zoltan v{0} with +fortran and '
'+mpi; please disable one of these features '
'or upgrade versions.').format(self.version))
config_args = [
self.get_config_flag('f90interface', 'fortran'),
self.get_config_flag('mpi', 'mpi'),
]
config_cflags = [
'-O0' if '+debug' in spec else '-O3',
'-g' if '+debug' in spec else '',
]
if '+shared' in spec:
config_args.append('RANLIB=echo')
config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o')
config_cflags.append(self.compiler.pic_flag)
if spec.satisfies('%gcc'):
config_args.append('--with-libs={0}'.format('-lgfortran'))
if '+parmetis' in spec:
config_args.append('--with-parmetis')
config_args.append('--with-parmetis-libdir={0}'
.format(spec['parmetis'].prefix.lib))
config_args.append('--with-parmetis-incdir={0}'
.format(spec['parmetis'].prefix.include))
if '+mpi' in spec:
config_args.append('CC={0}'.format(spec['mpi'].mpicc))
config_args.append('CXX={0}'.format(spec['mpi'].mpicxx))
config_args.append('FC={0}'.format(spec['mpi'].mpifc))
config_args.append('--with-mpi={0}'.format(spec['mpi'].prefix))
mpi_libs = self.get_mpi_libs()
# NOTE: Some external mpi installations may have empty lib
# directory (e.g. bg-q). In this case we need to explicitly
# pass empty library name.
if mpi_libs:
mpi_libs = ' -l'.join(mpi_libs)
config_args.append('--with-mpi-libs=-l{0}'.format(mpi_libs))
else:
config_args.append('--with-mpi-libs= ')
# NOTE: Early versions of Zoltan come packaged with a few embedded
# library packages (e.g. ParMETIS, Scotch), which messes with Spack's
# ability to descend directly into the package's source directory.
source_directory = self.stage.source_path
if spec.satisfies('@:3.6'):
zoltan_directory = 'Zoltan_v{0}'.format(self.version)
source_directory = join_path(source_directory, zoltan_directory)
build_directory = join_path(source_directory, 'build')
with working_dir(build_directory, create=True):
config = Executable(join_path(source_directory, 'configure'))
config(
'--prefix={0}'.format(prefix),
'--with-cflags={0}'.format(' '.join(config_cflags)),
'--with-cxxflags={0}'.format(' '.join(config_cflags)),
'--with-fcflags={0}'.format(' '.join(config_cflags)),
*config_args
)
# NOTE: Earlier versions of Zoltan cannot be built in parallel
# because they contain nested Makefile dependency bugs.
make(parallel=not spec.satisfies('@:3.6+fortran'))
make('install')
# NOTE: Unfortunately, Zoltan doesn't provide any configuration
# options for the extension of the output library files, so this
# script must change these extensions as a post-processing step.
if '+shared' in spec:
for lib_path in glob.glob(join_path(prefix, 'lib', '*.a')):
lib_static_name = os.path.basename(lib_path)
lib_shared_name = re.sub(r'\.a$', '.{0}'.format(dso_suffix),
lib_static_name)
move(lib_path, join_path(prefix, 'lib', lib_shared_name))
def get_config_flag(self, flag_name, flag_variant):
flag_pre = 'en' if '+{0}'.format(flag_variant) in self.spec else 'dis'
return '--{0}able-{1}'.format(flag_pre, flag_name)
# NOTE: Zoltan assumes that it's linking against an MPI library that can
# be found with '-lmpi,' which isn't the case for many MPI packages. This
# function finds the names of the actual libraries for Zoltan's MPI dep.
def get_mpi_libs(self):
mpi_libs = set()
for lib_path in glob.glob(join_path(self.spec['mpi'].prefix.lib, '*')):
mpi_lib_match = re.match(
r'^(lib)((\w*)mpi(\w*))\.((a)|({0}))$'.format(dso_suffix),
os.path.basename(lib_path))
if mpi_lib_match:
mpi_libs.add(mpi_lib_match.group(2))
return list(mpi_libs)