diff options
author | Justin S <3630356+codeandkey@users.noreply.github.com> | 2019-05-14 14:47:19 -0500 |
---|---|---|
committer | Levi Baber <baber@iastate.edu> | 2019-05-14 14:47:19 -0500 |
commit | a5cf50df2e509328b0cd08b5a9e35ed8068de1c4 (patch) | |
tree | 7e2bf366ef0b7b7a4221335bbbd3a3d694823619 | |
parent | f7a778af3cf9a472f552b58d34c0f6d411b350e9 (diff) | |
download | spack-a5cf50df2e509328b0cd08b5a9e35ed8068de1c4.tar.gz spack-a5cf50df2e509328b0cd08b5a9e35ed8068de1c4.tar.bz2 spack-a5cf50df2e509328b0cd08b5a9e35ed8068de1c4.tar.xz spack-a5cf50df2e509328b0cd08b5a9e35ed8068de1c4.zip |
megadock: new package at 4.0.3 (#10537)
* megadock: new package at 4.0.3
* megadock: remove CudaPackage redundancies
* megadock: move env vars to build targets, use cuda_arch variant
* megadock: flake8 fixes, more flexible mathlib
-rw-r--r-- | var/spack/repos/builtin/packages/megadock/package.py | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/megadock/package.py b/var/spack/repos/builtin/packages/megadock/package.py new file mode 100644 index 0000000000..488ec3424d --- /dev/null +++ b/var/spack/repos/builtin/packages/megadock/package.py @@ -0,0 +1,77 @@ +# Copyright 2013-2019 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 * +import os + + +class Megadock(MakefilePackage, CudaPackage): + """an ultra-high-performance protein-protein docking for + heterogeneous supercomputers""" + + homepage = "http://www.bi.cs.titech.ac.jp/megadock/" + url = "http://www.bi.cs.titech.ac.jp/megadock/archives/megadock-4.0.3.tgz" + + version('4.0.3', sha256='c1409a411555f4f7b4eeeda81caf622d8a28259a599ea1d2181069c55f257664') + + variant('mpi', description='Enable MPI', default=False) + + depends_on('fftw') + depends_on('mpi', when='+mpi') + + def edit(self, spec, prefix): + # point cuda samples relative to cuda installation + filter_file('/opt/cuda/6.5/samples', '$(CUDA_INSTALL_PATH)/samples', + 'Makefile', string=True) + + # need to link calcrg to compiler's math impl + # libm seems to be present in most compilers + mathlib = '-lm' + + # prefer libimf with intel + if '%intel' in spec: + mathlib = '-limf' + + filter_file('-o calcrg', '%s -o calcrg' % mathlib, + 'Makefile', string=True) + + # makefile has a weird var for cuda_arch, use conditionally + if '+cuda' in spec: + arch = spec.variants['cuda_arch'].value + archflag = '' + + if arch[0] != 'none': + archflag = '-arch=%s' % arch[0] + + filter_file('-arch=$(SM_VERSIONS)', archflag, + 'Makefile', string=True) + + @property + def build_targets(self): + spec = self.spec + + targets = [ + 'USE_GPU=%s' % ('1' if '+cuda' in spec else '0'), + 'USE_MPI=%s' % ('1' if '+mpi' in spec else '0'), + 'OMPFLAG=%s' % self.compiler.openmp_flag, + 'CPPCOMPILER=c++', + 'FFTW_INSTALL_PATH=%s' % self.spec['fftw'].prefix, + ] + + if '+cuda' in spec: + targets.append('CUDA_INSTALL_PATH=%s' % self.spec['cuda'].prefix) + + if '+mpi' in spec: + targets.append('MPICOMPILER=%s' % self.spec['mpi'].mpicxx) + + return targets + + def install(self, spec, prefix): + mkdirp(prefix.bin) + + for suffix in ['', '-gpu', '-dp', '-gpu-dp']: + fn = 'megadock' + suffix + if os.path.isfile(fn): + install(fn, prefix.bin) |