Cuda FORTRAN hybrid C language

PGF90-S-0155-Could not resolve generic procedure sortbygn
I wanted to call the C library, but this problem occurred when I called the subroutine.

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:

MODULE DIVIDESUBS

!**********************************************************************

USE PARTS
USE KERSPH

IMPLICIT NONE

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

Moved to the HPC Compilers forum from CUPTI

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(:)

INTEGER DPN
INTEGER,DEVICE,ALLOCATABLE,TARGET::D_DID(:)
INTEGER,DEVICE,ALLOCATABLE,TARGET::D_DGNC(:)

CALL SORTBYGN(D_GNC,NP,D_PID)
CALL SORTBYGN(D_DGNC,DPN,D_DID)

Actually,the first call"CALL SORTBYGN(D_GNC,NP,D_PID)" is ok, but when I want to CALL SORTBYGN(D_DGNC,DPN,D_DID), the error arise

This all looks correct, and it doesn’t make sense that one case works and the other doesn’t. Can you post a complete reproducer?