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?