I’m getting the following error when compiling:
VFORTRAN-S-1058-Call to NVHPC runtime function not supported - pghpf_rnum_i8 (foo_mod.f90: 8)
The code is below. Note that subroutine foo has the directive $acc routine, used to generate code for the device. Removing this comment and the code will compile. However, I need to get foo running on the device; therefore I need a version of the intrinsic subroutine random_number to be compiled for GPU. The error message suggests that it is not possible to run random_number on a GPU (?) What fix or workaround would you suggest?
Thanks for your help.
Environment: nvfortran 24.11-0 64-bit target on x86-64 Linux -tp broadwell
Steps:
cat > foo_mod.f90 << EOF
module foo_mod
contains
subroutine foo(i, array)
!$acc routine
implicit none
integer :: i
real :: array(:)
call random_number(array)
end subroutine
end module
EOF
nvfortran -c -acc=gpu foo_md.f90
Correct, and nor would you want the basic random number generator on the device. RNGs are inherently problematic when run in parallel given they have a global state which would be shared by all threads, thus causing a race condition. Instead, you’ll need to use an RNG where each thread carries it’s own private state.
I’ve written a few posts about this (links below). The summary is that you need to look to use a device side RNG like cuRAND or DES PRNG.