-g option to clBuildProgram not accepted

-g option to clBuildProgram not accepted

Hi,

I'm trying to debug some OpenCL kernels with the Intel OpenCL SDK debugger integrated in VS2008.
The documentation states I have to pass "-g -s " as an option to clBuildProgram() but this results in a CL_BUILD_ERRORerror "Don't understand command line argument "-g"!".

DoI need another OpenCL.dll driver? I've tried it bothon an AMD as a NVIDIA system.

Thanks,
Daniel Dekkers

7 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hello Daniel,

Could you please make sure that your program selects Intel OpenCL platform during initialization. It looks like you have multiple OpenCL platforms installed on your system (since you are mentioning AMD and NVIDIA).

Thanks,
Yuri

Hi Yuri,

Good point, wrote some code to check.
I havetwo OpenCL platforms:
The first platformis AMD, it has two devices, Caicos and Intel Core i7
The second platform is Intel OpenCL, it has one device, Intel Core i7 (same name as above)

So i guess i should use the second platform?

Thanks,
Daniel

Yes, exactly. To work with the Intel OpenCL kernel debugger you should use Intel platform.

Thanks,
Yuri

Ok, I'm doing that but now clCreateContext() never returns...

m_Context = clCreateContext(NULL, 1, &m_DeviceId, NULL, NULL, &l_Error);

... where m_DeviceId is the (only) device on the second Intel platform.

I've activated the "Enable OpenCL Kernel Debugging" check.
Windows firewall is turned off.
I'mlinking againstthe OpenCL.lib from the Intel OpenCL SDK.
In taskmanageri see a icldbgsrv.exe (Intel OpenCL Debugger) process, but nothingelse that could be related.

Ehm...

Thanks,
Daniel

Here is some utility code that I helped out on it shows you how you can make sure and get a context for the correct platform and vendor using the Khronos C++ wrapper which you can easily modify to work with the c version as the opencl wrapper will return the base data.

You can either use the clCreateContext with the vendor enum or use arguments version.

Note: This code isn't meant to handle every single possible option (clearly as we don't handle IBM, or Img Tech, or any others). I have included it here as it should show you how to write something similar for yourself so you can never/almost never worry about this stuff again and get to coding.

Also it is way shorted with the C++ wrapper.

If you want to see the rest it is at: https://github.com/smistad/OpenCLUtilities
enum cl_vendor {VENDOR_ANY,VENDOR_NVIDIA,VENDOR_AMD,VENDOR_INTEL};

cl::Platform getPlatform(cl_device_type type, cl_vendor vendor) {// Get available platformscl::vector platforms;cl::Platform::get(&platforms);if(platforms.size() == 0)throw cl::Error(1, "No OpenCL platforms were found");int platformID = -1;if(vendor != VENDOR_ANY) {std::string find;switch(vendor) {case VENDOR_NVIDIA:find = "NVIDIA";break;case VENDOR_AMD:find = "Advanced Micro Devices";break;case VENDOR_INTEL:find = "Intel";break;default:throw cl::Error(1, "Invalid vendor specified");break;}for(unsigned int i = 0; i < platforms.size(); i++) {if(platforms[i].getInfo().find(find) != std::string::npos) {try {cl::vector devices;platforms[i].getDevices(type, &devices);platformID = i;break;} catch(cl::Error e) {continue; }}}} else {for(unsigned int i = 0; i < platforms.size(); i++) {try {cl::vector devices;platforms[i].getDevices(type, &devices);platformID = i;break;} catch(cl::Error e) {continue; }}}if(platformID == -1) throw cl::Error(1, "No compatible OpenCL platform found");cl::Platform platform = platforms[platformID];std::cout << "Using platform vendor: " << platform.getInfo() << std::endl;return platform;}cl::Context createCLContextFromArguments(int argc, char ** argv) {cl_device_type type = CL_DEVICE_TYPE_ALL;cl_vendor vendor = VENDOR_ANY;for(int i = 0; i < argc; i++) {if(strcmp(argv[i], "--device") == 0) {if(strcmp(argv[i+1], "cpu") == 0) {type = CL_DEVICE_TYPE_CPU;} else if(strcmp(argv[i+1], "gpu") == 0) {type = CL_DEVICE_TYPE_GPU;}i++;} else if(strcmp(argv[i], "--vendor") == 0) {if(strcmp(argv[i+1], "amd") == 0) {vendor = VENDOR_AMD;} else if(strcmp(argv[i+1], "intel") == 0) {vendor = VENDOR_INTEL;} else if(strcmp(argv[i+1], "nvidia") == 0) {vendor = VENDOR_NVIDIA;}i++;}}return createCLContext(type, vendor);}cl::Context createCLContext(cl_device_type type, cl_vendor vendor) {cl::Platform platform = getPlatform(type, vendor);// Use the preferred platform and create a contextcl_context_properties cps[] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(platform)(),0};try {cl::Context context = cl::Context(type, cps);return context;} catch(cl::Error error) {throw cl::Error(1, "Failed to create an OpenCL context!");}}

Let me know if you have any quesitons

Hi Daniel,

Just to be clear, does your code work with the Intel OpenCL device without debugging?

Faça login para deixar um comentário.