Random file not found exception for _rtProgramCreateFromPTXFile

Hi everyone,

I spent a long time on this, and still could not figure out the reason why this is happening.

This is what I get.

terminate called after throwing an instance of 'optix::Exception'
  what():  File not found (Details: Function "RTresult _rtProgramCreateFromPTXFile(RTcontext_api*, const char*, const char*, RTprogram_api**)" caught exception: , [2031681])

I am absolutely sure that the paths to the PTX files are correct since my Optix program successfully runs for most of the time. However, this exception pops up like once every ten times when I try to create a context and compile the ptx programs.

Some background information if that helps: I am using Optix 3.0 and CUDA 5.0 on Linux Mint 15. Also, I dropped all of the SDK code except “CUDA” and “CMake”.

Thanks very much and I appreciate your help in advance.


I’m not sure what to tell you, since the code around that exception is fairly straight forward.

std::ifstream input_file(file.c_str());

  if( !input_file )
    throw FileNotFound( RT_EXCEPTION_INFO,  file );

Perhaps you can try to load the file yourself and see if you have any additional problems.

One thing you might consider is making sure that OptiX is loading the 4.2 version of the CUDA run time library (libcudart), since there are known problems with using the 5.0 version of the CUDA run time with optix.

Hmm, every path string of createProgramFromPTXFile calls in my program is obtained from a ptxpath call, which is

inline const char* ptxpath(const std::string &target, const std::string &base){
	std::string path;
	path = "/home/woody/vclbuild/rayTracedSolution/lib/ptx/" + target + "_generated_" + base + ".ptx";
	std::ifstream input_file(path.c_str());
	if (!input_file.is_open()){

	return path.c_str();

However, I can’t see a single “bad” printed before the exception pops up.

Could you please briefly describe how can I switch between different versions of CUDA runtime library? I am totally new to CMake.

Probably the easiest thing to do to switch (and see if this is your problem) is to uninstall CUDA 5.0, install CUDA 4.2, remove your build directory, and configure from scratch.

Now that being said, thinking about this some more leads me to believe that there might be a conflict with the libstdc++ symbols that are embedded in OptiX. We had meant to limit their export from the library, but the version released on the web didn’t do this as expected. I’m not sure what more we can do if this is the cose.

Do the precompiled versions of the samples work properly?