ROCm / hipfort

Fortran interfaces for ROCm libraries
https://rocm.docs.amd.com/projects/hipfort/en/latest/
Other
69 stars 37 forks source link

HIPRAND routines with Fortran OpenACC Cray compiler on LUMI #134

Closed baldang closed 9 months ago

baldang commented 9 months ago

Hi all,

I am trying to compile an MPI+OpenACC Fortran90 code using the Cray compiler in LUMI. I wrote a simple fortran program (main.txt) that mimics the issue that we are experiencing in our code when we try to generate random numbers using HIPRAND interface. I compiled using the following modules (load_modules.txt) with:

ftn -g -O3 -hfp3 -hacc -h acc_model=auto_async_kernel:fast_addr:deep_copy -eZ -m1 -L/users/$USER/EasyBuild/SW/LUMI-23.09/G/hipfort/0.4-0-cpeCray-23.09-rocm5.2/lib -lhipfort-amdgcn main.f90 -J /users/$USER/EasyBuild/SW/LUMI-23.09/G/hipfort/0.4-0-cpeCray-23.09-rocm5.2/include/hipfort/amdgcn -o main.exe

the error I get is:

/opt/cray/pe/cce/16.0.1/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld: /tmp/pe_104960/main_1.o: in function `main': The Cpu Module:(.text+0x1b): undefined reference to `hiprandCreateGenerator'

domcharrier commented 9 months ago

Your build command appears to link with -lhipfort-amdgcn but not with -L<ROCM_LIB_DIR> -lhiprand. Can you try adding -lhiprand after -lhipfort-amdgcn?

baldang commented 9 months ago

Hi Dominic, thanks for the suggestion. It worked out fine.