strange error in CUDA FORTRAN calling thrust

I’m developing a code with cuda fortran. It works well on my old computers.
Recently I bought a new laptop (Dell G7) with a RTX 2060. I installed vs 2017, pgiws64-1910, and cuda toolkits. The code can be compiled succesfully, but it seems stop running after a few steps (no error, just stop running forward, acting like a endless loop). Using some output codes, I found that the programe stops at a calling thrust function. The strange thing is that, the thrust function is called three times and the first two times works well. In the third time, the programe goes into the thrust function and never come back.

the code is (it works well on my old computers):

cuda c---------------------------------------------
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/sort.h>
extern “C”
{
void thr_SbyK( int *KEY, int N, int *ARRAY)
{
thrust::device_ptr dev_ptr1(KEY);
thrust::device_ptr dev_ptr2(ARRAY);
thrust::sort_by_key(dev_ptr1, dev_ptr1+N, dev_ptr2);
}
}

interface-------------------------------------------
INTERFACE SORTBYGN
SUBROUTINE SORTBYGN_thr(KEY,N,ARRAY) bind(C,name=‘thr_SbyK’)
use iso_c_binding
INTEGER(c_int),DEVICE,DIMENSION()::KEY
INTEGER(c_int),VALUE::N
INTEGER(c_int),DEVICE,DIMENSION(
)::ARRAY
END SUBROUTINE
END INTERFACE

calling--------------------------------------------------
CALL SORTBYGN(D_GNC,NP,D_PID)

The video ram is quite enough.
Although there are two video card, only one of them support GPU and I think I chose it right.

Could someone helpe me out?

Hi Lazycatyi,

Would you be able to provide an reproducible example? I can try to create one from the snip-it you have but it would be much preferred to have one that is known to reproduce the issue.

Thanks,
Mat

Hi Mat,

Thank you for reply.
I tried to write a simple example. An error happens T_T.
It shows “PGF90-S-0155-Could not resolve generic procedure sortbygn”, but I can not see what’s the different from the original version…

The error means that the calling signature of SORTBYGN isn’t matching any interface for the routine.

Perhaps you’re not passing device arrays to the subroutine?

-Mat