Skip to content

Commit

Permalink
Merge pull request #8371 from fwyzard/IB/CMSSW_13_0_X/master_repackag…
Browse files Browse the repository at this point in the history
…e_rocm

Package the HIP/ROCm and ROCrand libraries [13.0.x]
  • Loading branch information
cmsbuild authored Mar 22, 2023
2 parents 0520c9b + 599353a commit 7222c29
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 84 deletions.
3 changes: 2 additions & 1 deletion cmssw-tool-conf.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### RPM cms cmssw-tool-conf 53.0
### RPM cms cmssw-tool-conf 53.1
# With cmsBuild, change the above version only when a new tool is added

## INSTALL_DEPENDENCIES cmsLHEtoEOSManager gcc-fixincludes cmssw-osenv cms-git-tools SCRAMV2
Expand Down Expand Up @@ -163,6 +163,7 @@ Requires: icc
Requires: icx
Requires: intel-vtune
Requires: rocm
Requires: rocm-rocrand
Requires: cmsmon-tools
Requires: dip
%else
Expand Down
19 changes: 15 additions & 4 deletions fakesystem.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### RPM cms fakesystem 1.0
## REVISION 1012
## REVISION 1013
## NOCOMPILER
## NO_VERSION_SUFFIX

Expand Down Expand Up @@ -103,10 +103,21 @@ Provides: perl(File::stat)
Provides: perl(Time::localtime)
Provides: perl(sort)

#####
# ROCM
#####
#################################
# Needed by ROCm
#################################
Provides: libamdhip64.so.5(hip_5.3)(64bit)
Provides: libdrm.so.2()(64bit)
Provides: libdrm_amdgpu.so.1()(64bit)
Provides: perl(File::Which)
Provides: perl(URI::Encode)

#################################
# Needed by ROCm on EL9
#################################
Provides: perl(FindBin)
Provides: perl(Hash::Util)
Provides: perl(Sys::Hostname)

Provides: /bin/csh
Provides: /bin/tcsh
Expand Down
29 changes: 29 additions & 0 deletions rocm-rocrand.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### RPM external rocm-rocrand 5.4.3
## NOCOMPILER

%if "%{rhel}" == "7"
# allow rpm2cpio dependency on the bootstrap bundle
%undefine drop_bootstrap_lib
%define drop_bootstrap_lib true
%define repository repo.radeon.com/rocm/yum
%else
%define repository repo.radeon.com/rocm/rhel%{rhel}
%endif

Source0: https://%{repository}/%{realversion}/main/rocrand-2.10.9.50403-121.el%{rhel}.%{_arch}.rpm
Source1: https://%{repository}/%{realversion}/main/rocrand-devel-2.10.9.50403-121.el%{rhel}.%{_arch}.rpm
Requires: rocm

%prep

%build
rpm2cpio %{SOURCE0} | cpio -idmv
rpm2cpio %{SOURCE1} | cpio -idmv

%install
rmdir %{i}
mv opt/rocm-%{realversion} %{i}
rm -rf opt
rm -rf usr

%post
138 changes: 68 additions & 70 deletions rocm.spec
Original file line number Diff line number Diff line change
@@ -1,79 +1,77 @@
### RPM external rocm 5.4.3
## NOCOMPILER
Source: none
Provides: libamd_comgr.so.2()(64bit)
Provides: libhsa-runtime64.so.1()(64bit)
Provides: librocm-core.so.1()(64bit)
Provides: librocm_smi64.so.5()(64bit)
Provides: libamdhip64.so.5()(64bit)
Provides: libamdhip64.so.5(hip_4.2)(64bit)

# This rpm packages only symlinks to an installation that is already on CVMFS.
# Configure pkgtools to keep the static libraries, to avoid actually trying to
# delete them from CVMFS.
%define keep_archives true
%if "%{rhel}" == "7"
# allow rpm2cpio dependency on the bootstrap bundle
%undefine drop_bootstrap_lib
%define drop_bootstrap_lib true
%define repository repo.radeon.com/rocm/yum
%else
%define repository repo.radeon.com/rocm/rhel%{rhel}
%endif

