Skip to content

Commit

Permalink
Convert gsplat cuda code to hip
Browse files Browse the repository at this point in the history
  • Loading branch information
pfxuan committed Mar 3, 2024
1 parent 39f8c81 commit 8663630
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,53 @@ jobs:
os: [ubuntu-22.04] # [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
arch: [x64] # [x64, x86]
torch-version: [2.2.1] # [1.12.0, 1.13.0, 2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1]
cuda-version: [12.1.1] # [12.3.1, 12.1.1, 11.8.0, 11.7.1, 11.6.2, 11.5.2,11.4.4, 11.3.1, 11.2.2, 11.1.1, 11.0.3, cpu]
rocm-version: [5.7.3] # [5.4.2, 5.6.1, 5.7.3, 6.0.1, 6.0.2]
cuda-version: [11.8.0] # [12.3.1, 12.1.1, 11.8.0, 11.7.1, 11.6.2, 11.5.2,11.4.4, 11.3.1, 11.2.2, 11.1.1, 11.0.3, cpu]
rocm-version: [6.0.2] # [5.4.2, 5.6.1, 5.7.3, 6.0.1, 6.0.2]
llvm-version: [16] # [12, 13, 14, 15, 16]
cmake-build-type: [Release] # [Debug, ClangTidy]
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CL: /MP
CMAKE_GENERATOR: Ninja
CMAKE_GENERATOR_PLATFORM: ${{matrix.arch}}
TORCH_ROCM_ARCH_LIST: '7.0;7.5'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/lib/php* /opt/ghc || true
df -h
- name: Setup Ubuntu
run: |
sudo apt-get update
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.llvm-version }} main"
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
libopencv-dev \
llvm-${{ matrix.llvm-version }}-dev \
libclang-${{ matrix.llvm-version }}-dev \
clang-${{ matrix.llvm-version }} \
wget
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
sudo update-alternatives --set clang /usr/bin/clang-15
sudo update-alternatives --set clang++ /usr/bin/clang++-15
wget -nv https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-linux-x86_64.tar.xz
sudo tar xf ccache-4.9.1-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.9.1-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
ccache --version
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/lib/php* /opt/ghc || true
df -h
- name: Sudo Tar Wrapper
run: |
# Workaround: https://github.com/containers/podman/discussions/17868
Expand Down Expand Up @@ -82,6 +93,7 @@ jobs:
key: rocm-${{matrix.ROCM-VERSION}}-ubuntu
path: |
/opt/rocm*
/etc/alternatives/rocm
- name: Install ROCm
if: ${{ steps.rocm-cache.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -109,7 +121,7 @@ jobs:
uses: actions/cache@v4
id: libtorch-cache
with:
key: libtorch-${{ matrix.torch-version }}-${{env.ROCM_VER_SHORT}}-ubuntu
key: libtorch-${{ matrix.torch-version }}-rocm5.7-ubuntu
path: |
/mnt/deps/libtorch
Expand All @@ -134,7 +146,8 @@ jobs:
set -x
source .github/workflows/cuda/${{ runner.os }}-env.sh ${CUDA_VER_SHORT}
export PATH=$PATH:/opt/rocm/bin
# hipify-clang ./vendor/gsplat/backward.cu ./vendor/gsplat/bindings.cu ./vendor/gsplat/forward.cu --cuda-path=${CUDA_HOME}
clang --version
hipify-clang ./vendor/gsplat/backward.cu ./vendor/gsplat/bindings.cu ./vendor/gsplat/forward.cu --cuda-path=${CUDA_HOME} -I /usr/local/${CUDA_HOME}/include -I ./vendor/gsplat -I /mnt/deps/libtorch/include --print-stats
- name: Clean Compiler Cache
run: |
Expand Down

0 comments on commit 8663630

Please sign in to comment.