Hipify the code
To use the toolkit with AMD ROCm, you need to first hipify the code.
Use the provided script
hipify.sh.
The script uses the hipify-perl conversion tool. You can download it from here.
In the script you need to set correctly invocation of the hipify-perl tool.
# SETTINGS
HIPIFY_CMD="hipify-perl -hip-kernel-execution-syntax"
The script must be executed from the main folder of the W-SLDA Toolkit:
gawlazlo@uan02:/project/project_465000150/share/wslda> ./hipify.sh
---> Converting WSLDA to HIP environment
+ cd hpc-engine
+ mkdir -p hip
+ rm -rf *
+ for cufile in *.cu
+ hipify-perl -hip-kernel-execution-syntax -o hip/ccpca_dens.cpp ccpca_dens.cu
...
+ set +x
---> Conversion of WSLDA to HIP is DONE.
Compiling the code with HIP
In order to activate compilation with the hipcc compiler (analog of the nvcc compiler), add to the Makefile flags HIPCC and HIPCCFLAGS. For example:
# COMPILERS
CXX=cc
# NVCC= commented intentionally, it is replaced by HIPCC below
HIPCC=hipcc
PYTHON=python
# DIRECTORY SETTINGS
WSLDADIR=$(WSLDA)
OBJDIR=./obj/
# folder where executable binary will be placed (will be created automatically)
BINDIR=./
# COMPILER FLAGS
# You may also need to add info about the platform
# and path to HIP include files for C compiler
CFLAGS=-D__HIP_PLATFORM_AMD__ -I$(HIP_PATH)/include
# NVCCFLAGS= commented intentionally, it is replaced by HIPCCFLAGS below
HIPCCFLAGS=-std=c++14 --offload-arch=gfx90a
# LIBRARIES
# You need to link to amdhip64 and hipfft libs
LIBS= -L$(HIP_LIB_PATH) -lamdhip64 -L$(EBROOTHIPFFT)/lib -lhipfft -lm
Example
See for LUMI supercomputer templates.