Update Package : ExodusII (#1504)
* Added support for the 'maxdims' and 'maxvars' flags for 'NetCDF'. * Added the '+mpi' variant and improved dependencies for 'exodusii'. Improved the 'exodusii' package so that it's less reliant on patches. * Added better type checking to variant values in the 'netcdf' package. * Corrected the required CMake version for the 'exodusii' package. * Fixed the dependencies of the '+mpi' variant of the 'exodusii' package.
This commit is contained in:
parent
6dc8bbcb3a
commit
37d125b890
4 changed files with 66 additions and 41 deletions
|
@ -0,0 +1,9 @@
|
|||
diff --git a/cmake-exodus b/cmake-exodus
|
||||
index 67ccd34..9b749e3 100755
|
||||
--- a/cmake-exodus
|
||||
+++ b/cmake-exodus
|
||||
@@ -1,3 +1,4 @@
|
||||
+#!/bin/bash
|
||||
EXTRA_ARGS=$@
|
||||
|
||||
### The following assumes you are building in a subdirectory of ACCESS Root
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/cmake-exodus b/cmake-exodus
|
||||
index 787fd9d..ed073a2 100755
|
||||
--- a/cmake-exodus
|
||||
+++ b/cmake-exodus
|
||||
@@ -1,4 +1,6 @@
|
||||
-EXTRA_ARGS=$@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+EXTRA_ARGS=-DSEACASProj_ENABLE_CXX11=OFF
|
||||
|
||||
### Change this to point to the compilers you want to use
|
||||
CC=gcc
|
|
@ -27,10 +27,8 @@
|
|||
# TODO: Add support for a C++11 enabled installation that filters out the
|
||||
# TODO: "C++11-Disabled" flag (but only if the spec compiler supports C++11).
|
||||
|
||||
# TODO: Add support for parallel installation that uses MPI.
|
||||
|
||||
# TODO: Create installation options for NetCDF that support larger page size
|
||||
# TODO: suggested by Exodus (see the repository "README" file).
|
||||
# TODO: Use variant forwarding to forward the 'mpi' variant to the direct
|
||||
# TODO: dependencies 'hdf5' and 'netcdf'.
|
||||
|
||||
|
||||
class Exodusii(Package):
|
||||
|
@ -46,34 +44,43 @@ class Exodusii(Package):
|
|||
homepage = "https://github.com/gsjaardema/seacas"
|
||||
url = "https://github.com/gsjaardema/seacas/archive/master.zip"
|
||||
|
||||
version('2016-02-08',
|
||||
git='https://github.com/gsjaardema/seacas.git', commit='dcf3529')
|
||||
version('2016-08-09', git='https://github.com/gsjaardema/seacas.git', commit='2ffeb1b')
|
||||
|
||||
depends_on('cmake@2.8.7:', type='build')
|
||||
depends_on('hdf5~shared~mpi')
|
||||
depends_on('netcdf~mpi')
|
||||
variant('mpi', default=True, description='Enables MPI parallelism.')
|
||||
|
||||
patch('exodus-cmake.patch')
|
||||
depends_on('cmake@2.8.11:', type='build')
|
||||
depends_on('mpi', when='+mpi')
|
||||
|
||||
def patch(self):
|
||||
ff = FileFilter('cmake-exodus')
|
||||
# https://github.com/gsjaardema/seacas/blob/master/NetCDF-Mapping.md
|
||||
depends_on('netcdf maxdims=65536 maxvars=524288')
|
||||
depends_on('hdf5+shared')
|
||||
|
||||
ff.filter('CMAKE_INSTALL_PREFIX:PATH=${ACCESS}',
|
||||
'CMAKE_INSTALL_PREFIX:PATH=%s' % self.spec.prefix,
|
||||
string=True)
|
||||
ff.filter('NetCDF_DIR:PATH=${TPL}',
|
||||
'NetCDF_DIR:PATH=%s' % self.spec['netcdf'].prefix,
|
||||
string=True)
|
||||
ff.filter('HDF5_ROOT:PATH=${TPL}',
|
||||
'HDF5_ROOT:PATH=%s' % self.spec['hdf5'].prefix,
|
||||
string=True)
|
||||
patch('cmake-exodus.patch')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
mkdirp('build')
|
||||
cd('build')
|
||||
cc_path = spec['mpi'].mpicc if '+mpi' in spec else self.compiler.cc
|
||||
cxx_path = spec['mpi'].mpicxx if '+mpi' in spec else self.compiler.cxx
|
||||
|
||||
cmake_exodus = Executable('../cmake-exodus')
|
||||
cmake_exodus()
|
||||
config_args = std_cmake_args[:]
|
||||
config_args.extend([
|
||||
# General Flags #
|
||||
'-DSEACASProj_ENABLE_CXX11:BOOL=OFF',
|
||||
'-DSEACASProj_ENABLE_Zoltan:BOOL=OFF',
|
||||
'-DHDF5_ROOT:PATH={0}'.format(spec['hdf5'].prefix),
|
||||
'-DNetCDF_DIR:PATH={0}'.format(spec['netcdf'].prefix),
|
||||
|
||||
make()
|
||||
make('install')
|
||||
# MPI Flags #
|
||||
'-DTPL_ENABLE_MPI={0}'.format('ON' if '+mpi' in spec else 'OFF'),
|
||||
'-DCMAKE_C_COMPILER={0}'.format(cc_path),
|
||||
'-DCMAKE_CXX_COMPILER={0}'.format(cxx_path),
|
||||
])
|
||||
|
||||
build_directory = join_path(self.stage.source_path, 'spack-build')
|
||||
source_directory = self.stage.source_path
|
||||
|
||||
with working_dir(build_directory, create=True):
|
||||
mcmake = Executable(join_path(source_directory, 'cmake-exodus'))
|
||||
mcmake(*config_args)
|
||||
|
||||
make()
|
||||
make('install')
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
class Netcdf(Package):
|
||||
"""NetCDF is a set of software libraries and self-describing,
|
||||
machine-independent data formats that support the creation, access,
|
||||
and sharing of array-oriented scientific data.
|
||||
machine-independent data formats that support the creation, access,
|
||||
and sharing of array-oriented scientific data.
|
||||
|
||||
"""
|
||||
|
||||
|
@ -41,6 +41,13 @@ class Netcdf(Package):
|
|||
|
||||
variant('mpi', default=True, description='Enables MPI parallelism')
|
||||
variant('hdf4', default=False, description='Enable HDF4 support')
|
||||
# These variants control the number of dimensions (i.e. coordinates and
|
||||
# attributes) and variables (e.g. time, entity ID, number of coordinates)
|
||||
# that can be used in any particular NetCDF file.
|
||||
variant('maxdims', default=1024,
|
||||
description='Defines the maximum dimensions of NetCDF files.')
|
||||
variant('maxvars', default=8192,
|
||||
description='Defines the maximum variables of NetCDF files.')
|
||||
|
||||
depends_on("m4", type='build')
|
||||
depends_on("hdf", when='+hdf4')
|
||||
|
@ -56,6 +63,20 @@ class Netcdf(Package):
|
|||
# https://github.com/Unidata/netcdf-c/issues/250
|
||||
depends_on('hdf5@:1.8', when='@:4.4.0')
|
||||
|
||||
def patch(self):
|
||||
try:
|
||||
max_dims = int(self.spec.variants['maxdims'].value)
|
||||
max_vars = int(self.spec.variants['maxvars'].value)
|
||||
except (ValueError, TypeError):
|
||||
raise TypeError('NetCDF variant values max[dims|vars] must be '
|
||||
'integer values.')
|
||||
|
||||
ff = FileFilter(join_path('include', 'netcdf.h'))
|
||||
ff.filter(r'^(#define\s+NC_MAX_DIMS\s+)\d+(.*)$',
|
||||
r'\1{0}\2'.format(max_dims))
|
||||
ff.filter(r'^(#define\s+NC_MAX_VARS\s+)\d+(.*)$',
|
||||
r'\1{0}\2'.format(max_vars))
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# Workaround until variant forwarding works properly
|
||||
if '+mpi' in spec and spec.satisfies('^hdf5~mpi'):
|
||||
|
|
Loading…
Reference in a new issue