cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

andrei_poenaru
Adept I

Unable to use OpenCL 2.0 workgroup functions

Jump to solution

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.

0 Likes
1 Solution

Accepted Solutions
dipak
Staff
Staff

Re: Unable to use OpenCL 2.0 workgroup functions

Jump 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,

View solution in original post

0 Likes
4 Replies
dipak
Staff
Staff

Re: Unable to use OpenCL 2.0 workgroup functions

Jump 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,

View solution in original post

0 Likes
andrei_poenaru
Adept I

Re: Unable to use OpenCL 2.0 workgroup functions

Jump to solution

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.

0 Likes
dipak
Staff
Staff

Re: Unable to use OpenCL 2.0 workgroup functions

Jump to solution

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,

0 Likes
andrei_poenaru
Adept I

Re: Unable to use OpenCL 2.0 workgroup functions

Jump to solution

Thanks for the prompt answer. I have changed the code and got the group functions to work.

Thank you again for the help.

0 Likes