Add GMT, CitcomS, and fstrack packages (#9768)

* Add initial packages for citcoms and dependencies

* Ignore Pythia imports

* Add py-merlin package

* Add GMT package

* Fixes to get GMT working

* Get hc package building

* Get CitcomS 3.2.0 working

* Add fstrack package

* Fix hash
This commit is contained in:
Adam J. Stewart 2018-11-14 23:30:44 -06:00 committed by GitHub
parent b9c50249cf
commit 2723db9f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 328 additions and 0 deletions

View File

@ -0,0 +1,78 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Citcoms(AutotoolsPackage):
"""CitcomS is a finite element code designed to solve compressible
thermochemical convection problems relevant to Earth's mantle."""
homepage = "https://geodynamics.org/cig/software/citcoms/"
url = "https://github.com/geodynamics/citcoms/releases/download/v3.3.1/CitcomS-3.3.1.tar.gz"
version('3.3.1', sha256='e3520e0a933e4699d31e86fe309b8c154ea6ecb0f42a1cf6f25e8d13d825a4b3')
version('3.2.0', sha256='773a14d91ecbb4a4d1e04317635fab79819d83c57b47f19380ff30b9b19cb07a')
variant('pyre', default=False, description='build Pyre modules')
variant('exchanger', default=False, description='use Exchanger')
variant('ggrd', default=False, description='use GGRD file support')
variant('cuda', default=False, description='use CUDA')
variant('hdf5', default=False, description='add HDF5 support')
# Required dependencies
depends_on('mpi')
depends_on('zlib')
# Optional dependencies
depends_on('exchanger', when='+exchanger')
depends_on('py-pythia', type=('build', 'run'), when='+pyre')
depends_on('hc', when='+ggrd')
depends_on('cuda', when='+cuda')
depends_on('hdf5+mpi', when='+hdf5')
conflicts('+pyre', when='@3.3:', msg='Pyre support was removed from 3.3+')
conflicts('+exchanger', when='@3.3:', msg='Exchanger support was removed from 3.3+')
def setup_environment(self, spack_env, run_env):
if '+ggrd' in self.spec:
spack_env.set('HC_HOME', self.spec['hc'].prefix)
def configure_args(self):
args = ['CC={0}'.format(self.spec['mpi'].mpicc)]
# Flags only valid in 3.2
if self.spec.satisfies('@:3.2'):
if '+pyre' in self.spec:
args.append('--with-pyre')
else:
args.append('--without-pyre')
if '+exchanger' in self.spec:
args.append('--with-exchanger')
else:
args.append('--without-exchanger')
if '+ggrd' in self.spec:
args.append('--with-ggrd')
else:
args.append('--without-ggrd')
if '+cuda' in self.spec:
args.append('--with-cuda')
else:
args.append('--without-cuda')
if '+hdf5' in self.spec:
args.extend([
'--with-hdf5',
# https://github.com/geodynamics/citcoms/issues/2
'CPPFLAGS=-DH5_USE_16_API',
'CFLAGS=-DH5_USE_16_API'
])
else:
args.append('--without-hdf5')
return args

View File

@ -0,0 +1,21 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Exchanger(AutotoolsPackage):
"""Exchanger is a package containing several C++ base classes. These
classes, when customized for a solver, can provide communication channels
between solvers. This packaged is used by CitcomS for solver coupling."""
homepage = "https://geodynamics.org/cig/software/exchanger/"
url = "https://geodynamics.org/cig/software/exchanger/Exchanger-1.0.1.tar.gz"
version('1.0.1', sha256='1e6c8311db96582bcf2c9aee16a863a5730c1aa54cb3aa7d0249239c6e0b68ee')
depends_on('python', type=('build', 'run'))
depends_on('py-merlin', type='build')
depends_on('py-pythia@0.8.1.0:0.8.1.999', type=('build', 'run'))

View File

@ -0,0 +1,54 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Fstrack(MakefilePackage):
"""Package with tools to analyze symmetry components of elastic tensors,
predict synthetic waveforms and compute automated shear wave splitting
along ray paths, and to track finite strain and predict LPO from mantle
flow given on GMT/netcdf grds."""
homepage = "http://www-udc.ig.utexas.edu/external/becker/data.html#fstrack"
url = "http://www-udc.ig.utexas.edu/external/becker/software/fstrack-0.5.3.092918.tgz"
version('0.5.3.092918', sha256='34b31687fdfa207b9659425238b805eaacf0b0209e7e3343c1a3cb4c9e62345d')
variant('flow', default=True, description='Build the flow tracker')
depends_on('gmt@4.0:4.999', when='+flow')
depends_on('netcdf', when='+flow')
parallel = False
def setup_environment(self, spack_env, run_env):
# Compilers
spack_env.set('F90', spack_fc)
# Compiler flags (assumes GCC)
spack_env.set('CFLAGS', '-O2')
spack_env.set('FFLAGS', '-ffixed-line-length-132 -x f77-cpp-input -O2')
spack_env.set('FFLAGS_DEBUG', '-g -x f77-cpp-input')
spack_env.set('F90FLAGS', '-O2 -x f95-cpp-input')
spack_env.set('F90FLAGS_DEBUG', '-g -x f95-cpp-input')
spack_env.set('LDFLAGS', '-lm')
if '+flow' in self.spec:
spack_env.set('GMTHOME', self.spec['gmt'].prefix)
spack_env.set('NETCDFDIR', self.spec['netcdf'].prefix)
def build(self, spec, prefix):
with working_dir('eispack'):
make()
with working_dir('d-rex'):
make()
with working_dir('fstrack'):
if '+flow' in spec:
make('really_all')
else:
make()

View File

@ -0,0 +1,79 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Gmt(Package):
"""GMT (Generic Mapping Tools) is an open source collection of about 80
command-line tools for manipulating geographic and Cartesian data sets
(including filtering, trend fitting, gridding, projecting, etc.) and
producing PostScript illustrations ranging from simple x-y plots via
contour maps to artificially illuminated surfaces and 3D perspective views.
"""
homepage = "http://gmt.soest.hawaii.edu/"
url = "https://github.com/GenericMappingTools/gmt/archive/5.4.4.tar.gz"
version('5.4.4', sha256='b593dfb101e6507c467619f3d2190a9f78b09d49fe2c27799750b8c4c0cd2da0')
version('4.5.9', sha256='9b13be96ccf4bbd38c14359c05dfa7eeeb4b5f06d6f4be9c33d6c3ea276afc86',
url='ftp://ftp.soest.hawaii.edu/gmt/legacy/gmt-4.5.9.tar.bz2')
variant('pcre', default=False, description='Enable the PCRE interface')
variant('gdal', default=False, description='Enable the GDAL interface')
variant('fftw', default=True, description='Fast FFTs')
variant('lapack', default=True, description='Fast matrix inversion')
variant('blas', default=True, description='Fast matrix multiplications')
# http://gmt.soest.hawaii.edu/projects/gmt/wiki/BuildingGMT
# Required dependencies
depends_on('ghostscript')
depends_on('subversion')
depends_on('cmake@2.8.5:', type='build', when='@5:')
depends_on('netcdf@4:')
depends_on('curl', when='@5.4:')
# Optional dependencies
depends_on('pcre', when='+pcre')
depends_on('gdal', when='+gdal')
depends_on('fftw', when='+fftw')
depends_on('lapack', when='+lapack')
depends_on('blas', when='+blas')
depends_on('graphicsmagick', type='test')
patch('type.patch', when='@4.5.9')
@when('@5:')
def install(self, spec, prefix):
with working_dir('spack-build', create=True):
cmake('..', *std_cmake_args)
make()
make('install')
@when('@:4')
def install(self, spec, prefix):
args = [
'--prefix={0}'.format(prefix),
'--enable-netcdf={0}'.format(spec['netcdf'].prefix),
'--enable-shared',
'--without-x'
]
if '+gdal' in spec:
args.append('--enable-gdal')
else:
args.append('--disable-gdal')
configure(*args)
# Building in parallel results in dozens of errors like:
# *** No rule to make target `../libgmtps.so', needed by `pssegyz'.
make(parallel=False)
# Installing in parallel results in dozens of errors like:
# /usr/bin/install: cannot create directory '...': File exists
make('install', parallel=False)

View File

@ -0,0 +1,17 @@
Without this patch, I see compilation errors like:
gmtdigitize.c:83:2: error: unknown type name 'gid_t'; did you mean 'pid_t'?
gmtdigitize.c:84:2: error: unknown type name 'uid_t'; did you mean 'pid_t'?
Suggestion comes from https://stackoverflow.com/a/32282782/5828163
--- a/src/misc/gmtdigitize.c 2018-11-07 12:30:46.000000000 -0600
+++ b/src/misc/gmtdigitize.c 2018-11-07 12:31:36.000000000 -0600
@@ -38,6 +38,8 @@
*/
#include "gmt.h"
+#include <sys/types.h>
+#include <unistd.h>
#ifndef WIN32
#include <termios.h>

View File

@ -0,0 +1,38 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Hc(MakefilePackage):
"""HC is a global mantle circulation solver following Hager & O'Connell
(1981) which can compute velocities, tractions, and geoid for simple
density distributions and plate velocities."""
homepage = "https://geodynamics.org/cig/software/hc/"
url = "https://geodynamics.org/cig/software/hc/hc-1.0.7.tar.gz"
version('1.0.7', sha256='7499ea76ac4739a9c0941bd57d124fb681fd387c8d716ebb358e6af3395103ed')
depends_on('gmt@4.2.1:4.999')
depends_on('netcdf')
# Build phase fails in parallel with the following error messages:
# /usr/bin/ld: cannot find -lrick
# /usr/bin/ld: cannot find -lhc
# /usr/bin/ld: cannot find -lggrd
parallel = False
def setup_environment(self, spack_env, run_env):
spack_env.set('GMTHOME', self.spec['gmt'].prefix)
spack_env.set('NETCDFHOME', self.spec['netcdf'].prefix)
spack_env.set('HC_HOME', self.prefix)
spack_env.unset('ARCH')
def install(self, spec, prefix):
# Most files are installed during the build stage.
# Manually install header files as well.
for header in find('.', '*.h'):
install(header, prefix.include)

View File

@ -0,0 +1,21 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyMerlin(PythonPackage):
"""A custom version of Phillip J. Eby's setuptools."""
homepage = "https://pypi.org/project/merlin/"
url = "https://pypi.io/packages/source/m/merlin/merlin-1.8.tar.gz"
version('1.8', sha256='a1ba9c13c74daa1724dd3820f1c241d7594d487b11f35347606986028c1881fd')
depends_on('python@:2', type=('build', 'run'))
def test(self):
# Unit tests are missing from tarball
pass

View File

@ -0,0 +1,20 @@
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPythia(PythonPackage):
"""Pythia refers to the Pyre framework and a collection of packages that
interact with it, such as an interface to the ACIS solid modelling package.
"""
homepage = "https://geodynamics.org/cig/software/pythia/"
url = "https://geodynamics.org/cig/software/github/pythia/v0.8.1.18/pythia-0.8.1.18.tar.gz"
version('0.8.1.18', sha256='f6025e6d70046dc71e375eded3d731506f8dd79e2e53b7e1436754439dcdef1e')
depends_on('python@:2', type=('build', 'run'))
depends_on('py-merlin', type='build')