Cuda fortran doesnt launch subroutines containing gpu code

Hi. I installed the pgi community edition on my linux mint 17.1. My laptop has Nvidia GPU of compute capability 2.1. After completing the installation the compiler compiles the code but it doesnt execute the subroutines that contain the gpu code(the kernels). the cpu code is executed but the kernels never execute. Why is this happening? Please help!

Hi arun_suthar,

Is the rest of the code running as expected? Has the CUDA Fortran code worked before on other systems?

If so, then most likely your kernels are getting errors for some reason. Unless you add error checking, the CPU code will continue and no errors will be given.

Can you add error checking after your kernel launches? Something like:

call foo <<<...>>>()
istat = cudaGetLastError() 
if (istat .ne. 0) print*, cudaGetErrorString(istat)

Also, how are you compiling your code? Note since we don’t generate code for CC2.x devices by default, be sure to compile with “-Mcuda=cc20”

Hope this helps,
Mat

Hi. I tried by adding the commands as you said.
the error is as follows

invalid device function

the cpu code is running fine. And this code is a sample code given at the nvidia developer blog . the link is

https://devblogs.nvidia.com/easy-introduction-cuda-fortran/

this code runs fine on cluster but it doesnt run on my laptop.

Hi Mat. it worked by adding the flag -Mcuda=cc20. Thank you so much!!! I was exhausted finding solution to this issue for over a week. Thank you so much again!!!