summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToyohisa Kameyama <kameyama@riken.jp>2021-01-19 03:10:21 +0900
committerGitHub <noreply@github.com>2021-01-18 12:10:21 -0600
commit3ee8c119105822ebec283fd4828375b03ef58e25 (patch)
treedb63cc0021d997a2d7f39775c107453b2adf6af8
parent2cfe34982842a5cdcf4102c03ad926bd66b0b080 (diff)
downloadspack-3ee8c119105822ebec283fd4828375b03ef58e25.tar.gz
spack-3ee8c119105822ebec283fd4828375b03ef58e25.tar.bz2
spack-3ee8c119105822ebec283fd4828375b03ef58e25.tar.xz
spack-3ee8c119105822ebec283fd4828375b03ef58e25.zip
mpas-model: New package. (#21124)
* mpas-model: New package. * remove pnetcdf variant. remove debug print. * remove unnessesary line. * style fix.
-rw-r--r--var/spack/repos/builtin/packages/mpas-model/makefile.patch13
-rw-r--r--var/spack/repos/builtin/packages/mpas-model/package.py83
2 files changed, 96 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/mpas-model/makefile.patch b/var/spack/repos/builtin/packages/mpas-model/makefile.patch
new file mode 100644
index 0000000000..a03f40f397
--- /dev/null
+++ b/var/spack/repos/builtin/packages/mpas-model/makefile.patch
@@ -0,0 +1,13 @@
+--- spack-src/Makefile.org 2021-01-06 10:11:15.852202444 +0900
++++ spack-src/Makefile 2021-01-06 10:35:16.191769328 +0900
+@@ -459,8 +459,10 @@
+ # Keep open the possibility of shared libraries in future with, e.g., .so suffix
+ #
+ ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
++ifneq ($(wildcard $(PIO_LIB)/libpio\.*),$(PIO_LIB)/libpio.settings)
+ LIBS += -lpio
+ endif
++endif
+ ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
+ LIBS += -lpiof
+ endif
diff --git a/var/spack/repos/builtin/packages/mpas-model/package.py b/var/spack/repos/builtin/packages/mpas-model/package.py
new file mode 100644
index 0000000000..65a10bdc2f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/mpas-model/package.py
@@ -0,0 +1,83 @@
+# Copyright 2013-2021 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 MpasModel(MakefilePackage):
+ """The Model for Prediction Across Scales (MPAS) is a collaborative
+ project for developing atmosphere, ocean and other earth-system
+ simulation components for use in climate, regional climate and weather
+ studies."""
+
+ homepage = "https://mpas-dev.github.io/"
+ url = "https://github.com/MPAS-Dev/MPAS-Model/archive/v7.0.tar.gz"
+
+ version('7.0', sha256='f898ce257e66cff9e29320458870570e55721d16cb000de7f2cc27de7fdef14f')
+ version('6.3', sha256='e7f1d9ebfeb6ada37d42a286aaedb2e69335cbc857049dc5c5544bb51e7a8db8')
+ version('6.2', sha256='2a81825a62a468bf5c56ef9d9677aa2eb88acf78d4f996cb49a7db98b94a6b16')
+
+ depends_on('mpi')
+ depends_on('parallelio')
+
+ patch('makefile.patch', when='@7.0')
+
+ parallel = False
+
+ def target(self, model, action):
+ spec = self.spec
+ satisfies = spec.satisfies
+ fflags = [self.compiler.openmp_flag]
+ cppflags = ['-D_MPI']
+ if satisfies('%gcc'):
+ fflags.extend([
+ '-ffree-line-length-none',
+ '-fconvert=big-endian',
+ '-ffree-form',
+ '-fdefault-real-8',
+ '-fdefault-double-8',
+ ])
+ cppflags.append('-DUNDERSCORE')
+ elif satisfies('%fj'):
+ fflags.extend([
+ '-Free',
+ '-Fwide',
+ '-CcdRR8',
+ ])
+ cppflags.append('-DUNDERSCORE')
+ targets = [
+ 'FC_PARALLEL={0}'.format(spec['mpi'].mpifc),
+ 'CC_PARALLEL={0}'.format(spec['mpi'].mpicc),
+ 'CXX_PARALLEL={0}'.format(spec['mpi'].mpicxx),
+ 'FC_SERIAL={0}'.format(spack_fc),
+ 'CC_SERIAL={0}'.format(spack_cc),
+ 'CXX_SERIAL={0}'.format(spack_cxx),
+ 'CFLAGS_OMP={0}'.format(self.compiler.openmp_flag),
+ 'FFLAGS_OMP={0}'.format(' '.join(fflags)),
+ 'CPPFLAGS={0}'.format(' '.join(cppflags)),
+ 'PIO={0}'.format(spec['parallelio'].prefix),
+ 'NETCDF={0}'.format(spec['netcdf-c'].prefix),
+ 'NETCDFF={0}'.format(spec['netcdf-fortran'].prefix)
+ ]
+ if satisfies('^parallelio+pnetcdf'):
+ targets.append(
+ 'PNETCDF={0}'.format(spec['parallel-netcdf'].prefix)
+ )
+ targets.extend([
+ 'USE_PIO2=true', 'CPP_FLAGS=-D_MPI', 'OPENMP=true',
+ 'CORE={0}'.format(model), action
+ ])
+ return targets
+
+ def build(self, spec, prefix):
+ make(*self.target('init_atmosphere', 'all'))
+ mkdir('bin')
+ copy('init_atmosphere_model', 'bin')
+ make(*self.target('init_atmosphere', 'clean'))
+ make(*self.target('atmosphere', 'all'))
+ copy('atmosphere_model', 'bin')
+
+ def install(self, spec, prefix):
+ install_tree('bin', prefix.bin)