I am trying to debug an OpenCL kernel translated from a CUDA code. In the CUDA code, I defined a macro:
#ifdef __DEVICE_EMULATION__
#define GPUDEBUG(x) printf x
#else
#define GPUDEBUG(x)
#endif
to enable printing under device emulation mode. When I ran the translated unit on ATI stream sdk, I can not find a macro similar to "__DEVICE_EMULATION__".
printf does work when using CPU device, but will crash for GPU devices.
I am curious if there is such a macro so that I can keep my debug approach. Or if there is an alternative?
thank you
you can define it manualy.
clBuildProgram(prog, NULL, NULL, "-D __DEVICE_EMULATION__", NULL, NULL);
Originally posted by: nou you can define it manualy.
clBuildProgram(prog, NULL, NULL, "-D __DEVICE_EMULATION__", NULL, NULL);
thank you, it works
I tried by defining
clBuildProgram(prog, NULL, NULL, "-D __DEVICE_EMULATION__", NULL, NULL);
in host app and
#ifdef __DEVICE_EMULATION__
#define GPUDEBUG(x) printf x
#else
#define GPUDEBUG(x)
#endif
in kernel.
I am unable to Build because of this.
error: expected a ";"
GPUDEBUG("Hello Print \n");
and warning: expression has no effect
GPUDEBUG("Hello Print\n");
Please let me know for any modifications needed. i am working in ATI GPU HD 4350.
try this #define GPUDEBUG(x) printf(x)
nou,
I tried but its not building.have you tried in ATI Radeon GPU. I am working on RV710.
printf is working only on CPU device.
But Mr FangQ says its working in above messages.I guess he tested in ATI Radeon only.
Pavan,
printf is not supported in GPU.
Hi Omkar,
Thanks for the conclusion.