summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkhil Reddy Patlolla <patlolla.akhil@gmail.com>2017-10-17 20:59:57 -0500
committerChristoph Junghans <christoph.junghans@gmail.com>2017-10-17 19:59:57 -0600
commit9b994c05f4159f2a4c664622d32c258a93683a87 (patch)
tree6f75f2008ed71673ed7673a35ea10eb4b396e922
parentad5fb40d75d5e89517dc7c18b95e3ccb87e2e195 (diff)
downloadspack-9b994c05f4159f2a4c664622d32c258a93683a87.tar.gz
spack-9b994c05f4159f2a4c664622d32c258a93683a87.tar.bz2
spack-9b994c05f4159f2a4c664622d32c258a93683a87.tar.xz
spack-9b994c05f4159f2a4c664622d32c258a93683a87.zip
CoMD Proxy App with Serial, MPI, OpenMP Support (#4864)
-rw-r--r--var/spack/repos/builtin/packages/comd/package.py75
1 files changed, 66 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/comd/package.py b/var/spack/repos/builtin/packages/comd/package.py
index f8fd8da634..c49e2575a8 100644
--- a/var/spack/repos/builtin/packages/comd/package.py
+++ b/var/spack/repos/builtin/packages/comd/package.py
@@ -24,6 +24,7 @@
##############################################################################
from spack import *
+import shutil
class Comd(MakefilePackage):
@@ -36,20 +37,76 @@ class Comd(MakefilePackage):
versions of CoMD will be released to incorporate the lessons learned from
the co-design process."""
- homepage = "http://exmatex.github.io/CoMD/"
+ tags = ['proxy-app']
- version('master', git='https://github.com/exmatex/CoMD.git',
- branch='master')
+ homepage = "http://www.exmatex.org/comd.html"
+ url = "https://github.com/exmatex/CoMD/archive/master.tar.gz"
- depends_on('mpi')
+ version('master', git='https://github.com/exmatex/CoMD.git', branch='master')
- build_directory = 'src-mpi'
+ variant('serial', default=False, description='Build without MPI support')
+ variant('mpi', default=True, description='Build with MPI support')
+ variant('openmp', default=False, description='Build with OpenMP support')
+ variant('precision', default=True, description='Toggle Precesion Options')
+ variant('graphs', default=True, description='Enable graph visuals')
+
+ depends_on('mpi', when='+mpi')
+ depends_on('graphviz', when='+graphs')
+
+ conflicts('+openmp', when='~serial')
def edit(self, spec, prefix):
- with working_dir('src-mpi'):
- filter_file(r'^CC\s*=.*', 'CC = %s' % self.spec['mpi'].mpicc,
- 'Makefile.vanilla')
- install('Makefile.vanilla', 'Makefile')
+ with working_dir('src-mpi') or working_dir('src-openmp'):
+ shutil.copy('Makefile.vanilla', 'Makefile')
+
+ @property
+ def build_targets(self):
+ targets = []
+ cflags = ' -std=c99 '
+ optflags = ' -g -O5 '
+ clib = ' -lm '
+ comd_variant = 'CoMD'
+ cc = spack_cc
+
+ if '+openmp' in self.spec:
+ targets.append('--directory=src-openmp')
+ comd_variant += '-openmp'
+ cflags += ' -fopenmp '
+ if '+mpi' in self.spec:
+ comd_variant += '-mpi'
+ targets.append('CC = {0}'.format(self.spec['mpi'].mpicc))
+ else:
+ targets.append('CC = {0}'.format('spack_cc'))
+
+ else:
+ targets.append('--directory=src-mpi')
+ if '+serial' in self.spec:
+ comd_variant += '-serial'
+ targets.append('CC = {0}'.format(cc))
+ else:
+ comd_variant += '-mpi'
+ targets.append('CC = {0}'.format(self.spec['mpi'].mpicc))
+ if '+mpi' in self.spec:
+ cflags += '-DDO_MPI'
+ targets.append(
+ 'INCLUDES = {0}'.format(self.spec['mpi'].prefix.include))
+
+ if '+precision' in self.spec:
+ cflags += ' -DDOUBLE '
+ else:
+ cflags += ' -DSINGLE '
+
+ targets.append('CoMD_VARIANT = {0}'.format(comd_variant))
+ targets.append('CFLAGS = {0}'.format(cflags))
+ targets.append('OPTFLAGS = {0}'.format(optflags))
+ targets.append('C_LIB = {0}'.format(clib))
+
+ return targets
def install(self, spec, prefix):
install_tree('bin', prefix.bin)
+ install_tree('examples', prefix.examples)
+ install_tree('pots', prefix.pots)
+ mkdirp(prefix.doc)
+ install('README.md', prefix.doc)
+ install('LICENSE.md', prefix.doc)