Hello,
I'm trying to use the APP SDK 3.0 Beta to run some OpenCL 2.0 programs. However, I can't seem to be able to use the new workgroup functions. I have written a simple test kernel that looks like this (please ignore the unused arguments):
__kernel void template(const int N,
__global int* restrict A,
__global int* restrict B,
__global int* restrict C)
{
int i = get_local_id(0);
if (work_group_any(i == 0))
printf("Hello.\n");
}
This kernel gives the following error message when trying to compile it:
CL Program build error: "/tmp/OCL4614T8.cl", line 7: error: function "work_group_any" declared
implicitly
if (work_group_any(i == 0))
I have checked and I am using the headers and libraries from the APP SDK. I'm trying to run this on the GPU of an A10-7850K APU. Does anyone have any idea what's going on here?
Thank you.
Solved! Go to Solution.
Hi,
work_group_any() is a part of new OpenCL 2.0 work-group functions. To use it, you need to build your kernel code as CL 2.0. So, please specify the compiler/build option "-cl-std=CL2.0" during clBuildProgram() call.
Regards,
Hi,
work_group_any() is a part of new OpenCL 2.0 work-group functions. To use it, you need to build your kernel code as CL 2.0. So, please specify the compiler/build option "-cl-std=CL2.0" during clBuildProgram() call.
Regards,
Hi,
Thanks for the reply, and sorry for the delay. I've been having some technical issues with the machine.
I have compiled with program.build("-cl-std=CL2.0"), and I no longer get the error messages. However, nothing is still printed out. Do you have any idea what's going on here?
Thank you.
Its a known bug that printf does not print anything when input string is constant i.e. there is no % format specifier. [printf of constant string not working? ]. As I guess, in that case, the compiler ignores the printf statement completely.
Also, there is an issue that kernel compilation for OCL 2.0 fails if the kernel code contains any printf statement.
Regards,
Thanks for the prompt answer. I have changed the code and got the group functions to work.
Thank you again for the help.