From 8c74431dc83c57775de415312865e1b082a24c72 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 3 Jun 2024 09:09:16 +0200 Subject: [PATCH 1/6] Changes needed for building cms software stack without cuda/rocm --- bootstrap-bundle.spec | 3 +- bootstrap-driver.spec | 9 +++++ ...h-tool-conf.spec => cmssw-patch-tools.spec | 4 +-- cmssw-tool-conf.spec => cmssw-tools.spec | 17 +++------- coral-tool-conf.spec => coral-tools.spec | 4 +-- cpu_features.spec | 2 +- fwlite-tool-conf.spec => fwlite-tools.spec | 13 +++---- hwloc.spec | 23 +++++-------- java-env.spec | 4 +-- jemalloc-common.file | 2 +- llvm.spec | 6 ++-- onnxruntime.spec | 18 +++++----- openmpi.spec | 4 +-- python_tools.spec | 2 +- pytorch-cluster.spec | 2 +- pytorch-scatter.spec | 2 +- pytorch-sparse.spec | 2 +- pytorch.spec | 7 ++-- rocm-rocrand.spec | 2 +- rocm.spec | 2 +- rpm-preamble.file | 17 +++++++--- rpm.spec | 2 ++ rust.spec | 5 +-- scram-tools.file/cmsdist_packages.py | 8 ----- scram-tools.file/toolfile.file | 25 -------------- scram-tools.file/tools/hwloc/hwloc.xml | 2 ++ scram/cmsdist_packages.py | 27 +++++++++++++++ .../tool-conf-src.file | 29 ++++++++++++---- scram/toolfile-src.file | 34 +++++++++++++++++++ scram/tools | 1 + tensorflow-requires.file | 1 + triton-inference-client.spec | 9 ++--- ucx.spec | 15 ++++---- 33 files changed, 181 insertions(+), 122 deletions(-) rename cmssw-patch-tool-conf.spec => cmssw-patch-tools.spec (67%) rename cmssw-tool-conf.spec => cmssw-tools.spec (93%) rename coral-tool-conf.spec => coral-tools.spec (82%) rename fwlite-tool-conf.spec => fwlite-tools.spec (85%) delete mode 100644 scram-tools.file/cmsdist_packages.py delete mode 100644 scram-tools.file/toolfile.file create mode 100644 scram/cmsdist_packages.py rename scram-tool-conf.file => scram/tool-conf-src.file (82%) create mode 100644 scram/toolfile-src.file create mode 120000 scram/tools diff --git a/bootstrap-bundle.spec b/bootstrap-bundle.spec index 39b293aa611..9ea484c360b 100644 --- a/bootstrap-bundle.spec +++ b/bootstrap-bundle.spec @@ -1,7 +1,6 @@ ### RPM external bootstrap-bundle 3.0 ## NO_AUTO_DEPENDENCY ## NOCOMPILER - BuildRequires: gcc BuildRequires: db6-bootstrap lua-bootstrap file-bootstrap BuildRequires: xz-bootstrap libarchive-bootstrap @@ -30,6 +29,7 @@ mkdir %{i}/share/misc cp ${FILE_BOOTSTRAP_ROOT}/share/misc/magic.mgc %{i}/share/misc/magic.mgc rm -f %{i}/bin/xml2-config %{i}/lib/xml2Conf.sh +%if 0%{!?use_system_gcc:1} #Bundle libstd and libgcc_s and libelf %ifos darwin cp -P $GCC_ROOT/lib/lib{stdc++,gcc_s}*.%{soname} %{i}/lib @@ -41,6 +41,7 @@ cp -P $GCC_ROOT/lib/libdw.%{soname}* %{i}/lib cp -P $GCC_ROOT/lib/libdw-*.%{soname} %{i}/lib cp -P $GCC_ROOT/bin/readelf %{i}/bin %endif +%endif find %{i}/bin -type f -writable -exec %{strip} {} \; # Do not strip archives, otherwise index of contents will be lost on newer binutils diff --git a/bootstrap-driver.spec b/bootstrap-driver.spec index 35cb6776a59..8fbc593ed31 100644 --- a/bootstrap-driver.spec +++ b/bootstrap-driver.spec @@ -55,6 +55,15 @@ platformSeeds+=" libaio" platformSeeds+=" libxcrypt perl-libs" %endif +platformSeeds+=" %{?rhel:libgcc}" +%if 0%{?fedora:1} +platformSeeds+=" libgcc libstdc++ elfutils-libelf libgfortran" +#Needed by millepede +platformSeeds+=" libgomp" +#Needed by gdb +platformSeeds+=" elfutils-debuginfod-client gmp mpfr" +%endif + defaultPkgs="cms+cms-common+1.0 cms+fakesystem+1.0" mkdir -p %{i}/etc/profile.d diff --git a/cmssw-patch-tool-conf.spec b/cmssw-patch-tools.spec similarity index 67% rename from cmssw-patch-tool-conf.spec rename to cmssw-patch-tools.spec index efc3f516f1d..1af342bc383 100644 --- a/cmssw-patch-tool-conf.spec +++ b/cmssw-patch-tools.spec @@ -1,4 +1,4 @@ -### RPM cms cmssw-patch-tool-conf 5.0 +### RPM cms cmssw-patch-tools 1.0 ## INSTALL_DEPENDENCIES cmsLHEtoEOSManager gcc-fixincludes @@ -6,4 +6,4 @@ Requires: cmssw ## INCLUDE cmssw-vectorization ## INCLUDE cmssw-drop-tools -## INCLUDE scram-tool-conf +## INCLUDE scram/tool-conf-src diff --git a/cmssw-tool-conf.spec b/cmssw-tools.spec similarity index 93% rename from cmssw-tool-conf.spec rename to cmssw-tools.spec index 1103f73a84d..50bd89cc145 100644 --- a/cmssw-tool-conf.spec +++ b/cmssw-tools.spec @@ -1,4 +1,4 @@ -### RPM cms cmssw-tool-conf 62.0 +### RPM cms cmssw-tools 1.0 # With cmsBuild, change the above version only when a new tool is added ## INSTALL_DEPENDENCIES cmsLHEtoEOSManager gcc-fixincludes cmssw-osenv cms-git-tools SCRAMV2 @@ -76,7 +76,6 @@ Requires: sherpa Requires: libpciaccess Requires: numactl Requires: hwloc -Requires: gdrcopy Requires: rdma-core Requires: ucx Requires: openmpi @@ -153,14 +152,9 @@ Requires: rivet %ifos linux Requires: openldap Requires: gperftools -Requires: cuda -Requires: cuda-compatible-runtime -Requires: alpaka - -%if "%{cmsos}" != "slc7_aarch64" -Requires: cudnn -%endif +%{!?without_cuda:Requires: cuda cuda-compatible-runtime gdrcopy cudnn} +Requires: alpaka Requires: libunwind %ifnarch ppc64le Requires: igprof @@ -175,8 +169,7 @@ Requires: oracle Requires: icc Requires: icx Requires: intel-vtune -Requires: rocm -Requires: rocm-rocrand +%{!?without_rocm:Requires: rocm rocm-rocrand} Requires: cmsmon-tools Requires: dip %else @@ -194,4 +187,4 @@ Requires: pytorch-custom-ops ## INCLUDE tfaot-models ## INCLUDE cmssw-vectorization ## INCLUDE cmssw-drop-tools -## INCLUDE scram-tool-conf +## INCLUDE scram/tool-conf-src diff --git a/coral-tool-conf.spec b/coral-tools.spec similarity index 82% rename from coral-tool-conf.spec rename to coral-tools.spec index 1aa024b47a2..40209bae59e 100644 --- a/coral-tool-conf.spec +++ b/coral-tools.spec @@ -1,4 +1,4 @@ -### RPM cms coral-tool-conf 10.0 +### RPM cms coral-tools 1.0 Requires: pcre Requires: python3 @@ -18,4 +18,4 @@ Requires: oracle %define skipreqtools jcompiler -## INCLUDE scram-tool-conf +## INCLUDE scram/tool-conf-src diff --git a/cpu_features.spec b/cpu_features.spec index adafaffdb04..dcc7fa2676f 100644 --- a/cpu_features.spec +++ b/cpu_features.spec @@ -1,4 +1,4 @@ -### RPM external cpu_features 0.7.0 +### RPM external cpu_features 0.9.0 Source: https://github.com/google/cpu_features/archive/refs/tags/v%{realversion}.tar.gz BuildRequires: gmake cmake diff --git a/fwlite-tool-conf.spec b/fwlite-tools.spec similarity index 85% rename from fwlite-tool-conf.spec rename to fwlite-tools.spec index b27578db480..afffbc5a513 100644 --- a/fwlite-tool-conf.spec +++ b/fwlite-tools.spec @@ -1,15 +1,12 @@ -### RPM cms fwlite-tool-conf 20.0 +### RPM cms fwlite-tools 1.0 # with cmsBuild, change the above version only when a new # tool is added ## INITENV SET CMSSW_TOOL_CONF_ROOT $FWLITE_TOOL_CONF_ROOT -%ifarch x86_64 -Requires: rocm -Requires: rocm-rocrand -%endif +%{!?without_rocm:Requires: rocm rocm-rocrand} +%{!?without_cuda:Requires: cuda cuda-compatible-runtime} + Requires: alpaka -Requires: cuda-compatible-runtime -Requires: cuda Requires: eigen Requires: fmt Requires: tbb @@ -62,4 +59,4 @@ Requires: freetype %endif ## INCLUDE cmssw-drop-tools -## INCLUDE scram-tool-conf +## INCLUDE scram/tool-conf-src diff --git a/hwloc.spec b/hwloc.spec index 9f6974f8904..40b416c87e5 100644 --- a/hwloc.spec +++ b/hwloc.spec @@ -2,14 +2,15 @@ Source: https://download.open-mpi.org/release/%{n}/v2.10/%{n}-%{realversion}.tar.bz2 BuildRequires: autotools -Requires: cuda libpciaccess libxml2 numactl -%ifarch x86_64 -Requires: rocm -%endif +Requires: libpciaccess libxml2 numactl +%{!?without_rocm:Requires: rocm} +%{!?without_cuda:Requires: cuda} + %prep %setup -n %{n}-%{realversion} +%build ./configure \ --prefix %{i} \ --enable-shared \ @@ -20,15 +21,10 @@ Requires: rocm --disable-cairo \ --disable-doxygen \ --disable-opencl \ - --with-cuda=$CUDA_ROOT \ - --enable-cuda \ - --enable-nvml \ -%ifarch x86_64 - --with-rocm=$ROCM_ROOT \ - --enable-rsmi \ - --enable-plugins=cuda,nvml,rsmi \ -%else - --enable-plugins=cuda,nvml \ + %{!?without_cuda:--with-cuda=$CUDA_ROOT --enable-cuda --enable-nvml} \ + %{!?without_rocm:--with-rocm=$ROCM_ROOT --enable-rsmi} \ +%if 0%{!?without_cuda:1}%{!?without_rocm:1} + --enable-plugins=$(echo %{!?without_cuda:cuda,nvml,}%{!?without_rocm:rsmi} | sed 's|,$||') \ %endif --with-pic \ --with-gnu-ld \ @@ -40,7 +36,6 @@ Requires: rocm HWLOC_NUMA_CFLAGS="-I$NUMACTL_ROOT/include" \ HWLOC_NUMA_LIBS="-L$NUMACTL_ROOT/lib -lnuma" -%build make %{makeprocesses} %install diff --git a/java-env.spec b/java-env.spec index 822bfbbfd62..805adc33109 100644 --- a/java-env.spec +++ b/java-env.spec @@ -1,10 +1,10 @@ -### RPM external java-env 1.1 +### RPM external java-env 11.0 ## INITENV SET JAVA_HOME %{java_home} ## INITENV +PATH PATH %{java_home}/bin ## INITENV +PATH LD_LIBRARY_PATH %{java_home}/lib ## NOCOMPILER -%if %{rhel} < 9 +%if 0%{?rhel} >= 9 # /usr/lib/jvm/java on EL8 contains java 1.8, and Bazel requires java 11 %define java_home /usr/lib/jvm/java-11 %else diff --git a/jemalloc-common.file b/jemalloc-common.file index a37a095b26c..6f1f342a6a6 100644 --- a/jemalloc-common.file +++ b/jemalloc-common.file @@ -7,7 +7,7 @@ BuildRequires: autotools gmake %if "%{n}" != "jemalloc" %ifarch x86_64 -%if "%{rhel}" == "7" +%if 0%{?rhel} == 7 BuildRequires: patchelf %endif %endif diff --git a/llvm.spec b/llvm.spec index 0aa8e47c3ea..c6ee072ff84 100644 --- a/llvm.spec +++ b/llvm.spec @@ -4,7 +4,7 @@ BuildRequires: cmake ninja Requires: gcc zlib python3 -Requires: cuda +%{!?without_cuda:Requires: cuda} %define llvmCommit 83204dfcd4277154e46a5c6094aee389a7f260e8 %define llvmBranch cms/release/17.x/afbe354 @@ -49,9 +49,11 @@ cmake %{_builddir}/llvm-%{realversion}-%{llvmCommit}/llvm \ -DLLVM_ENABLE_PIC:BOOL=ON \ -DLLVM_ENABLE_RTTI:BOOL=ON \ -DLLVM_HOST_TRIPLE=$(gcc -dumpmachine) \ - -DLLVM_TARGETS_TO_BUILD:STRING="X86;PowerPC;AArch64;NVPTX" \ + -DLLVM_TARGETS_TO_BUILD:STRING="X86;PowerPC;AArch64%{!?without_cuda:;NVPTX}" \ +%if 0%{!?without_cuda:1} -DLIBOMPTARGET_NVPTX_ALTERNATE_HOST_COMPILER=/usr/bin/gcc \ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="%omptarget_cuda_archs" \ +%endif -DCMAKE_REQUIRED_INCLUDES="${ZLIB_ROOT}/include" \ -DCMAKE_PREFIX_PATH="${ZLIB_ROOT}" diff --git a/onnxruntime.spec b/onnxruntime.spec index d0ee91f8124..ad489994fbd 100644 --- a/onnxruntime.spec +++ b/onnxruntime.spec @@ -7,10 +7,8 @@ Source: git+https://github.com/%{github_user}/%{n}.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz BuildRequires: cmake ninja -Requires: protobuf py3-numpy py3-wheel py3-onnx zlib libpng py3-pybind11 cuda re2 -%if "%{cmsos}" != "slc7_aarch64" -Requires: cudnn -%endif +Requires: protobuf py3-numpy py3-wheel py3-onnx zlib libpng py3-pybind11 re2 +%{!?without_cuda:Requires: cuda cudnn} %prep %setup -q -n %{n}-%{realversion} @@ -21,7 +19,7 @@ rm -rf ../build; mkdir ../build; cd ../build USE_CUDA=OFF %if "%{cmsos}" != "slc7_aarch64" if [ "%{cuda_gcc_support}" = "true" ] ; then -USE_CUDA=ON +USE_CUDA=%{!?without_cuda:ON} fi %endif @@ -33,9 +31,15 @@ cmake ../%{n}-%{realversion}/cmake -GNinja \ -Donnxruntime_ENABLE_PYTHON=ON \ -Donnxruntime_BUILD_SHARED_LIB=ON \ -Donnxruntime_USE_CUDA=${USE_CUDA} \ +%if 0%{!?without_cuda:1} -Donnxruntime_CUDA_HOME="${CUDA_ROOT}" \ -Donnxruntime_CUDNN_HOME="${CUDNN_ROOT}" \ -Donnxruntime_NVCC_THREADS=0 \ + -DCMAKE_CUDA_ARCHITECTURES=$(echo %{cuda_arch} | tr ' ' ';' | sed 's|;;*|;|') \ + -DCMAKE_CUDA_FLAGS="-cudart shared" \ + -DCMAKE_CUDA_RUNTIME_LIBRARY=Shared \ + -DCMAKE_TRY_COMPILE_PLATFORM_VARIABLES="CMAKE_CUDA_RUNTIME_LIBRARY" \ +%endif -Donnxruntime_BUILD_CSHARP=OFF \ -Donnxruntime_USE_OPENMP=OFF \ -Donnxruntime_USE_TVM=OFF \ @@ -48,10 +52,6 @@ cmake ../%{n}-%{realversion}/cmake -GNinja \ -Donnxruntime_DISABLE_CONTRIB_OPS=OFF \ -Donnxruntime_PREFER_SYSTEM_LIB=ON \ -Donnxruntime_BUILD_UNIT_TESTS=OFF \ - -DCMAKE_CUDA_ARCHITECTURES=$(echo %{cuda_arch} | tr ' ' ';' | sed 's|;;*|;|') \ - -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};${PY3_PYBIND11_ROOT};${RE2_ROOT}" \ -DRE2_INCLUDE_DIR="${RE2_ROOT}/include" \ -DCMAKE_CXX_FLAGS="-Wno-error=stringop-overflow -Wno-error=maybe-uninitialized" diff --git a/openmpi.spec b/openmpi.spec index d441b8b0173..51fb8b475fe 100644 --- a/openmpi.spec +++ b/openmpi.spec @@ -2,7 +2,7 @@ ## INITENV SET OPAL_PREFIX %{i} Source: https://download.open-mpi.org/release/open-mpi/v4.1/%{n}-%{realversion}.tar.bz2 BuildRequires: autotools -Requires: cuda +%{!?without_cuda:Requires: cuda} Requires: hwloc Requires: rdma-core Requires: xpmem @@ -31,7 +31,7 @@ Requires: zlib --disable-mpi-java \ --enable-openib-rdmacm-ibaddr \ --with-zlib=$ZLIB_ROOT \ - --with-cuda=$CUDA_ROOT \ + %{!?without_cuda:--with-cuda=$CUDA_ROOT} \ --with-hwloc=$HWLOC_ROOT \ --without-ofi \ --without-portals4 \ diff --git a/python_tools.spec b/python_tools.spec index 433db793d25..43440b2c9ac 100644 --- a/python_tools.spec +++ b/python_tools.spec @@ -174,7 +174,7 @@ Requires: py3-importlib-resources Requires: py3-smmap Requires: py3-zipp -Requires: py3-pycuda +%{!?without_cuda:Requires: py3-pycuda} Requires: py3-boost-histogram Requires: py3-hist diff --git a/pytorch-cluster.spec b/pytorch-cluster.spec index 26fbec0f3cc..cd2cec49d4b 100644 --- a/pytorch-cluster.spec +++ b/pytorch-cluster.spec @@ -8,7 +8,7 @@ Source: git+https://github.com/%{github_user}/pytorch_cluster.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz BuildRequires: cmake -Requires: pytorch cudnn +Requires: pytorch %define build_flags -Wall -Wextra -pedantic %{?arch_build_flags} %prep diff --git a/pytorch-scatter.spec b/pytorch-scatter.spec index 943d8f4df18..c79cb4aa513 100644 --- a/pytorch-scatter.spec +++ b/pytorch-scatter.spec @@ -8,7 +8,7 @@ Source: git+https://github.com/%{github_user}/pytorch_scatter.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz BuildRequires: cmake -Requires: pytorch cudnn +Requires: pytorch %define build_flags -Wall -Wextra -pedantic %{?arch_build_flags} %prep diff --git a/pytorch-sparse.spec b/pytorch-sparse.spec index cbef709381a..36b5f9bce0f 100644 --- a/pytorch-sparse.spec +++ b/pytorch-sparse.spec @@ -8,7 +8,7 @@ Source: git+https://github.com/%{github_user}/pytorch_sparse.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz BuildRequires: cmake -Requires: pytorch cudnn +Requires: pytorch %define build_flags -Wall -Wextra -pedantic %{?arch_build_flags} %prep diff --git a/pytorch.spec b/pytorch.spec index 86355beb903..db932b16071 100644 --- a/pytorch.spec +++ b/pytorch.spec @@ -16,7 +16,8 @@ Patch2: pytorch-system-fmt BuildRequires: cmake ninja Requires: eigen fxdiv numactl openmpi protobuf psimd python3 py3-PyYAML -Requires: cuda cudnn OpenBLAS zlib protobuf fmt py3-pybind11 +Requires: OpenBLAS zlib protobuf fmt py3-pybind11 +%{!?without_cuda:Requires: cuda cudnn} %prep %setup -n %{n}-%{realversion} @@ -32,7 +33,7 @@ source %{_sourcedir}/env USE_CUDA=OFF %if "%{cmsos}" != "slc7_aarch64" if [ "%{cuda_gcc_support}" = "true" ] ; then -USE_CUDA=ON +USE_CUDA=%{!?without_cuda:ON} fi %endif @@ -43,10 +44,12 @@ cmake ../%{n}-%{realversion} \ -DBUILD_TEST=OFF \ -DBUILD_BINARY=OFF \ -DBUILD_PYTHON=OFF \ +%if 0%{!?without_cuda:1} -DUSE_CUDA=${USE_CUDA} \ -DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \ -DCUDNN_INCLUDE_DIR=${CUDNN_ROOT}/include \ -DCUDNN_LIBRARY=${CUDNN_ROOT}/lib64/libcudnn.so \ +%endif -DUSE_NCCL=OFF \ -DUSE_FBGEMM=OFF \ -DUSE_KINETO=OFF \ diff --git a/rocm-rocrand.spec b/rocm-rocrand.spec index 835a947bba3..53a5c83adae 100644 --- a/rocm-rocrand.spec +++ b/rocm-rocrand.spec @@ -1,7 +1,7 @@ ### RPM external rocm-rocrand 5.6.1 ## NOCOMPILER -%if "%{rhel}" == "7" +%if 0%{?rhel} == 7 # allow rpm2cpio dependency on the bootstrap bundle %undefine drop_bootstrap_lib %define drop_bootstrap_lib true diff --git a/rocm.spec b/rocm.spec index 1668fe988f1..d95fea414db 100644 --- a/rocm.spec +++ b/rocm.spec @@ -1,6 +1,6 @@ ### RPM external rocm 5.6.1 -%if "%{rhel}" == "7" +%if 0%{?rhel} == 7 # allow rpm2cpio dependency on the bootstrap bundle %undefine drop_bootstrap_lib %define drop_bootstrap_lib true diff --git a/rpm-preamble.file b/rpm-preamble.file index edd4b3e7da1..dac5befe153 100644 --- a/rpm-preamble.file +++ b/rpm-preamble.file @@ -114,12 +114,8 @@ # Guess compiler version. "gccver" is defined by install.sh when # producing the spec file from the version of the gcc spec. %if "%cmscompiler" == "gcc" -%if "%{?use_system_gcc:set}" == "set" -%{expand:%%define cmscompilerv %(gcc --version | head -1 | cut -d' ' -f3 | cut -d. -f1,2,3 | tr -d .)} -%else %{expand:%%define cmscompilerv %(echo %gccver | cut -d. -f1,2,3 | tr -d .)} %endif -%endif %if "%cmscompiler" != "gcc" %{expand:%%define cmscompilerv %(echo %compilerRealVersion | cut -d. -f1,2 | tr -d .)} @@ -225,6 +221,7 @@ # Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment. %define AutoSetupDependencies \ +if [ "%{?auto_dependencies}" != "no" ] ; then \ if [ ! -e %i/etc/profile.d/dependencies-setup.sh ] ; then \ mkdir -p %i/etc/profile.d \ : > %i/etc/profile.d/dependencies-setup.sh \ @@ -240,6 +237,7 @@ mkdir -p %i/etc/profile.d \ done \ echo "fi" >> %i/etc/profile.d/dependencies-setup.sh \ touch %i/etc/profile.d/.autodependencies \ +fi \ fi #Relocate dependencies @@ -258,6 +256,7 @@ fi %define is_cmsarch() %(case %{cmsos} in (*_%{1}) echo 1 ;; (*) echo 0 ;; esac) %define is_ncmsarch() %(case %{cmsos} in (*_%{1}) echo 0 ;; (*) echo 1 ;; esac) +%if 0%{!?without_cuda:1} %define cuda_gcc_support $(\ if [ ! -f %{_tmppath}/cache/cuda_gcc_supported.txt ] ; then \ touch %{_builddir}/cuda_gcc_supported.cu &&\ @@ -266,6 +265,9 @@ fi if [ $(grep -i 'unsupported ' %{_builddir}/cuda_gcc_supported.log | wc -l) -gt 0 ] ; then echo false > %{_builddir}/cuda_gcc_supported.txt ; fi;\ mv %{_builddir}/cuda_gcc_supported.txt %{_tmppath}/cache/cuda_gcc_supported.txt ;\ fi; cat %{_tmppath}/cache/cuda_gcc_supported.txt) +%else +%define cuda_gcc_support false +%endif %define common_revision_script() \ OLD_REV=0 \ @@ -320,3 +322,10 @@ fi %else %define cmake_build_type Release %endif + +%ifnarch x86_64 +%{!?without_rocm:%define without_rocm 1} +%endif +%{?without_cuda:%{!?without_gdrcopy:%define without_gdrcopy 1}} +%{?without_cuda:%{!?without_cudnn:%define without_cudnn 1}} +%{?without_rocm:%{!?without_rocm_rocrand:%define without_rocm_rocrand 1}} diff --git a/rpm.spec b/rpm.spec index 3201dda6098..de48543269a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -41,12 +41,14 @@ USER_CXXFLAGS="-ggdb -O0" # On SLCx add $GCC_ROOT to various paths because that's where elflib is to be # found. Not required (and triggers a warning about missing include path) on # mac. +%if 0%{!?use_system_gcc:1} %ifos linux OS_CFLAGS="-I$GCC_ROOT/include" OS_CXXFLAGS="-I$GCC_ROOT/include" OS_CPPFLAGS="-I$GCC_ROOT/include" OS_LDFLAGS="-L$GCC_ROOT/lib" %endif +%endif perl -p -i -e's|-O2|-O0|' ./configure diff --git a/rust.spec b/rust.spec index e008f245153..14185974554 100644 --- a/rust.spec +++ b/rust.spec @@ -1,6 +1,8 @@ ### RPM external rust 1.78.0 %ifarch ppc64le %define build_arch powerpc64le-unknown-linux-gnu +%elifarch riscv64 +%define build_arch %{_arch}gc-unknown-linux-gnu %else %define build_arch %{_arch}-unknown-linux-gnu %endif @@ -30,7 +32,6 @@ rm -rf %{i}/share rm -f %{i}/lib/rustlib/install.log %post -%{relocateConfig}lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu +%{relocateConfig}lib/rustlib/manifest-rust-std-%{build_arch} %{relocateConfig}lib/rustlib/manifest-cargo %{relocateConfig}lib/rustlib/manifest-rustc - diff --git a/scram-tools.file/cmsdist_packages.py b/scram-tools.file/cmsdist_packages.py deleted file mode 100644 index 2d35cdaf332..00000000000 --- a/scram-tools.file/cmsdist_packages.py +++ /dev/null @@ -1,8 +0,0 @@ -def packages(virtual_packages, *args): - from os.path import dirname, join, basename - from glob import glob - tools_dir = join(dirname(__file__), "tools") - for tool in [basename(t) for t in glob(tools_dir+"/*")]: - spec = "%s-toolfile" % tool - virtual_packages[spec] = 'echo -e "### RPM cms %s 1.0\nRequires: %s\n## INCLUDE scram-tools.file/toolfile"' % (spec, tool) - return diff --git a/scram-tools.file/toolfile.file b/scram-tools.file/toolfile.file deleted file mode 100644 index 5aea38a3187..00000000000 --- a/scram-tools.file/toolfile.file +++ /dev/null @@ -1,25 +0,0 @@ -## NOCOMPILER -## NO_AUTO_RUNPATH -## NO_AUTO_DEPENDENCY -## INCLUDE toolflags - -Source: scram-tools -%define tool %(echo %{n} | sed 's|-toolfile$||') -%define uctool %(echo %{tool} | tr '[a-z-]' '[A-Z_]') - -%prep - -%build - -%install -## INCLUDE scram-tools.file/tool-env -%{cmsdist_directory}/scram-tools.file/bin/get_tools "${%{uctool}_ROOT}" "${%{uctool}_VERSION}" %i "%{tool}" -mkdir %{i}/etc -mv %{i}/tools/selected %{i}/etc/scram.d -rm -rf %{i}/tools - -%post -if [ "X$CMS_INSTALL_PREFIX" = "X" ] ; then CMS_INSTALL_PREFIX=$RPM_INSTALL_PREFIX; export CMS_INSTALL_PREFIX; fi -%{relocateConfig}etc/scram.d/*.xml -echo "%{uctool}_TOOLFILE_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh -echo "set %{uctool}_TOOLFILE_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh diff --git a/scram-tools.file/tools/hwloc/hwloc.xml b/scram-tools.file/tools/hwloc/hwloc.xml index 373813dec69..f94e1c8abf2 100644 --- a/scram-tools.file/tools/hwloc/hwloc.xml +++ b/scram-tools.file/tools/hwloc/hwloc.xml @@ -6,5 +6,7 @@ +%if 0%{!?without_cuda:1}%{!?without_rocm:1} +%endif diff --git a/scram/cmsdist_packages.py b/scram/cmsdist_packages.py new file mode 100644 index 00000000000..c678af4f329 --- /dev/null +++ b/scram/cmsdist_packages.py @@ -0,0 +1,27 @@ +SCRAM_PROJECT = ["coral", "cmssw", "cmssw-patch", "fwlite"] + +def packages(virtual_packages, *args): + from os.path import dirname, join, basename + from glob import glob + tools_dir = join(dirname(__file__), "tools") + for tool in [basename(t) for t in glob(tools_dir+"/*")]: + pkg = "%s-toolfile-src" % tool + spec = ["### RPM cms %s 1.0" % pkg] + spec.append("BuildRequires: %s" % tool) + spec.append("## INCLUDE scram/toolfile-src") + virtual_packages[pkg] = spec[:] + pkg = "%s-toolfile" % tool + spec = ["### RPM cms %s 1.0" % pkg] + spec.append("BuildRequires: %s-src" % pkg) + spec.append("Requires: %s" % tool) + spec.append("## INCLUDE scram/toolfile") + virtual_packages[pkg] = spec[:] + + for tool in SCRAM_PROJECT: + pkg = "%s-tool-conf" % tool + spec = ["### RPM cms %s 100.0" % pkg] + spec.append("Requires: %s-tools" % tool) + spec.append("## INCLUDE scram/tool-conf") + virtual_packages[pkg] = spec[:] + + return diff --git a/scram-tool-conf.file b/scram/tool-conf-src.file similarity index 82% rename from scram-tool-conf.file rename to scram/tool-conf-src.file index 747eb604f29..6e178130ac6 100644 --- a/scram-tool-conf.file +++ b/scram/tool-conf-src.file @@ -1,10 +1,11 @@ -### FILE scram-tool-conf +### FILE scram-tool-conf-src ## NOCOMPILER ## NO_AUTO_RUNPATH ## NO_AUTO_DEPENDENCY ## INCLUDE toolflags ## INCLUDE microarch_flags - +%define auto_dependencies no +%define uctool %(echo %{n} | tr '[a-z-]' '[A-Z_]') BuildRequires: SCRAMV1 Source99: scram-tools Source: none @@ -139,10 +140,24 @@ if [ -e %{i}/tools/selected/cuda-gcc-support.xml ] ; then echo "WARNING: CUDA does not support this GCC version, removing cuda-gcc-support.xml tool file" fi fi -[ -d %{i}/tools/selected ] && chmod a+r -R %{i}/tools/selected -[ -d %{i}/tools/available ] && chmod a+r -R %i/tools/available -%post +mkdir -p %{i}/tools +for type in selected available ; do + rm -f %{i}/tools/${type}.tmpl + touch %{i}/tools/${type}.tmpl + [ -d %{i}/tools/${type} ] || continue + for xml in $(ls %{i}/tools/${type}/*.xml) ; do + tool=$(basename $xml) + echo "cat << \\EOF_TOOLFILE >> %%{i}/tools/${type}/${tool}" >> %{i}/tools/${type}.tmpl + cat $xml >> %{i}/tools/${type}.tmpl + echo "EOF_TOOLFILE" >> %{i}/tools/${type}.tmpl + echo "" >> %{i}/tools/${type}.tmpl + done + rm -rf %{i}/tools/${type} +done -%{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/tools -type f) -%{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/lib -type f) +%post +echo "%{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh +echo "set %{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh +[ -d $RPM_INSTALL_PREFIX/%{pkgrel}/tools ] && %{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/tools -type f) +[ -d $RPM_INSTALL_PREFIX/%{pkgrel}/lib ] && %{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/lib -type f) diff --git a/scram/toolfile-src.file b/scram/toolfile-src.file new file mode 100644 index 00000000000..a5a047f8695 --- /dev/null +++ b/scram/toolfile-src.file @@ -0,0 +1,34 @@ +## NOCOMPILER +## NO_AUTO_RUNPATH +## NO_AUTO_DEPENDENCY +## INCLUDE toolflags + +Source: scram-tools +%define tool %(echo %{n} | sed 's|-toolfile-src$||') +%define uctool %(echo %{tool} | tr '[a-z-]' '[A-Z_]') + +%prep + +%build + +%install +## INCLUDE scram-tools.file/tool-env +%{cmsdist_directory}/scram-tools.file/bin/get_tools "${%{uctool}_ROOT}" "${%{uctool}_VERSION}" %{i} "%{tool}" +tmpl=%{i}/tools.tmpl +rm -f ${tmpl} +touch ${tmpl} +if [ -d %{i}/tools/selected ] ; then + for xml in $(ls %{i}/tools/selected/*.xml) ; do + tool=$(basename $xml) + echo "cat << \\EOF_TOOLFILE >> %%{i}/etc/scram.d/${tool}" >> ${tmpl} + cat $xml >> ${tmpl} + echo "EOF_TOOLFILE" >> ${tmpl} + echo "" >> ${tmpl} + done +fi + +%post +if [ "X$CMS_INSTALL_PREFIX" = "X" ] ; then CMS_INSTALL_PREFIX=$RPM_INSTALL_PREFIX; export CMS_INSTALL_PREFIX; fi +%{relocateConfig}tools.tmpl +echo "%{uctool}_TOOLFILE_SRC_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh +echo "set %{uctool}_TOOLFILE_SRC_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh diff --git a/scram/tools b/scram/tools new file mode 120000 index 00000000000..2c9873135eb --- /dev/null +++ b/scram/tools @@ -0,0 +1 @@ +../scram-tools.file/tools \ No newline at end of file diff --git a/tensorflow-requires.file b/tensorflow-requires.file index e51d91e6e41..0dfc3c470dd 100644 --- a/tensorflow-requires.file +++ b/tensorflow-requires.file @@ -5,6 +5,7 @@ Requires: py3-opt-einsum py3-flatbuffers Requires: eigen protobuf zlib libpng libjpeg-turbo curl giflib sqlite grpc flatbuffers py3-pybind11 BuildRequires: py3-wheel %define enable_gpu 0 +%{?without_cuda:%define enable_gpu 0} %if %{enable_gpu} %if "%{cmsos}" != "slc7_aarch64" ## INCLUDE cuda-flags diff --git a/triton-inference-client.spec b/triton-inference-client.spec index 38d3d293976..ac06e2cce17 100644 --- a/triton-inference-client.spec +++ b/triton-inference-client.spec @@ -9,8 +9,9 @@ Source0: git+https://github.com/%{github_user}/client.git?obj=%{branch}/%{client_tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz Source1: git+https://github.com/%{github_user}/common.git?obj=%{branch}/%{common_tag}&export=common-%{realversion}&output=/common-%{realversion}.tgz BuildRequires: cmake git py3-wheel -Requires: protobuf grpc cuda abseil-cpp re2 rapidjson +Requires: protobuf grpc abseil-cpp re2 rapidjson Requires: py3-numpy py3-grpcio-tools py3-python-rapidjson +%{!?without_cuda:Requires: cuda} %prep @@ -34,11 +35,7 @@ CML_COM=${COMMON_DIR}/CMakeLists.txt # get shared libraries sed -i '/^project/a option(BUILD_SHARED_LIBS "Build using shared libraries" ON)' ${CML_COM} -if [ "%{cuda_gcc_support}" = "true" ] ; then - TRITON_ENABLE_GPU_VALUE=ON -else - TRITON_ENABLE_GPU_VALUE=OFF -fi +TRITON_ENABLE_GPU_VALUE=%{?without_cuda:ON}%{!?without_cuda:OFF} cmake ${PROJ_DIR} \ -DCMAKE_INSTALL_PREFIX="%{i}" \ diff --git a/ucx.spec b/ucx.spec index 427e61820d3..47f564e2b25 100644 --- a/ucx.spec +++ b/ucx.spec @@ -1,12 +1,10 @@ ### RPM external ucx 1.15.0 Source: https://github.com/openucx/%{n}/archive/refs/tags/v%{realversion}.tar.gz BuildRequires: autotools -Requires: cuda gdrcopy +%{!?without_cuda:Requires: cuda gdrcopy} Requires: numactl Requires: rdma-core -%ifarch x86_64 -Requires: rocm -%endif +%{!?without_rocm:Requires: rocm} Requires: xpmem %prep @@ -35,13 +33,18 @@ Requires: xpmem --with-sse42 \ --without-go \ --without-java \ +%if 0%{!?without_cuda:1} --with-cuda=$CUDA_ROOT \ -%ifarch x86_64 + --with-gdrcopy=$GDRCOPY_ROOT \ +%else + --without-cuda \ + --without-gdrcopy \ +%endif +%if 0%{!?without_rocm:1} --with-rocm=$ROCM_ROOT \ %else --without-rocm \ %endif - --with-gdrcopy=$GDRCOPY_ROOT \ --with-verbs=$RDMA_CORE_ROOT \ --with-rc \ --with-ud \ From 6a36618cc31540695383e45442e6b65c4b3a3910 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 3 Jun 2024 09:09:44 +0200 Subject: [PATCH 2/6] added missing tool files --- scram/tool-conf.file | 18 ++++++++++++++++++ scram/toolfile.file | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 scram/tool-conf.file create mode 100644 scram/toolfile.file diff --git a/scram/tool-conf.file b/scram/tool-conf.file new file mode 100644 index 00000000000..62d91126f7d --- /dev/null +++ b/scram/tool-conf.file @@ -0,0 +1,18 @@ +## NOCOMPILER +%define auto_dependencies no +%define uctool %(echo %{n} | tr '[a-z-]' '[A-Z_]') +%prep +%build +%install +mkdir -p %{i}/tools/selected %{i}/tools/available +if [ -d %{cmsroot}/%{cmsplatf}/%{directpkgreqs}/lib ] ; then + cp -r %{cmsroot}/%{cmsplatf}/%{directpkgreqs}/lib %{i}/lib +fi +%{expand:%(cat %{cmsroot}/%{cmsplatf}/%{directpkgreqs}/tools/selected.tmpl)} +%{expand:%(cat %{cmsroot}/%{cmsplatf}/%{directpkgreqs}/tools/available.tmpl)} + +%post +echo "%{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh +echo "set %{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh +[ -d $RPM_INSTALL_PREFIX/%{pkgrel}/tools ] && %{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/tools -type f) +[ -d $RPM_INSTALL_PREFIX/%{pkgrel}/lib ] && %{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/lib -type f) diff --git a/scram/toolfile.file b/scram/toolfile.file new file mode 100644 index 00000000000..bd23cb36c69 --- /dev/null +++ b/scram/toolfile.file @@ -0,0 +1,13 @@ +## NOCOMPILER +%define auto_dependencies no +%define uctool %(echo %{n} | tr '[a-z-]' '[A-Z_]') +%prep +%build +%install +mkdir -p %{i}/etc/scram.d +%{expand:%(cat %{cmsroot}/%{cmsplatf}/%{buildpkgreqs}/tools.tmpl)} + +%post +echo "%{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh +echo "set %{uctool}_ROOT='$CMS_INSTALL_PREFIX/%{pkgrel}'" > $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.csh +%{relocateCmsFiles} $(find $RPM_INSTALL_PREFIX/%{pkgrel}/etc/scram.d -type f) From 2dfa825fd57ba0ef0fbfe73ad33bab8326290b20 Mon Sep 17 00:00:00 2001 From: Malik Shahzad Muzaffar Date: Mon, 3 Jun 2024 14:34:40 +0200 Subject: [PATCH 3/6] Update java-env.spec --- java-env.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java-env.spec b/java-env.spec index 805adc33109..c4b703938aa 100644 --- a/java-env.spec +++ b/java-env.spec @@ -4,11 +4,12 @@ ## INITENV +PATH LD_LIBRARY_PATH %{java_home}/lib ## NOCOMPILER -%if 0%{?rhel} >= 9 +%define java_home /usr/lib/jvm/java +%if %{?rhel:1} +%if 0%{?rhel} < 9 # /usr/lib/jvm/java on EL8 contains java 1.8, and Bazel requires java 11 %define java_home /usr/lib/jvm/java-11 -%else -%define java_home /usr/lib/jvm/java +%endif %endif Source: none From 90ca1ebf5bb498a0008533b590fc0d1a96618665 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Tue, 4 Jun 2024 06:30:52 +0200 Subject: [PATCH 4/6] typo: fix triton-inference-client GPU support flag --- onnxruntime.spec | 4 +--- triton-inference-client.spec | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/onnxruntime.spec b/onnxruntime.spec index ad489994fbd..74b53213dad 100644 --- a/onnxruntime.spec +++ b/onnxruntime.spec @@ -17,11 +17,9 @@ Requires: protobuf py3-numpy py3-wheel py3-onnx zlib libpng py3-pybind11 re2 rm -rf ../build; mkdir ../build; cd ../build USE_CUDA=OFF -%if "%{cmsos}" != "slc7_aarch64" if [ "%{cuda_gcc_support}" = "true" ] ; then -USE_CUDA=%{!?without_cuda:ON} + USE_CUDA=ON fi -%endif cmake ../%{n}-%{realversion}/cmake -GNinja \ -DPYTHON_EXECUTABLE=${PYTHON3_ROOT}/bin/python3 \ diff --git a/triton-inference-client.spec b/triton-inference-client.spec index ac06e2cce17..d1e53a4d58b 100644 --- a/triton-inference-client.spec +++ b/triton-inference-client.spec @@ -35,7 +35,7 @@ CML_COM=${COMMON_DIR}/CMakeLists.txt # get shared libraries sed -i '/^project/a option(BUILD_SHARED_LIBS "Build using shared libraries" ON)' ${CML_COM} -TRITON_ENABLE_GPU_VALUE=%{?without_cuda:ON}%{!?without_cuda:OFF} +TRITON_ENABLE_GPU_VALUE=%{?without_cuda:OFF}%{!?without_cuda:ON} cmake ${PROJ_DIR} \ -DCMAKE_INSTALL_PREFIX="%{i}" \ From b0fa63f582d0730da66ef0e496404ccfda0fe9f2 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 5 Jun 2024 16:52:25 +0200 Subject: [PATCH 5/6] typo --- java-env.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-env.spec b/java-env.spec index c4b703938aa..2a18620a49d 100644 --- a/java-env.spec +++ b/java-env.spec @@ -5,7 +5,7 @@ ## NOCOMPILER %define java_home /usr/lib/jvm/java -%if %{?rhel:1} +%if 0%{?rhel:1} %if 0%{?rhel} < 9 # /usr/lib/jvm/java on EL8 contains java 1.8, and Bazel requires java 11 %define java_home /usr/lib/jvm/java-11 From 6f832d216f5d3c784dba32d906646ab2afd1b61e Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 5 Jun 2024 16:53:53 +0200 Subject: [PATCH 6/6] added back NVPTX --- llvm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm.spec b/llvm.spec index c6ee072ff84..6a2142dc226 100644 --- a/llvm.spec +++ b/llvm.spec @@ -49,7 +49,7 @@ cmake %{_builddir}/llvm-%{realversion}-%{llvmCommit}/llvm \ -DLLVM_ENABLE_PIC:BOOL=ON \ -DLLVM_ENABLE_RTTI:BOOL=ON \ -DLLVM_HOST_TRIPLE=$(gcc -dumpmachine) \ - -DLLVM_TARGETS_TO_BUILD:STRING="X86;PowerPC;AArch64%{!?without_cuda:;NVPTX}" \ + -DLLVM_TARGETS_TO_BUILD:STRING="X86;PowerPC;AArch64;NVPTX" \ %if 0%{!?without_cuda:1} -DLIBOMPTARGET_NVPTX_ALTERNATE_HOST_COMPILER=/usr/bin/gcc \ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="%omptarget_cuda_archs" \