Files
rocm-systems/samples/0_Intro/square/README.md
T
Rakesh Roy 4dfa7ca7e6 SWDEV-425678 - Fix build failure in HIP samples
- Due to file reorg path changes cmake fails at find_package(hip) unless CMAKE_PREFIX_PATH is set explicitly
- Update CMakeLists.txt to set CMAKE_PREFIX_PATH
- Update Readme

Change-Id: Ibdb4419efcdd6583b059a728e48dfdb8f927a48b
2023-11-27 12:56:29 -05:00

829 B

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 ..
  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!