diff options
author | Abhinav Bhatele <bhatele@gmail.com> | 2017-10-26 08:18:05 -0700 |
---|---|---|
committer | Christoph Junghans <christoph.junghans@gmail.com> | 2017-10-26 09:18:05 -0600 |
commit | 02744141e907c2b535739efa7ee914d61a1b4b74 (patch) | |
tree | ed00f84d8b3225d0826ee61284f42ec1617c265b | |
parent | 18d2fe7647cdb97837ef08c8a5d86c0478ceee6d (diff) | |
download | spack-02744141e907c2b535739efa7ee914d61a1b4b74.tar.gz spack-02744141e907c2b535739efa7ee914d61a1b4b74.tar.bz2 spack-02744141e907c2b535739efa7ee914d61a1b4b74.tar.xz spack-02744141e907c2b535739efa7ee914d61a1b4b74.zip |
sw4lite: fix build errors and add variants (#5944)
* sw4lite: fix build errors and add variants
* sw4lite: change linking against blas and lapack
* change order of blas and lapack
* satisfy flake8 requirements
* Update package.py
-rw-r--r-- | var/spack/repos/builtin/packages/sw4lite/package.py | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/sw4lite/package.py b/var/spack/repos/builtin/packages/sw4lite/package.py index 3378e723e2..7606deaa2a 100644 --- a/var/spack/repos/builtin/packages/sw4lite/package.py +++ b/var/spack/repos/builtin/packages/sw4lite/package.py @@ -23,32 +23,70 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +import glob class Sw4lite(MakefilePackage): """Sw4lite is a bare bone version of SW4 intended for testing performance optimizations in a few important numerical kernels of SW4.""" - tags = ['proxy-app'] + tags = ['proxy-app', 'ecp-proxy-app'] - homepage = "https://github.com/geodynamics/sw4lite" + homepage = "https://geodynamics.org/cig/software/sw4" url = "https://github.com/geodynamics/sw4lite/archive/v1.0.zip" version('develop', git='https://github.com/geodynamics/sw4lite', branch='master') version('1.0', '3d911165f4f2ff6d5f9c1bd56ab6723f') + variant('openmp', default=True, description='Build with OpenMP support') + variant('precision', default='double', values=('float', 'double'), + multi=False, description='Floating point precision') + variant('ckernel', default=False, description='C or Fortran kernel') + + depends_on('blas') + depends_on('lapack') depends_on('mpi') @property def build_targets(self): targets = [] spec = self.spec - targets.append('ckernel=yes') + + if spec.variants['precision'].value == 'double': + cxxflags = ['-I../src', '-I../src/double'] + else: + cxxflags = ['-I../src', '-I../src/float'] + cflags = [] + fflags = [] + + if '+openmp' in self.spec: + cflags.append('-DSW4_OPENMP') + cflags.append(self.compiler.openmp_flag) + cxxflags.append('-DSW4_OPENMP') + cxxflags.append(self.compiler.openmp_flag) + fflags.append(self.compiler.openmp_flag) + + if spec.variants['ckernel'].value is True: + cxxflags.append('-DSW4_CROUTINES') + targets.append('ckernel=yes') + targets.append('FC=' + spec['mpi'].mpifc) targets.append('CXX=' + spec['mpi'].mpicxx) + + targets.append('CFLAGS={0}'.format(' '.join(cflags))) + targets.append('CXXFLAGS={0}'.format(' '.join(cxxflags))) + targets.append('FFLAGS={0}'.format(' '.join(fflags))) + + targets.append('EXTRA_CXX_FLAGS=') + targets.append('EXTRA_FORT_FLAGS=') + lapack_blas = spec['lapack'].libs + spec['blas'].libs + targets.append('EXTRA_LINK_FLAGS={0}'.format(lapack_blas.ld_flags)) + return targets def install(self, spec, prefix): mkdir(prefix.bin) - install('optimize_c/sw4lite', prefix.bin) + exe_name = glob.glob('*/sw4lite')[0] + install(exe_name, prefix.bin) + install_tree('tests', prefix.tests) |