OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

Setting up my code to use the debugger

mflamer
Beginner
556 Views
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.
0 Kudos
6 Replies
Raghupathi_M_Intel
556 Views
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
0 Kudos
mflamer
Beginner
556 Views

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<:DEVICE> 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);

}

}

0 Kudos
mflamer
Beginner
556 Views
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.
0 Kudos
mflamer
Beginner
556 Views
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 <>"
0 Kudos
mflamer
Beginner
556 Views
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.
0 Kudos
Raghupathi_M_Intel
556 Views
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
0 Kudos
Reply