PDA

View Full Version : Program Build Error



dlw
06-27-2011, 11:04 AM
hey guys,

I am having a problem building my code. The kernel is simple, and it runs on my smaller machine with an integrated graphics card. My big machine has 2 NVIDIA GTX 485M cards in it, not running SLI. I get an error code of -11 when I build the program, but it runs just fine on my other system. Any ideas what would cause this?

relevant code


//setup and get the platforms
vector<cl::Platform> platforms;
err = cl::Platform::get(&platforms);

//setup and get the context
cl_context_properties properties[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[0](), 0 };
cl::Context context = cl::Context(CL_DEVICE_TYPE_ALL, properties, 0, 0, &err);

//get a handle to the GPU
vector<cl::Device> deviceList = context.getInfo<CL_CONTEXT_DEVICES>(&err);

//create the queue
cl::CommandQueue queue = cl::CommandQueue(context, deviceList[0]);

//get the kernel
readCLFile(fileName);

//setup the program
cl::Program::Sources kernelSource(1, std::make_pair(kernelSourceCode, kernelSize));
cl::Program program = cl::Program(context, kernelSource, &err);

err = program.build(deviceList);
std::string str = program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(deviceList[0], &err);

the last line is where it fails, due to a null reference exception in getInfoFunctor1. its not due to an invalid kernel, because it runs on my other system, and the library is linked properly, with the most recent drivers installed. I dont know if it applies, but when I trace the program.build function, it returns 193 for the error, just before converting it to -11, and it doesnt have a null reference exception if I get rid of the buildInfo line, but it still returns err code -11 and the GPU code fails.

dlw
06-27-2011, 12:28 PM
I changed the code a little, it now reads


err = program.build(deviceList, 0, 0, 0);
err = program.getBuildInfo(deviceList[0], (cl_program_build_info)CL_PROGRAM_BUILD_INFO, &err);
it still fails inside the getInfoFunctor1 method, with an "access violation reading location 0x00000000" which usually means null pointer, though all the params that I pass in are good

dlw
06-27-2011, 12:55 PM
EDIT:


cl::STRING_CLASS buildLog;
program.getBuildInfo(deviceList[0], CL_PROGRAM_BUILD_LOG, &buildLog);


the error is specifically in the cl.hpp file, located in the GetInfoFunctor1 struct, called from the GetInfoHelper struct in static cl_int get on line 744

dlw
06-27-2011, 02:56 PM
could it be that I am running a 64bit system? If so, how would I work around this with the same code. I am running it 32bit through vs2010, but I dont know if this would affect it

HolyGeneralK
06-28-2011, 07:44 AM
what is your "other system" that the code works on?

dlw
06-28-2011, 12:34 PM
it is a dell something or other laptop. It has an integrated Quadro NVS 135M.

Turns out my problem was that I had to update my Display driver to the new 275.33 module. It fixed most of my problem. Now I have to slow my code down so the GPU is done before I read the data back in. :)

Thanks anyway