Hi,
I was running all my code in Ubuntu(16.04) smoothly, then I ported the same code into windows 10 (driver : 471.41). Both with OptiX 6.5 and CUDA 10.1.
However, in windows I got this compile error and having been struck here over a few days.
Unknown error(Details: _rtProgramCreateFromPTXString"caught Exception: More than one use of a bound callable program variable (myfunctionName))found
I declared one function sampleAreaLight in area_light.cu file, and declared it as a program in host code
Program sampleAreaLightProgram = createProgram("lights/area_light.cu", "sample_area_light");
context["sampleAreaLight"]->set(sampleAreaLightProgram);
And then in another .cu file.
I have
rtDeclareVariable(
rtCallableProgramX<void(const IndependentSampler& sampler, float3&, float3&, float3&, float&)>,
sampleAreaLight, , );
and then call the callableProgram sampleAreaLight in another function.
I tried to commened out all the callers and this exception is gone. However, when i call this function only once, it failed. (I thought it means i shouldn’t use this callable function more than once)
Could you point out my potential problems? And why it went smoothly in Ubuntu. Besides, I don’t see any rules about we cannot call the bound callablefunction more than once. Would changing to boundless callable help?
Thanks!
Have you tried using the RT_USE_TEMPLATED_RTCALLABLEPROGRAM define and rtCallableProgram instead of the explicit rtCallableProgramX like recommended inside the documentation?
rtCallableProgramX declares callable program name, which will appear to be a callable function with the specified return type and list of arguments.
This callable program must be matched against a variable declared on the API object using rtVariableSetObject.
Unless compatibility with SM_10 is needed, new code should #define RT_USE_TEMPLATED_RTCALLABLEPROGRAM
and rely on the new templated version of
rtCallableProgram instead of directly using rtCallableProgramX.
I had similar code like yours in my old renderer from 2016 but used the RT_USE_TEMPLATED_RTCALLABLEPROGRAM method.
Since then I always used bindless callable programs instead since they are faster and I never needed the program’s scope from the caller.
Also the OptiX SDK 6.5.0 example optixCallablePrograms is using both bound and bindless callable programs in its optixCallablePrograms.cu file.
Could you please check if that works on your windows system?
If yes, some more information would be required to analyze your case, like a minimal and complete reproducer project.
Generally it’s highly recommended to port over to OptiX 7 versions because they are always faster and more explicit. There are direct and continuation callables in that which are effectively bindless callable programs.
Thank you so much for your reply! After changing to boundless callable program, it worked on my windows10. I will try the rest of the advice and update here about the results!
Thanks again!