diff --git a/cmssw-tool-conf.spec b/cmssw-tool-conf.spec index 7e381035d16..710e64b512d 100644 --- a/cmssw-tool-conf.spec +++ b/cmssw-tool-conf.spec @@ -171,6 +171,10 @@ Requires: cuda-toolfile Requires: alpaka-toolfile Requires: cupla-toolfile +%if "%{cmsos}" != "slc7_aarch64" +Requires: cudnn-toolfile +%endif + %ifnarch ppc64le Requires: libunwind-toolfile Requires: igprof-toolfile diff --git a/cudnn-toolfile.spec b/cudnn-toolfile.spec new file mode 100644 index 00000000000..2aed88d3eb4 --- /dev/null +++ b/cudnn-toolfile.spec @@ -0,0 +1,22 @@ +### RPM external cudnn-toolfile 1.0 +Requires: cudnn +%prep + +%build + +%install +mkdir -p %i/etc/scram.d +cat << \EOF_TOOLFILE >%i/etc/scram.d/cudnn.xml + + + + + + + + + + +EOF_TOOLFILE + +## IMPORT scram-tools-post diff --git a/cudnn.spec b/cudnn.spec new file mode 100644 index 00000000000..778b2f5f22e --- /dev/null +++ b/cudnn.spec @@ -0,0 +1,37 @@ +### RPM external cudnn 8.1.1.33 +## INITENV +PATH LD_LIBRARY_PATH %i/lib64 + +%define cudaver 11.2 +%define cudnnver_maj %(echo %{realversion} | cut -f1,2,3 -d.) + +%ifarch x86_64 +Source: https://developer.download.nvidia.com/compute/redist/cudnn/v%{cudnnver_maj}/cudnn-%{cudaver}-linux-x64-v%{realversion}.tgz +%endif +%ifarch ppc64le +Source: https://developer.download.nvidia.com/compute/redist/cudnn/v%{cudnnver_maj}/cudnn-%{cudaver}-linux-ppc64le-v%{realversion}.tgz +%endif +%ifarch aarch64 +Source: https://developer.download.nvidia.com/compute/redist/cudnn/v%{cudnnver_maj}/cudnn-%{cudaver}-linux-aarch64sbsa-v%{realversion}.tgz +%endif +Requires: cuda + +%prep +%setup -n cuda + +if [ "${CUDA_VERSION%.*}" != %{cudaver} ]; then + echo 'Incompatible CUDA version in cudnn.spec!' + exit 1 +fi + +%build + +%install +%ifarch ppc64le +rm -f %_builddir/cuda/targets/ppc64le-linux/lib/*.a +mv %_builddir/cuda/targets/ppc64le-linux/lib %{i}/lib64 +mv %_builddir/cuda/targets/ppc64le-linux/* %{i}/ +%else +rm -f %_builddir/cuda/lib64/*.a +mv %_builddir/cuda/* %{i}/ +%endif + diff --git a/onnxruntime-toolfile.spec b/onnxruntime-toolfile.spec index cac1d127593..116f28ab527 100644 --- a/onnxruntime-toolfile.spec +++ b/onnxruntime-toolfile.spec @@ -16,6 +16,10 @@ cat << \EOF_TOOLFILE >%i/etc/scram.d/onnxruntime.xml +%if "%{cmsos}" != "slc7_aarch64" + + +%endif EOF_TOOLFILE diff --git a/onnxruntime.spec b/onnxruntime.spec index d13b02ebc27..89de3830034 100644 --- a/onnxruntime.spec +++ b/onnxruntime.spec @@ -7,6 +7,9 @@ Source: git+https://github.com/%{github_user}/%{n}.git?obj=%{branch}/%{tag}&expo BuildRequires: cmake ninja Requires: protobuf py3-numpy py2-wheel py2-onnx zlib libpng py2-pybind11 +%if "%{cmsos}" != "slc7_aarch64" +Requires: cuda cudnn +%endif %prep %setup -q -n %{n}-%{realversion} @@ -14,6 +17,12 @@ Requires: protobuf py3-numpy py2-wheel py2-onnx zlib libpng py2-pybind11 %build rm -rf ../build; mkdir ../build; cd ../build +%if "%{cmsos}" != "slc7_aarch64" +USE_CUDA=ON +%else +USE_CUDA=OFF +%endif + cmake ../%{n}-%{realversion}/cmake -GNinja \ -DPYTHON_EXECUTABLE=${PYTHON3_ROOT}/bin/python3 \ -DCMAKE_BUILD_TYPE=Release \ @@ -21,7 +30,10 @@ cmake ../%{n}-%{realversion}/cmake -GNinja \ -DCMAKE_INSTALL_LIBDIR=lib \ -Donnxruntime_ENABLE_PYTHON=ON \ -Donnxruntime_BUILD_SHARED_LIB=ON \ - -Donnxruntime_USE_CUDA=OFF \ + -Donnxruntime_USE_CUDA=${USE_CUDA} \ + -Donnxruntime_CUDA_VERSION="${CUDA_VERSION}" \ + -Donnxruntime_CUDA_HOME="${CUDA_ROOT}" \ + -Donnxruntime_CUDNN_HOME="${CUDNN_ROOT}" \ -Donnxruntime_BUILD_CSHARP=OFF \ -Donnxruntime_USE_EIGEN_FOR_BLAS=ON \ -Donnxruntime_USE_OPENBLAS=OFF \ @@ -39,6 +51,9 @@ cmake ../%{n}-%{realversion}/cmake -GNinja \ -Donnxruntime_DISABLE_CONTRIB_OPS=OFF \ -Donnxruntime_USE_PREINSTALLED_PROTOBUF=ON \ -Donnxruntime_PREFER_SYSTEM_LIB=ON \ + -DCMAKE_CUDA_FLAGS="-cudart shared" \ + -DCMAKE_CUDA_RUNTIME_LIBRARY=Shared \ + -DCMAKE_TRY_COMPILE_PLATFORM_VARIABLES="CMAKE_CUDA_RUNTIME_LIBRARY" \ -DCMAKE_PREFIX_PATH="${ZLIB_ROOT};${LIBPNG_ROOT};${PROTOBUF_ROOT};${PY2_PYBIND11_ROOT}" ninja -v %{makeprocesses}