Files
rocm-systems/samples/2_Cookbook/18_cmake_hip_device/README.md
T
ROCm CI Service Account 30fcf2f17c SWDEV-402093 - Updated README to use AMDGPU_TARGETS=native to enable compiler autodetection (#378)
Change-Id: I33a71d12b5b883eacac706725322bc13e0d57852
2023-08-14 21:26:49 +05:30

892 B

This will test linking hip::device interface in cmake

I. Build

mkdir -p build; cd build
rm -rf *;
CXX="$(hipconfig -l)"/clang++ cmake -DCMAKE_PREFIX_PATH=/opt/rocm ..
make

Note, users may need to add ADMGPU support as command line option, if test failed to run, for example,

CXX="$(hipconfig -l)"/clang++ cmake -DCMAKE_PREFIX_PATH=/opt/rocm -DAMDGPU_TARGETS="gfx1102" ..

To enable compiler auto detection of gpu users may need to add ADMGPU support as command line option, if test failed to run, for example,

CXX="$(hipconfig -l)"/clang++ cmake -DCMAKE_PREFIX_PATH=/opt/rocm -DAMDGPU_TARGETS=native ..

II. Test

$ ../test_cpp
info: running on device AMD Radeon Graphics
info: allocate host mem (  7.63 MB)
info: allocate device mem (  7.63 MB)
info: copy Host2Device
info: launch 'vector_square' kernel
info: copy Device2Host
info: check result
PASSED!