I’m trying to make a new OptixHello project using VS2013. I created a CUDA runtime project, changed NVCC compilation type from "Generate hybrid object file(–compile)"to “Generate .ptx file(-ptx)” .What really confuses me is that the ptx file generated in this way is much longer than the one generated using function “sutil::getPtxString”. As a result,optix program can not be created using the former ptx file.
My project can run well using the function “sutil::getPtxString”. But it would take a few seconds to compile the “.cu” file. OptiX-Advanced-Samples can generated ptx file faster by configuring CMake in VS projects, but I can hardly get the hang of it. Is there any other simple way to generate the ptx file?
For the PTX code generation you possibly need to set some more options:
Pick the SM target to be sm_30 (Kepler), like with --gpu-architecture=compute_30. That way the code can be used on all supported devices from Kepler and higher.
Do not enable debug (-g, -G), not even in debug build targets. OptiX doesn’t handle the embedded information.
Always enable --use_fast_math, otherwise the CUDA compiler will not generate the .approx calls for the trigonometric functions. That might result in considerably bigger and much slower code.
Enable --relocatable-device-code=true, otherwise OptiX callable programs will not be generated with CUDA 8.0 and above due to dead code elimination of unreferenced functions.