Adding Cuda Variant to SW4Lite (#18590)
* Adding Cuda Variant to SW4Lite Added cuda variant of sw4lite as per guidance in README * Updated SW4Lite+cuda to Current Header Conventions Updated sw4lite+cuda to use current conventions for spackage include dirs * Fixing FLake8 Issue with Sw4lite+cuda Fix Fixed overly long line and further underlined sticky note reminding me to run flake8 BEFORE pushing * Switching to Spack Compiler Wrapper Switching to spack compiler wrapper for consistency
This commit is contained in:
parent
ff6ca57dda
commit
3fabdb6e9b
1 changed files with 16 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
|
||||
class Sw4lite(MakefilePackage):
|
||||
class Sw4lite(MakefilePackage, CudaPackage):
|
||||
"""Sw4lite is a bare bone version of SW4 intended for testing
|
||||
performance optimizations in a few important numerical kernels of SW4."""
|
||||
|
||||
|
@ -52,6 +52,15 @@ def build_targets(self):
|
|||
cxxflags.append('-DSW4_CROUTINES')
|
||||
targets.append('ckernel=yes')
|
||||
|
||||
if '+cuda' in self.spec:
|
||||
targets.append('NVCC = {0}'.format(
|
||||
self.spec['cuda'].prefix.bin.nvcc))
|
||||
targets.append('HOSTCOMP = {0}'.format(spack_cxx))
|
||||
targets.append('MPIPATH= {0} '.format(self.spec['mpi'].prefix))
|
||||
targets.append('gpuarch= {0}'.format(self.cuda_flags(cuda_arch)))
|
||||
targets.append('MPIINC = {0}'.format(
|
||||
self.spec['mpi'].headers.directories[0]))
|
||||
|
||||
targets.append('FC=' + spec['mpi'].mpifc)
|
||||
targets.append('CXX=' + spec['mpi'].mpicxx)
|
||||
|
||||
|
@ -70,6 +79,12 @@ def build_targets(self):
|
|||
|
||||
return targets
|
||||
|
||||
def build(self, spec, prefix):
|
||||
if '+cuda' in spec:
|
||||
make('-f', 'Makefile.cuda')
|
||||
else:
|
||||
make('-f', 'Makefile')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
mkdir(prefix.bin)
|
||||
install('*/sw4lite', prefix.bin)
|
||||
|
|
Loading…
Reference in a new issue