CURAND device API Issues

Context: I’m trying to do some pseudorandom number generation at the GPU using CURAND, but since I’m using CUDA fortran I have to create an interface module, which interfaces the CURAND LIBRARY functions written in C. Here is the interface code:

interface curand_init

      attributes(device) subroutine curand_init(seed,sequence,offset,state) &
        bind(C,name='curand_init')
        use iso_c_binding
        integer(c_long_long),value :: seed
        integer(c_long_long),value :: sequence
        integer(c_long_long),value :: offset
        !pgi$ ignore_tr state
        real(c_float), device :: state(*)   
      end subroutine curand_init

    end interface curand_init

    interface curand

      attributes(device) subroutine curand(state) &
        bind(C,name='curand')
        use iso_c_binding
        !pgi$ ignore_tr state
        real(c_float),device :: state(*)
      end subroutine curand

    end interface curand

interface curand_uniform

      attributes(device) subroutine curand_uniform(state) &
        bind(C,name='curand_uniform')
        use iso_c_binding
        !pgi$ ignore_tr state
        real(c_float),device :: state(*)
      end subroutine curand_uniform

      attributes(device) subroutine curand_uniform_double(state) &
      bind(C,name='curand_uniform_double')
        use iso_c_binding
        !pgi$ ignore_tr state
        real(c_double),device :: state(*)
      end subroutine curand_uniform_double

    end interface curand_uniform

    interface curand_normal

      attributes(device) subroutine curand_normal(state) &
        bind(C,name='curand_normal')
        use iso_c_binding 
        !pgi$ ignore_tr state
        real(c_float),device :: state(*)
      end subroutine curand_normal 

      attributes(device) subroutine curand_normal_double(state) &
        bind(C,name='curand_normal_double')
        use iso_c_binding
        !pgi$ ignore_tr state
        real(c_double),device :: state(*)
      end subroutine curand_normal_double

    end interface curand_normal

in the same module I make a call to this device subroutine call

curand_init(seed,id,0,tmpconf)

in a global kernel. I get this error when I call the global kernel.

gpu_gen_m.CUF:
PGF90-S-0155-Could not resolve generic procedure curand_init (gpu_gen_m.CUF: 99)
  0 inform,   0 warnings,   1 severes, 0 fatal for gen_conf
gpu_gen_m.CUF:

any Idea how I can resolve this issue?

Make sure that the actual arguments’ data types match the dummy arguments’ types.

  • Mat