Source0: https://%{repository}/%{realversion}/main/comgr-2.4.0.50403-121.el%{rhel}.%{_arch}.rpm
Source1: https://%{repository}/%{realversion}/main/hip-devel-5.4.22804.50403-121.el%{rhel}.%{_arch}.rpm
Source2: https://%{repository}/%{realversion}/main/hip-runtime-amd-5.4.22804.50403-121.el%{rhel}.%{_arch}.rpm
Source3: https://%{repository}/%{realversion}/main/hsa-rocr-1.7.0.50403-121.el%{rhel}.%{_arch}.rpm
Source4: https://%{repository}/%{realversion}/main/rocm-core-5.4.3.50403-121.el%{rhel}.%{_arch}.rpm
Source5: https://%{repository}/%{realversion}/main/rocm-dbgapi-0.68.0.50403-121.el%{rhel}.%{_arch}.rpm
Source6: https://%{repository}/%{realversion}/main/rocm-device-libs-1.0.0.50403-121.el%{rhel}.%{_arch}.rpm
Source7: https://%{repository}/%{realversion}/main/rocm-llvm-15.0.0.23045.50403-121.el%{rhel}.%{_arch}.rpm
Source8: https://%{repository}/%{realversion}/main/rocm-smi-lib-5.0.0.50403-121.el%{rhel}.%{_arch}.rpm
Source9: https://%{repository}/%{realversion}/main/rocminfo-1.0.0.50403-121.el%{rhel}.%{_arch}.rpm
Requires: numactl
Requires: python3

%prep

%build
rpm2cpio %{SOURCE0} | cpio -idmv
rpm2cpio %{SOURCE1} | cpio -idmv
rpm2cpio %{SOURCE2} | cpio -idmv
rpm2cpio %{SOURCE3} | cpio -idmv
rpm2cpio %{SOURCE4} | cpio -idmv
rpm2cpio %{SOURCE5} | cpio -idmv
rpm2cpio %{SOURCE6} | cpio -idmv
rpm2cpio %{SOURCE7} | cpio -idmv
rpm2cpio %{SOURCE8} | cpio -idmv
rpm2cpio %{SOURCE9} | cpio -idmv

%install
OSDIR=/cvmfs/patatrack.cern.ch/externals/%{_arch}/rhel%{rhel}
if ! [ -d $OSDIR ]; then
OSDIR=/cvmfs/patatrack.cern.ch/externals/%{_arch}/unknown
fi
BASEDIR=${OSDIR}/amd/%{n}-%{realversion}

