Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7419 from fwyzard/IB/CMSSW_12_1_X/master_update_c…
…uda-compatible-runtime Update cuda-compatible-runtime to add kernel checks
- Loading branch information
Showing
1 changed file
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,67 @@ | ||
### RPM external cuda-compatible-runtime 1.0 | ||
|
||
%define branch master | ||
%define commit 18d5a51bfb32fbb7b765dd2eecd14e193cce8126 | ||
%define commit bfe5537537428ab4a72ae929c77977a55501c576 | ||
|
||
Source: git+https://:@gitlab.cern.ch:8443/cms-patatrack/%{n}.git?obj=%{branch}/%{commit}&export=%{n}&filter=./test.c&output=/%{n}-%{realversion}.tgz | ||
Source: git+https://:@gitlab.cern.ch:8443/cms-patatrack/%{n}.git?obj=%{branch}/%{commit}&export=%{n}&filter=./test.cu&output=/%{n}-%{realversion}.tgz | ||
Requires: cuda | ||
AutoReq: no | ||
|
||
%prep | ||
%setup -n %{n} | ||
|
||
%build | ||
## INCLUDE cuda-flags | ||
# defines nvcc_stdcxx and cuda_flags_4 | ||
|
||
rm -rf %{_builddir}/build && mkdir %{_builddir}/build | ||
gcc -std=c99 -O2 -Wall test.c -I $CUDA_ROOT/include -L $CUDA_ROOT/lib64 -L $CUDA_ROOT/lib64/stubs -l cudart_static -l cuda -ldl -lrt -pthread -static-libgcc -o %{_builddir}/build/cuda-compatible-runtime # || true | ||
if | ||
$CUDA_ROOT/bin/nvcc %{nvcc_stdcxx} -O2 -g %{cuda_flags_4} test.cu -I $CUDA_ROOT/include -L $CUDA_ROOT/lib64 -L $CUDA_ROOT/lib64/stubs --cudart static -ldl -lrt --compiler-options '-Wall -pthread' -o %{_builddir}/build/cuda-compatible-runtime | ||
then | ||
true | ||
else | ||
# CUDA is not supported by this architecture or compiler version | ||
cat > %{_builddir}/build/cuda-compatible-runtime << @EOF_ | ||
#! /bin/bash | ||
|
||
%install | ||
VERBOSE=false | ||
|
||
mkdir %{i}/test | ||
if [ -f %{_builddir}/build/cuda-compatible-runtime ]; then | ||
cp %{_builddir}/build/cuda-compatible-runtime %{i}/test/cuda-compatible-runtime | ||
else | ||
ln -s /usr/bin/false %{i}/test/cuda-compatible-runtime | ||
function usage() { | ||
cat << @EOF | ||
Usage: \$0 [-h|-v] | ||
|
||
Options: | ||
-h Print a help message and exits. | ||
-v Be more verbose. | ||
@EOF | ||
} | ||
|
||
for ARG in "\$@"; do | ||
case "\$ARG" in | ||
-h) | ||
usage | ||
exit 0 | ||
;; | ||
-v) | ||
VERBOSE=true | ||
;; | ||
*) | ||
echo "\$0: invalid option '\$ARG'" | ||
echo | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
\$VERBOSE && echo "CUDA ${CUDA_VERSION} is not compatible with GCC ${GCC_VERSION}" | ||
exit 1 | ||
@EOF_ | ||
chmod +x %{_builddir}/build/cuda-compatible-runtime | ||
fi | ||
|
||
%install | ||
mkdir %{i}/test | ||
cp %{_builddir}/build/cuda-compatible-runtime %{i}/test/cuda-compatible-runtime | ||
|
||
%post |