Files
rocm-systems/samples/0_Intro/square
ROCm CI Service Account 34976df246 SWDEV-385161 - Deprecate usage of env vars in HIP samples and tests (#363)
* SWDEV-385161 - Deprecate usage of env vars in HIP samples and tests env vars such as HIP_PATH, ROCM_PATH, HIP_COMPILER, HIP_RUNTIME, HSA_PATH etc are removed.

Change-Id: I280e20b291cfb14675846aae72d97fa5b3ad567d
2023-08-14 12:06:14 +05:30
..

Square.md

Simple test below is an example, shows how to use hipify-perl to port CUDA code to HIP:

  • Add hip/bin path to the PATH
$ export PATH=$PATH:[MYHIP]/bin
  • Define environment variable
$ export HIP_PATH=[MYHIP]
  • Build executable file
$ cd ~/hip/samples/0_Intro/square
  mkdir -p build && cd build

  cmake -DCMAKE_PREFIX_PATH=<path/to/rocm> -DHIP_CXX_COMPILER=<path/to/clang> ..
  make

$ Building without cmake
/opt/rocm/hip/bin/hipify-perl square.cu > square.cpp
/opt/rocm/hip/bin/hipcc  square.cpp -o square.out
/opt/rocm/hip/bin/hipcc -use-staticlib  square.cpp -o square.out.static
  • Execute file
$ ./square.out
info: running on device Navi 14 [Radeon Pro W5500]
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!