summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThilina Rathnayake <thilinarmtb@users.noreply.github.com>2017-12-08 11:30:42 -0600
committerChristoph Junghans <christoph.junghans@gmail.com>2017-12-08 10:30:42 -0700
commitc1bc1be2a75b62ea01d8c2e16ab46c379069c50f (patch)
tree04b44086ddf98fe4f8ce827acb10ab254bbfc615
parentd6db53209539190a3a33062da899fef3a6a8c51c (diff)
downloadspack-c1bc1be2a75b62ea01d8c2e16ab46c379069c50f.tar.gz
spack-c1bc1be2a75b62ea01d8c2e16ab46c379069c50f.tar.bz2
spack-c1bc1be2a75b62ea01d8c2e16ab46c379069c50f.tar.xz
spack-c1bc1be2a75b62ea01d8c2e16ab46c379069c50f.zip
Add NekCEM package to spack (#6509)
-rw-r--r--var/spack/repos/builtin/packages/nekcem/package.py90
1 files changed, 90 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/nekcem/package.py b/var/spack/repos/builtin/packages/nekcem/package.py
new file mode 100644
index 0000000000..b38c17084b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/nekcem/package.py
@@ -0,0 +1,90 @@
+##############################################################################
+# Copyright (c) 2013-2017, 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 os
+
+
+class Nekcem(Package):
+ """Spectral-element solver for Maxwell's equations, drift-diffusion
+ equations, and more."""
+
+ # Links to homepage and git
+ homepage = "https://nekcem.mcs.anl.gov"
+ url = "https://github.com/NekCEM/NekCEM/archive/development.zip"
+
+ # Variants
+ variant('mpi', default=True, description='Build with MPI')
+
+ # We only have a development version
+ version('develop', git='https://github.com/NekCEM/NekCEM.git')
+
+ # dependencies
+ depends_on('mpi', when='+mpi')
+ depends_on('python@2.7:')
+ depends_on('blas')
+ depends_on('lapack')
+
+ @run_before('install')
+ def fortran_check(self):
+ if not self.compiler.fc:
+ msg = 'NekCEM can not be built without a Fortran compiler.'
+ raise RuntimeError(msg)
+
+ def install(self, spec, prefix):
+ binDir = 'bin'
+ nek = 'nek'
+ cNek = 'configurenek'
+ mNek = 'makenek'
+
+ FC = self.compiler.fc
+ CC = self.compiler.cc
+
+ if '+mpi' in spec:
+ FC = spec['mpi'].mpif77
+ CC = spec['mpi'].mpicc
+
+ with working_dir(binDir):
+ filter_file(r'^FC\s*=.*', 'FC=\"' + FC + '\"', 'makenek')
+ filter_file(r'^CC\s*=.*', 'CC=\"' + CC + '\"', 'makenek')
+ filter_file(r'^NEK\s*=.*', 'NEK=\"' + prefix.bin.NekCEM +
+ '\"', 'makenek')
+
+ blasLapack = spec['lapack'].libs + spec['blas'].libs
+ ldFlags = blasLapack.ld_flags
+ # Temporary workaround, we should use LDFLAGS when
+ # configurenek in Nekcem is fixed.
+ # See issue: https://github.com/NekCEM/NekCEM/issues/200
+ filter_file(r'^EXTRALDFLAGS\s*=.*', 'EXTRALDFLAGS=\"' + ldFlags +
+ '\"', 'makenek')
+
+ # Install NekCEM in prefix/bin
+ install_tree('../NekCEM', prefix.bin.NekCEM)
+ # Create symlinks to makenek, nek and configurenek scripts
+ os.symlink(os.path.join(prefix.bin.NekCEM, binDir, mNek),
+ os.path.join(prefix.bin, mNek))
+ os.symlink(os.path.join(prefix.bin.NekCEM, binDir, cNek),
+ os.path.join(prefix.bin, cNek))
+ os.symlink(os.path.join(prefix.bin.NekCEM, binDir, nek),
+ os.path.join(prefix.bin, nek))