# Symlink individual files from ${BASEDIR}/bin/
mkdir %{i}/bin
test -d ${BASEDIR}/bin
test -e ${BASEDIR}/bin/hipcc
ln -s ${BASEDIR}/bin/* %{i}/bin/
# Remove the OpenCL extra files
rm -f %{i}/bin/{clang-ocl,clinfo}
# Remove the OpenMP extra files
rm -f %{i}/bin/{aompcc,mygpu,mymcpu}
# Remove the Fortran files
rm -f %{i}/bin/hipfc
# Remove the MI tools
rm -f %{i}/bin/{MIOpenDriver,migraphx-driver,runvx}
# Remove the datacenter tools and validation suite binaries
rm -f %{i}/bin/{rdcd,rdci,rvs}
# Remove some of the prebuilt samples
rm -f %{i}/bin/{sgemmv,simple_dlrm,simple_gemm}

# ROCm/HIP core tools
DIRECTORIES="amdgcn hip hsa hsa-amd-aqlprofile include lib libexec llvm share"

# rocm-smi
DIRECTORIES+=" oam rocm_smi"

# ROCm Tracer Callback/Activity Library (rocTRACER) and profiler library (ROC-profiler)
DIRECTORIES+=" rocprofiler roctracer"

# Asynchronous Task and Memory Interface (ATMI)
#DIRECTORIES+=" atmi"

# OpenCL support
#DIRECTORIES+=" opencl tests"

# ROCm Communication Collectives Library (RCCL)
#DIRECTORIES+=" rccl"

# Machine Intelligence Libraries
#DIRECTORIES+=" miopen miopengemm"

# HIP Fortran interface (hipfort)
#DIRECTORIES+=" hipfort"

# ROCm Data Center Tool (RDC)
#DIRECTORIES+=" rdc"

# ROCm Validation Suite (RVS)
#DIRECTORIES+=" rvs"

# symlink the other directories from ${BASEDIR}/
for D in ${DIRECTORIES}; do
ln -s ${BASEDIR}/${D} %{i}/
test -L %{i}/${D}
done
rmdir %{i}
mv opt/rocm-%{realversion} %{i}
rm -rf opt
rm -rf usr

# the hip directory is deprecated in favour of the main directory
rm -r -f %{i}/hip/

# hip-devel postinstall
ln -s -f amd_detail %{i}/include/hip/hcc_detail
ln -s -f nvidia_detail %{i}/include/hip/nvcc_detail
# deprecated
#ln -s -f amd_detail %{i}/hip/include/hip/hcc_detail
#ln -s -f nvidia_detail %{i}/hip/include/hip/nvcc_detail

# hip-runtime-amd postinstall
# deprecated
#mkdir -p %{i}/hip/lib/cmake/hip
#mkdir -p %{i}/hip/lib/cmake/hip-lang
#ln -r -s -f %{i}/lib/cmake/hip/hip-targets* %{i}/hip/lib/cmake/hip/
#ln -r -s -f %{i}/lib/cmake/hip-lang/hip-lang-targets* %{i}/hip/lib/cmake/hip-lang/

# rocm-llvm postinstall
mkdir -p %{i}/bin
ln -r -s -f %{i}/llvm/bin/amdclang %{i}/bin/
ln -r -s -f %{i}/llvm/bin/amdclang++ %{i}/bin/
ln -r -s -f %{i}/llvm/bin/amdclang-cl %{i}/bin/
ln -r -s -f %{i}/llvm/bin/amdclang-cpp %{i}/bin/
ln -r -s -f %{i}/llvm/bin/amdflang %{i}/bin/
ln -r -s -f %{i}/llvm/bin/amdlld %{i}/bin/

# replace '/usr/libexec/platform-python' with '/usr/bin/env python3'
find %{i}/bin/ %{i}/libexec/ %{i}/llvm/bin/ %{i}/llvm/lib/ -type f | xargs -r \
grep '#! */usr/libexec/platform-python' -l | xargs -r \
sed -e'1 s|#! */usr/libexec/platform-python|#!/usr/bin/env python3|' -s -i

%post
1 change: 1 addition & 0 deletions scram-tools.file/tools/alpaka/alpaka-rocm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<tool name="alpaka-rocm" version="@TOOL_VERSION@">
<use name="alpaka"/>
<use name="rocm"/>
<use name="rocm-rocrand"/>
<!-- host comiplation should run with ALPAKA_HOST_ONLY defined -->
<flags CXXFLAGS="-DALPAKA_ACC_GPU_HIP_ENABLED -DALPAKA_HOST_ONLY"/>
<flags GENREFLEX_CPPFLAGS="-DALPAKA_ACC_GPU_HIP_ENABLED -DALPAKA_HOST_ONLY"/>
Expand Down
14 changes: 14 additions & 0 deletions scram-tools.file/tools/rocm-rocrand/rocm-rocrand.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<tool name="rocm-rocrand" version="@TOOL_VERSION@">
<info url="https://github.com/ROCmSoftwarePlatform/rocRAND"/>
<use name="rocm"/>
<lib name="hiprand"/>
<lib name="rocrand"/>
<client>
<environment name="ROCM_ROCRAND_BASE" default="@TOOL_ROOT@"/>
<environment name="LIBDIR" default="$ROCM_ROCRAND_BASE/lib"/>
<environment name="INCLUDE" default="$ROCM_ROCRAND_BASE/include"/>
</client>
<!-- use -isystem instead of -I to silence warnings in the HIP/ROCm headers -->
<flags SYSTEM_INCLUDE="1"/>
<runtime name="ROOT_INCLUDE_PATH" value="$INCLUDE" type="path" join="1"/>
</tool>
9 changes: 0 additions & 9 deletions scram-tools.file/tools/rocm/rocm-rocrand.xml

This file was deleted.

0 comments on commit 7222c29

Please sign in to comment.