curand_init() within optix

RT_PROGRAM void pinpole_camera(){
  curandState localstate;
  float3 origin = ...;
  float3 direction = ...;
  optix::Ray ray = ....;

The weird thing is that if I commented out curand_init(), the program compiles and runs well but with this line, it compiles well and runs until printf("…") normally and reports error:

OptiX Error: Unknown error (Details: Function “RTresult _rtContextLaunch1D(RTcontext, unsigned int, RTsize)” caught exception: Encountered a CUDA error: result returned (700): Unknown, [6619204])

sample2.cxx:68 is

RT_CHECK_ERROR( rtContextLaunch1D( context, 0, width ) );

Any idea?

One thing to note is that curand_init might be using up a lot of your stack space. Try this and see if it works any better:


Thanks, it works now.