summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Johnson <glenn-johnson@uiowa.edu>2019-10-25 19:14:52 -0500
committerPeter Scheibel <scheibel1@llnl.gov>2019-10-25 17:14:52 -0700
commitc566a610c9319098511f7ed645e1bb9e49927db3 (patch)
tree175ca1d51a97701594b7ef1ce761be4fc69f3591
parentcfbac14cba4ddc18a1addc2f02f8ff09947716b0 (diff)
downloadspack-c566a610c9319098511f7ed645e1bb9e49927db3.tar.gz
spack-c566a610c9319098511f7ed645e1bb9e49927db3.tar.bz2
spack-c566a610c9319098511f7ed645e1bb9e49927db3.tar.xz
spack-c566a610c9319098511f7ed645e1bb9e49927db3.zip
New package: gpu-burn (#13108)
-rw-r--r--var/spack/repos/builtin/packages/gpu-burn/Makefile.patch18
-rw-r--r--var/spack/repos/builtin/packages/gpu-burn/package.py55
2 files changed, 73 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gpu-burn/Makefile.patch b/var/spack/repos/builtin/packages/gpu-burn/Makefile.patch
new file mode 100644
index 0000000000..57378a6876
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gpu-burn/Makefile.patch
@@ -0,0 +1,18 @@
+--- a/Makefile 2018-12-08 05:36:48.000000000 -0600
++++ b/Makefile 2019-10-04 13:08:37.095337704 -0500
+@@ -1,12 +1,6 @@
+-CUDAPATH=/usr/local/cuda
+-
+-# Have this point to an old enough gcc (for nvcc)
+-GCCPATH=/usr
+-
+ NVCC=nvcc
+-CCPATH=${GCCPATH}/bin
+
+ drv:
+- PATH=${PATH}:.:${CCPATH}:${PATH} ${NVCC} -I${CUDAPATH}/include -arch=compute_30 -ptx compare.cu -o compare.ptx
+- g++ -O3 -Wno-unused-result -I${CUDAPATH}/include -c gpu_burn-drv.cpp
+- g++ -o gpu_burn gpu_burn-drv.o -O3 -lcuda -L${CUDAPATH}/lib64 -L${CUDAPATH}/lib -Wl,-rpath=${CUDAPATH}/lib64 -Wl,-rpath=${CUDAPATH}/lib -lcublas -lcudart -o gpu_burn
++ ${NVCC} -arch=compute_30 -ptx compare.cu -o compare.ptx
++ g++ -O3 -Wno-unused-result -c gpu_burn-drv.cpp
++ g++ -o gpu_burn gpu_burn-drv.o -O3 -lcuda -lcublas -lcudart -o gpu_burn
diff --git a/var/spack/repos/builtin/packages/gpu-burn/package.py b/var/spack/repos/builtin/packages/gpu-burn/package.py
new file mode 100644
index 0000000000..fd11176baa
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gpu-burn/package.py
@@ -0,0 +1,55 @@
+# 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 *
+
+
+class GpuBurn(MakefilePackage, CudaPackage):
+ """Multi-GPU CUDA stress test. Note that the file pointed to by COMPARE_PTX
+ needs to be copied or linked to the current working directory before
+ running gpu_burn."""
+
+ homepage = "http://wili.cc/blog/gpu-burn.html"
+ url = "http://wili.cc/blog/entries/gpu-burn/gpu_burn-1.0.tar.gz"
+
+ version('1.0', sha256='d55994f0bee8dabf021966dbe574ef52be1e43386faeee91318dd4ebb36aa74a')
+
+ patch('Makefile.patch')
+
+ # This package uses CudaPackage to pick up the cuda_arch variant. A side
+ # effect is that it also picks up the cuda variant, but cuda is required
+ # for gpu-burn so is not really a variant.
+ variant('cuda', 'True', description='Use CUDA; must be true')
+
+ conflicts('~cuda', msg='gpu-burn requires cuda')
+
+ def edit(self, spec, prefix):
+ # update cuda architecture if necessary
+ if '+cuda' in self.spec:
+ cuda_arch = self.spec.variants['cuda_arch'].value
+ archflag = ''
+
+ if cuda_arch != 'none':
+ if len(cuda_arch) > 1:
+ raise InstallError(
+ 'gpu-burn only supports compilation for a single GPU'
+ 'type.'
+ )
+ archflag = '-arch=compute_{0}'.format(cuda_arch[0])
+
+ filter_file('-arch=compute_30', archflag,
+ 'Makefile', string=True)
+
+ def install(self, spec, prefix):
+ mkdir(prefix.bin)
+ mkdir(prefix.share)
+ install('gpu_burn', prefix.bin)
+ install('compare.ptx', prefix.share)
+
+ # The gpu_burn program looks for the compare.ptx file in the current
+ # working directory. Create an environment variable that can be pointed to
+ # so that it can be copied or linked.
+ def setup_environment(self, spack_env, run_env):
+ run_env.set('COMPARE_PTX', join_path(self.prefix.share, 'compare.ptx'))