The specific statement is as follows:
this is the cu file #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);
}
}
and this is the subrutine:
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
The error is more likely to do with how you’re calling SORTBYGN from Fortran rather than your Fortran to C interface. It typically means that there’s a mismatch in the argument data types so the compiler can’t match the caller signature to one of the generic interfaces.
How are you calling SORBYGN? How are the variables being pass as argument’s being declared? Do the data type match the signature of the interface?
Here’s how the parameters are defined and how I call SPRBYGN:
INTEGER NP
INTEGER,DEVICE,ALLOCATABLE,TARGET::D_PID(:)
INTEGER,DEVICE,ALLOCATABLE,TARGET::D_GNC(:)