Archived
docs(GUIDE): building against a ROCm SDK outside /opt/rocm
A userspace SDK (venv-style) finds hipcc via -DRAD_HIPCC, then device compilation dies on clang's 'Could not find standard C++ header cmath': ROCm's clang needs --gcc-install-dir for the distro libstdc++, and --rocm-device-lib-path for the tree's amdgcn/bitcode. ROCM_PATH covers discovery, not these. The working flag set, for the SDK and the core system install, in 1.2 after the direct-CMake recipe.
This commit is contained in:
1 parent
586f77ae0a
commit
0bb00a836d
1 file changed
+21
@@ -92,6 +92,27 @@ cmake --build build -j
|
||||
ctest --test-dir build -L fast -j8 --output-on-failure
|
||||
```
|
||||
|
||||
A ROCm SDK installed outside `/opt/rocm` — a userspace SDK tree under a virtualenv, a core-only
|
||||
system install — needs more than `ROCM_PATH`: hipcc is found, then device compilation dies inside
|
||||
`cuda_wrappers/cmath` with `Could not find standard C++ header 'cmath'`, because ROCm's clang
|
||||
does not pick up the distro gcc's libstdc++ headers on its own. The flags that make it work:
|
||||
|
||||
```sh
|
||||
ROCM=/path/to/_rocm_sdk_devel # the SDK root (the venv's site-packages/_rocm_sdk_devel)
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DRAD_HIPCC=$ROCM/bin/hipcc \
|
||||
-DCMAKE_HIP_COMPILER=$ROCM/llvm/bin/clang++ \
|
||||
-DCMAKE_HIP_COMPILER_ROCM_ROOT=$ROCM \
|
||||
-DCMAKE_HIP_FLAGS="--rocm-path=$ROCM --rocm-device-lib-path=$ROCM/lib/llvm/amdgcn/bitcode --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/15"
|
||||
export LD_LIBRARY_PATH=$ROCM/lib:$LD_LIBRARY_PATH
|
||||
```
|
||||
|
||||
`--gcc-install-dir` takes the distro gcc's directory (the installed gcc-15's; after a distro gcc
|
||||
upgrade it must be repointed, and the configure cached in `build/CMakeCache.txt` reset with
|
||||
`-c`). The device-lib path is where the SDK tree keeps `amdgcn/bitcode` (under `lib/llvm/` in a
|
||||
userspace SDK, `$ROCM/amdgcn/bitcode` in a core system install). The flags are not needed for a
|
||||
full `/opt/rocm` install, and `DOCKER.md`'s container sidesteps them.
|
||||
|
||||
### 1.3 Check that it works
|
||||
|
||||
The tests are grouped into tiers by label, and `CMakePresets.json` names the usual runs. A preset
|
||||
|
||||
Reference in new issue
Block a user