Issues with curandGenerateUniform

This is my curand_m interface file:

module curand_m
       integer , public :: CURAND_RNG_PSEUDO_DEFAULT = 100
       integer , public :: CURAND_RNG_PSEUDO_XORWOW = 101
       integer , public :: CURAND_RNG_QUASI_DEFAULT = 200
       integer , public :: CURAND_RNG_QUASI_SOBOL32 = 201

       interface curandCreateGenerator
       subroutine curandCreateGenerator(generator,rng_type) &
       bind(C,name='curandCreateGenerator')
       use iso_c_binding
       integer(c_size_t ):: generator
       integer(c_int),value :: rng_type
       end subroutine curandCreateGenerator
       end interface curandCreateGenerator

       interface curandSetPseudoRandomGeneratorSeed
       subroutine curandSetPseudoRandomGeneratorSeed(generator,seed) &
       bind(C,name='curandSetPseudoRandomGeneratorSeed ')
       use iso_c_binding
       integer(c_size_t), value :: generator
       integer(c_long_long),value :: seed
       end subroutine curandSetPseudoRandomGeneratorSeed
       end interface curandSetPseudoRandomGeneratorSeed

       interface curandGenerateUniform
       subroutine curandGenerateUniform( generator , odata , numele) &
       bind(C,name='curandGenerateUniform ')
       use iso_c_binding
       integer(c_size_t),value :: generator
       !pgi$ ignore_tr odata
       real(c_float), device::odata(*) 
       integer(c_size_t),value :: numele
       end subroutine curandGenerateUniform
       
       subroutine curandGenerateUniformDouble(generator,odata,numele) &
       bind(C,name='curandGenerateUniformDouble')
       use iso_c_binding
       integer(c_size_t),value :: generator
       !pgi$ ignore_tr odata
       real(c_double), device :: odata(*)
       integer(c_size_t),value :: numele
       end subroutine curandGenerateUniformDouble
       end interface curandGenerateUniform       
       
       interface curandGenerateNormal
       subroutine curandGenerateNormal(generator,odata,numele,mean, &
       stddev) &
       bind(C,name='curandGenerateNormal ')
       use iso_c_binding
       integer(c_size_t),value :: generator
       !pgi$ ignore_tr odata
       real(c_float), device :: odata 
       integer(c_size_t),value :: numele
       real(c_float), value :: mean ,stddev
       end subroutine curandGenerateNormal

       subroutine curandGenerateNormalDouble(&
       generator , odata , numele ,mean , stddev) &
       bind(C,name='curandGenerateNormalDouble ')
       use iso_c_binding
       integer(c_size_t),value :: generator
       !pgi$ ignore_tr odata
       real(c_double), device :: odata 
       integer(c_size_t),value :: numele
       real(c_double), value :: mean ,stddev
       end subroutine curandGenerateNormalDouble
       end interface curandGenerateNormal
       
       interface curandDestroyGenerator
       subroutine curandDestroyGenerator(generator) &
       bind(C,name='curandDestroyGenerator ')
       use iso_c_binding
       integer(c_size_t),value :: generator
       end subroutine curandDestroyGenerator
       end interface curandDestroyGenerator
  
       end module curand_m

and this is part of main program:

!$cuf kernel do <<<*,*>>>
			do i = 1 , nwalk
				call curandCreateGenerator(gen ,  CURAND_RNG_PSEUDO_DEFAULT )
				call curandCreateGenerator(gen1 ,  CURAND_RNG_PSEUDO_DEFAULT )
				seed = set_seed()
				call curandSetPseudoRandomGeneratorSeed ( gen , seed)
				call curandSetPseudoRandomGeneratorSeed ( gen1 , seed)
				call curandGenerate(gen , d_temp , 2)
				call curandGenerateUniform(gen1 , d_epsilon , 2)
                        ......

This is the compile time error I get :

PGF90-F-0000-Internal compiler error. Unsupported procedure 0 (hgen_test_kernel.CUF: 305)
PGF90/x86-64 Linux 12.10-0: compilation aborted
pseudo_test.CUF:
PGF90-S-0155-Could not resolve generic procedure curandgenerateuniform (pseudo_test.CUF: 81)
0 inform, 0 warnings, 1 severes, 0 fatal for pseudo_test

The first error pops in because the necessary random generations are not made which is needed by the global device function.
Any Ideas on how to solve this issue are welcomed.
Also I will like to ask since I’m a bit new with CUDA if nested device function calls by global device code is allowed in CUDA version 4.2?

Thanks

Hi egodfred,

These are all cuRAND host routines (which in turn launch kernels) so can’t be called from device code. You’d need to create interfaces to the routines found in the “curand_kernel.h” file for the device routines.

  • Mat