Problems with nvcc+PGF with new install - missing "__en

Hi. We’ve just installed a new machine with all the latest libraries (PGF 10.6 etc.).

We’ve got an annoying problem. nvcc isn’t playing nicely with Portland. Here is what’s happening.

If I compile the MersenneTwister kernel example on our old machine, I get this:

nvcc -c MersenneTwister_kernel.cu -o MersenneTwister_kernel.o
nm MersenneTwister_kernel.o | grep random
[rakers@cuda001 LOCUST-GPU_2.97]$ nm MersenneTwister_kernel.o | grep random
0000000000010028 b _ZZ29__device_stub__Z9randomgpuPfiE3__f
0000000000009298 T __device_stub__Z9randomgpuPfi
0000000000009310 T randomgpu__entry

Fine - everything as it should be.

But if I compile on our new machine, I get this:


[rakers@cuda002 LOCUST-GPU_2.97]$ rm -rf *.o
[rakers@cuda002 LOCUST-GPU_2.97]$ nvcc -c MersenneTwister_kernel.cu -o MersenneTwister_kernel.o
[rakers@cuda002 LOCUST-GPU_2.97]$ nm MersenneTwister_kernel.o | grep random
0000000000001246 T _Z29__device_stub__Z9randomgpuPfiPfi
0000000000020070 b _ZZ29__device_stub__Z9randomgpuPfiPfiE3__f
00000000000012c7 T randomgpu

Notice how “__entry” is missing off randomgpu. So when I come to link all my code together, pgfortran complains that:

..../mer_test.cuf:18: undefined reference to `randomgpu__entry'

It looks like nvcc needs to be installed differently. Does anyone have any ideas?

Rob.

Hi Rob,

It looks like nvcc needs to be installed differently. Does anyone have any ideas?

NVIDIA changed their naming conversion in CUDA 3.0. The fix is to update the CUDA Fortran interface block’s C binding name to match the new CUDA C name.

For example:

    subroutine RandomGPU(d_Rand, n_per_rng) bind(c,name='randomgpu')
        use iso_c_binding
        real(c_float), dimension(:), device :: d_Rand
        integer, value :: n_per_rng  ! pass by value
    end subroutine RandomGPU

Hope this helps,
Mat

D’OH! I was just staring at my interface blocks when you replied…

Thanks Matt as always.

Rob.