Optix7.2 sutil::getPtxString

Hi,I’m still beginner of Optix.
I am still working on my Optix7.2 application on VS2019.
I copy a PathTracer project of Optix SDK Samples.
I found that the program I copied won’t run my .cu file.I found that it was caused by the sutil::getPtxString().
I deleted sutil::getPtxString() in main.cpp and wrote a function .
This is the function I wrote:

std::string PtxPath(const char* filename)
{

    return std::string("D:/vs program/pathTracing/") + std::string(filename) + ".cu.ptx";
}

I use it in createModule()

void createModule()
{
....
 //const std::string ptx = sutil::getPtxString(OPTIX_SAMPLE_NAME, OPTIX_SAMPLE_DIR, "optixPathTracer.cu");
    std::string ptx = PtxPath("PathTracing");
.....
}

But when I run this program, the console will remind me;

COMPILE ERROR: Invalid PTX input: ptx2llvm-module-001: error: Failed to parse input PTX string
ptx2llvm-module-001, line 1; fatal   : Missing .version directive at start of file 'ptx2llvm-module-001'
Cannot parse input PTX string

Can you tell me how to do it,I will be very grateful。

Please note that the sutil::getPtxString() is returning the PTX source code itself, not its filename.
You’re only constructing the filename which is not what you use with the optixModuleCreateFromPTX() function.

That should be easy to solve.

If there is not a specific reason to use that OptiX SDK 7.2.0 version, for example because you cannot upgrade to newer drivers, it’s always recommended to use the newest available display drivers and OptiX SDK version which would be 7.4.0 at this time. Note that the sutil::getPtxString() has been replaced by the helper function sutil::getInputData() there.

I’m not a fan of these sutil helper functions, because they use hardcoded paths to the local samples source directory inside the executables.

OptiX 7 example code which is not using the sutil library at all can be found here: https://github.com/NVIDIA/OptiX_Apps
The function where I read the PTX source code from a file is here: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/nvlink_shared/src/Device.cpp#L200
Example usage: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/nvlink_shared/src/Device.cpp#L589

Thank you for your reply,I have solved the problem based on your reply