Skip to content

Commit

Permalink
Merge pull request #7279 from fwyzard/IB/CMSSW_12_1_X/master_add_cuda…
Browse files Browse the repository at this point in the history
…-compatible-runtime_external

Add the cuda-compatible-runtime test as a new external
  • Loading branch information
smuzaffar authored Sep 9, 2021
2 parents 2845d97 + 9a9f0c3 commit 56ca74d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmssw-tool-conf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Requires: dablooms
Requires: openldap
Requires: gperftools
Requires: cuda
Requires: cuda-compatible-runtime
Requires: alpaka
Requires: cupla

Expand Down
26 changes: 26 additions & 0 deletions cuda-compatible-runtime.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
### RPM external cuda-compatible-runtime 1.0

%define branch master
%define commit 18d5a51bfb32fbb7b765dd2eecd14e193cce8126

Source: git+https://:@gitlab.cern.ch:8443/cms-patatrack/%{n}.git?obj=%{branch}/%{commit}&export=%{n}&filter=./test.c&output=/%{n}-%{realversion}.tgz
Requires: cuda
AutoReq: no

%prep
%setup -n %{n}

%build
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

%install

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
fi

%post
11 changes: 7 additions & 4 deletions cuda.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ mkdir -p %{i}/include
mkdir -p %{i}/lib64
mkdir -p %{i}/lib64/stubs

# package only the runtime static library
# package only the runtime static libraries
mv %_builddir/build/lib64/libcudadevrt.a %{i}/lib64/
mv %_builddir/build/lib64/libcudart_static.a %{i}/lib64/
rm -f %_builddir/build/lib64/lib*.a

# package only the CUDA driver and NVML library stub
mv %_builddir/build/lib64/stubs/libcuda.so %{i}/lib64/stubs/
mv %_builddir/build/lib64/stubs/libnvidia-ml.so %{i}/lib64/stubs/
# package only the CUDA driver and NVML library stubs
mv %_builddir/build/lib64/stubs/libcuda.so %{i}/lib64/stubs/libcuda.so
ln -sf libcuda.so %{i}/lib64/stubs/libcuda.so.1
mv %_builddir/build/lib64/stubs/libnvidia-ml.so %{i}/lib64/stubs/libnvidia-ml.so
ln -sf libnvidia-ml.so %{i}/lib64/stubs/libnvidia-ml.so.1
rm -rf %_builddir/build/lib64/stubs/

# do not package the OpenCL libraries
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<tool name="cuda-compatible-runtime" version="@TOOL_VERSION@">
<info url="https://gitlab.cern.ch/cms-patatrack/cuda-compatible-runtime/"/>
<use name="cuda"/>
<use name="cuda-stubs"/>
<client>
<environment name="CUDA_COMPATIBLE_RUNTIME_BASE" default="@TOOL_ROOT@"/>
</client>
</tool>

0 comments on commit 56ca74d

Please sign in to comment.