I am trying to install Python packages, like lietorch or pytorch-scatter with AMD support.
I download the repository,
git clone --recursive https://github.com/repo
If I just try to install the package, I'll get an error, stating
clang: error: cannot find HIP runtime; provide its path via '--rocm-path', or pass '-nogpuinc' to build without HIP runtime
Therefore, I change the extra_compile_args
inside setup.py
, adding
'-DCMAKE_CXX_FLAGS=--rocm-path=/opt/rocm'
to the nvcc flags.
The flags get passed and is executed by hipcc:
/opt/rocm-6.0.2/bin/hipcc _various_compile_flags_ -DCMAKE_CXX_FLAGS=--rocm-path=/opt/rocm-6.0.2 _even_more_flags_
But it terminates with the error
sh: 1: --rocm-path=/opt/rocm-6.0.2/llvm/bin/clang: not found
sh: 1: --rocm-path=/opt/rocm-6.0.2/llvm/bin/clang: not found
error: command '/opt/rocm-6.0.2/bin/hipcc' failed with exit code 127
Is there anything I can do to get the packages built? Do these packages have insufficient support for AMD and there is nothing I can do? Or is there a grave oversight on my part and an obvious solution?
Some System Information:
GPU:
AMD Radeon RX 6800 XT (gfx1030)
Environment Variables:
ROCM_PATH=/opt/rocm
ROCM_ROOT=/opt/rocm
ROCM_HOME=/opt/rocm-6.0.2
CPATH=/opt/rocm-6.0.2/include:/opt/rocm-6.0.2/include/hip:/opt/rocm-6.0.2/include/rocrand:/opt/rocm-6.0.2/include/hiprand:/opt/rocm-6.0.2/include/roctracer:/opt/rocm-6.0.2/include/hipblas:/opt/rocm-6.0.2/include/hipsparse:/opt/rocm-6.0.2/include/hipfft:/opt/rocm-6.0.2/include/rocsolver
HIP_PATH=/opt/rocm/hip
HCC_HOME=/opt/rocm/hcc
HIP_PLATFORM="amd"
PYTORCH_ROCM_ARCH="gfx1030"
HSA_OVERRIDE_GFX_VERSION=10.3.0
HIP_VISIBLE_DEVICES=0
I tried setting the rocm-path flag as described above and looked for help in github issues and Stack Overflow posts without success. I expect the packages to compile successfully and run on my hardware.
While searching for an answer I stumbled upon this Clang documentation. It mentions the Order of Precedence for HIP Path:
Order of Precedence for HIP Path
--hip-path
compiler option
HIP_PATH
environment variable (use with caution)
--rocm-path
compiler option
ROCM_PATH
environment variable (use with caution)Default automatic detection (relative to Clang or at the default ROCm installation location)
Including --hip-path=/opt/rocm
inside the extra_compile_args
let me compile the packages.