Setting up my code to use the debugger

Setting up my code to use the debugger

Hi, I keep getting an error when trying to build my cl::Program using the following options
"-g -s Kernels\\\\BCurveGPU.cl". The error is "Invalid option: -s". Can anyone provide me an example of exactly how to do this correctly? I have verified that I am getting the correct intel platform and device from the system. Thanks! I'm excited to use the debugger finally.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

Can you give some more details, particularly what other params you are passing to clBuildProgram() and how you are creating the program object?

Thanks,
Raghu

Raghu,
I'm using the C++ cl:: classes. I have removed all other build options except for "-g -s" and it stillgives me the sameCL_INVALID_BUILD_OPTIONS"Invalid option: -s". If for some reason I was not getting the correct context, it seems like it would give the error for -g also, which it is not. I can send my entire .sln if you like but it has many files. Can you send me an example of a .cpp file where you prepare for debugging? It's not entirely clear to me how to specify the path correctly.I really appreciate your help. I've spent hours on this with no success.

void CBCurve::InitCPUPrgm()

{

cl_int clErr;

std::ifstream stream("kernels\\BCurveGPU.cl");

std::string sourceStringCPU(std::istreambuf_iterator(stream), (std::istreambuf_iterator()));

cl::Program::Sources sourceCPU(1, std::make_pair(sourceStringCPU.c_str(), sourceStringCPU.length()+1));

spBCrvPrgmCPU = new Program( pDM->GetContext( CL_DEVICE_TYPE_CPU ), sourceCPU);//pDM is a singleton that provides contexts, devices, etc..

std::vector devices;

devices.push_back( pDM->GetDevice( CL_DEVICE_TYPE_CPU ) );

std::string options("-g -s");

//options += " -Dreal="; options += CLREALSTR;

//options += " -Dreal4="; options += CLREAL4STR;

clErr = spBCrvPrgmCPU->build( devices, options.data());;

if(!clErr)

{

spKFindSpans = new cl::Kernel( *spBCrvPrgmCPU, "FindSpans", &clErr );

spKEvalCurve = new cl::Kernel( *spBCrvPrgmCPU, "EvaluateCurve", &clErr );

}

else

{

std::string log = spBCrvPrgmCPU->getBuildInfo(pDM->GetDevice( CL_DEVICE_TYPE_CPU ), &clErr);

}

}

I should also mention that if I only specify "-g" as the build options, the program compiles correctly. I also can't seem to get printf() to do anything. This may be unrelated but I thought I should mention it.

Ok, I think I solved this. The problem is that the AMD Platform also was returning a device for the Intel CPU! I was not expecting this. I assumed if my device was the CPU I was good to go. Now I just need to get the path to my .cl specified correctly and I'm in business. Is this the correct format? Thanks.
"-g -s "

It's working! You have no idea how happy Iwas to see that breakpoint get hit in my kernel for the first time. I am going to be so much more productive now that I can debug.

Hi,

I am glad you were able to solve the issue. If you have further questions, please feel free to let us know and we'd be happy to help.

Thanks,
Raghu

Leave a Comment

Please sign in to add a comment. Not a member? Join today