Skip to content

Instantly share code, notes, and snippets.

@briansp2020
Created February 20, 2025 20:33
Show Gist options
  • Save briansp2020/889deca630b9266d82b3a8523e6bfa25 to your computer and use it in GitHub Desktop.
Save briansp2020/889deca630b9266d82b3a8523e6bfa25 to your computer and use it in GitHub Desktop.
Script to build ROCm TF
#/bin/sh
cd
export HSA_OVERRIDE_GFX_VERSION=11.0.0
export PYTORCH_ROCM_ARCH="gfx1100"
export HIP_VISIBLE_DEVICES=0
export ROCM_PATH=/opt/rocm-6.3.2
echo "export HSA_OVERRIDE_GFX_VERSION=11.0.0" | tee --append .bashrc
echo "export PYTORCH_ROCM_ARCH=\"gfx1100\"" | tee --append .bashrc
echo "export HIP_VISIBLE_DEVICES=0" | tee --append .bashrc
echo "export ROCM_PATH=/opt/rocm-6.3.2" | tee --append .bashrc
python3 -m venv tf
source ~/tf/bin/activate
# install bazel 6.5
apt install apt-transport-https curl gnupg -y
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
apt update && apt install -y bazel-6.5.0
ln -s /usr/bin/bazel-6.5.0 /usr/bin/bazel
apt install rocm-dev patchelf libboost-filesystem-dev -y
# Install updated rocPRIM
#cd ~
#git clone https://github.com/briansp2020/rocPRIM
#cd rocPRIM; mkdir build; cd build
#CXX=hipcc cmake -DBUILD_BENCHMARK=ON ../.
#make -j $(nproc)
#make install
# Build Tensorflow 2.17
cd ~
git clone https://github.com/ROCmSoftwarePlatform/tensorflow-upstream
cd tensorflow-upstream
git checkout r2.17-rocm-enhanced
#sed -i 's/"gfx1030" /"gfx1030",/g' tensorflow/compiler/xla/stream_executor/device_description.h
#sed -i 's/"--local_ram_resources=60000 --local_cpu_resources=35 --jobs=70"/"--local_ram_resources=30000 --local_cpu_resources=24 --jobs=16"/g' build_rocm_python3
#sed -i 's/6\.0\.0/6.0.2/g' build_rocm_python3
#sed -i 's/\/opt\/rocm\//\/opt\/rocm-6.3.2\//g' build_rocm_python3
./build_rocm_python3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment