Unable to use curand in cuda fortran (even using -Mnollvm)

I have written a cuda fortran code, and I compiled it using pgfortran after loading the module pgi/19.9. It works properly. Within the same code, I am trying to implement a random number generator using curand_device module. However, with the compilation command “pgfortran code.cuf -o code.exe” I obtain the following error message:
nvlink error : Undefined reference to ‘__pgicudalib_curandNormalDoubleXORWOW’ in ‘/tmp/pgfortran8xKg0hmN7pVX.o’
nvlink error : Undefined reference to ‘__pgicudalib_curandInitXORWOW’ in ‘/tmp/pgfortran8xKg0hmN7pVX.o’
pgacclnk: child process exit status 2: /gpfs0/sys/UserApps/PGI/pgi/linux86-64-llvm/19.9/bin/pgnvd

Using the compilation command “pgfortran code.cuf -o code.exe -Mnollvm” I get similar error. But with the command “pgfortran code.cuf -o code.exe -Mcuda=nollvm” I get the following error:
/tmp/pgacc53UgR_A3c8ar.gpu(9): error: too many initializer values

1 error detected in the compilation of “/tmp/pgnvd85Ug0VV6bjLU.ii”.
PGF90-F-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (gpu_code.cuf: 1)
PGF90/x86-64 Linux 19.9-0: compilation aborted

Could you help me to get rid of this issue. Please be informed that if I write a separate random-number-generator-only code using curand_device, it works properly with the last command (i.e., with -Mcuda=nollvm).

Hi rakesh91d,

The first error occurs when compiling cuRand in device code and not using the “-Mcuda=nollvm” flag (which has since been renamed to “-Mcuda=nonvvm”), so the first error is expected. Note that, the “-Mnollvm” only applies to host code generation.

As for the “error: too many initializer values”, I’ve only seen this issue once before with an issue back in our 13.x compilers. In that case, the compiler wasn’t handling DATA statements quite right. We fixed this in 13.10 (October 2013) so it most likely unrelated.

Can you post a reproducing example so I can investigate what’s wrong?