CUDA FORTRAN: Undefined reference to `randomgpu__entry'

I’ve been trying to use the mersenne twister parallel random number generator in CUDA Fortran, by interfacing to the CUDA C implementation as instructed from PGI insider: http://www.pgroup.com/lit/articles/insider/v2n1a4.htm.

I downloaded the source code, loaded the pgi 10.8 module in linux, and tried to build the code by typing ‘make’ in the terminal. It did fine for a bit, then came up with this error:

/home/theory/phrkaj/Projects/pgi_mc_example/./src/mcCUF_5.F90:146: undefined reference to `randomgpu__entry'
make: *** [mcCUF_5.out] Error 2

It’s probably got something to do with the ISO_C_BINDING, since nvcc adds ‘__entry’ to the end of the function name. Any thoughts on how to fix this?

Thanks in advance

Hi Tom,

It’s probably got something to do with the ISO_C_BINDING, since nvcc adds ‘__entry’ to the end of the function name. Any thoughts on how to fix this?

Most likely. NVIDIA has a tendency to change their symbol names from release to release. Use the ‘nm’ utility on the Mersenne Twister object file (‘nm obj/MersenneTwister_kernel.o’) to see what they’ve called the entry function. Next, change the C binding name to match.

Hope this helps,
Mat

Use the ‘nm’ utility on the Mersenne Twister object file (‘nm obj/MersenneTwister_kernel.o’) to see what they’ve called the entry function. Next, change the C binding name to match.

Thanks a bunch! In the article, it was assumed that ‘__entry’ would be appended to the end of a function name in CUDA. I guess that’s not the case anymore. All I had to do was replace ‘randomgpu__entry’ with ‘randomgpu’ in the mcCUF_5.f90 source code.

Cheers