gpu-burn: add v1.1 and "master" (#22778)

This commit is contained in:
Andrew W Elble 2021-04-06 02:57:03 -04:00 committed by GitHub
parent 1c0230f7d0
commit 6e48e29c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 43 deletions

View file

@ -1,18 +0,0 @@
--- 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
+ $(CXX) -O3 -Wno-unused-result -c gpu_burn-drv.cpp
+ $(CXX) -o gpu_burn gpu_burn-drv.o -O3 -lcuda -lcublas -lcudart -o gpu_burn

View file

@ -3,21 +3,18 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class GpuBurn(MakefilePackage, CudaPackage): class GpuBurn(MakefilePackage, CudaPackage):
"""Multi-GPU CUDA stress test. Note that the file pointed to by COMPARE_PTX """Multi-GPU CUDA stress test."""
needs to be copied or linked to the current working directory before
running gpu_burn."""
homepage = "http://wili.cc/blog/gpu-burn.html" homepage = "http://wili.cc/blog/gpu-burn.html"
url = "http://wili.cc/blog/entries/gpu-burn/gpu_burn-1.0.tar.gz" url = "http://wili.cc/blog/entries/gpu-burn/gpu_burn-1.0.tar.gz"
git = "https://github.com/wilicc/gpu-burn"
version('master', branch='master')
version('1.1', sha256='9876dbf7ab17b3072e9bc657034ab39bdedb219478f57c4e93314c78ae2d6376')
version('1.0', sha256='d55994f0bee8dabf021966dbe574ef52be1e43386faeee91318dd4ebb36aa74a') version('1.0', sha256='d55994f0bee8dabf021966dbe574ef52be1e43386faeee91318dd4ebb36aa74a')
patch('Makefile.patch')
# This package uses CudaPackage to pick up the cuda_arch variant. A side # 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 # effect is that it also picks up the cuda variant, but cuda is required
# for gpu-burn so is not really a variant. # for gpu-burn so is not really a variant.
@ -26,31 +23,27 @@ class GpuBurn(MakefilePackage, CudaPackage):
conflicts('~cuda', msg='gpu-burn requires cuda') conflicts('~cuda', msg='gpu-burn requires cuda')
conflicts('cuda_arch=none', msg='must select a CUDA architecture') conflicts('cuda_arch=none', msg='must select a CUDA architecture')
cuda_arch_values = CudaPackage.cuda_arch_values
variant(
'cuda_arch',
description='CUDA architecture',
default='none',
values=('none',) + cuda_arch_values,
multi=False
)
def edit(self, spec, prefix): def edit(self, spec, prefix):
# update cuda architecture if necessary # update cuda architecture if necessary
if '+cuda' in self.spec: if '+cuda' in self.spec:
cuda_arch = self.spec.variants['cuda_arch'].value cuda_arch = self.spec.variants['cuda_arch'].value
archflag = '-arch=compute_{0}'.format(cuda_arch) archflag = " ".join(CudaPackage.cuda_flags(cuda_arch))
filter_file('-arch=compute_30', archflag, with open('Makefile', 'w') as fh:
'Makefile', string=True) fh.write('drv:\n')
fh.write('\tnvcc {0} -fatbin '
'compare.cu -o compare.ptx\n'.format(archflag))
fh.write('\tg++ -O3 -c gpu_burn-drv.cpp\n')
fh.write('\tg++ -o gpu_burn gpu_burn-drv.o -O3 -lcuda '
'-lcublas -lcudart -o gpu_burn\n')
filter_file('compare.ptx',
join_path(prefix.share,
'compare.ptx'),
'gpu_burn-drv.cpp',
string=True)
def install(self, spec, prefix): def install(self, spec, prefix):
mkdir(prefix.bin) mkdir(prefix.bin)
mkdir(prefix.share) mkdir(prefix.share)
install('gpu_burn', prefix.bin) install('gpu_burn', prefix.bin)
install('compare.ptx', prefix.share) 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_run_environment(self, env):
env.set('COMPARE_PTX', join_path(self.prefix.share, 'compare.ptx'))