cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

akhal
Journeyman III

Selecting fixed number of cores in OpenCL

Hello

I am comparing performance of OpenMP with that of OpenCL on CPUs and my system has 8 cores. But I need comparisons for 2, 4, 6 and 8 cores respectively. I can activiate number of cores in OpenMP through "set_num_threads(n)" function or an environment variable; But I dont know how could I do same in OpenCL, is there alternative of OpenMP set_num_threads API in OpenCL ?

0 Likes
5 Replies
genaganna
Journeyman III

Originally posted by: akhal Hello

 

I am comparing performance of OpenMP with that of OpenCL on CPUs and my system has 8 cores. But I need comparisons for 2, 4, 6 and 8 cores respectively. I can activiate number of cores in OpenMP through "set_num_threads(n)" function or an environment variable; But I dont know how could I do same in OpenCL, is there alternative of OpenMP set_num_threads API in OpenCL ?

 

You can do with device_fission extension.

0 Likes
d_a_a_
Adept II

Here is a code snippet using Device Fission:

http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=143461

0 Likes

ok thanks for the hint, but as i followed their example, I got errors:

ImgConv_ocl.cc(275): error: identifier "cl_device_partition_property_ext" is undefined
      cl_device_partition_property_ext subdevice_properties[] =
      ^

ImgConv_ocl.cc(276): error: identifier "CL_DEVICE_PARTITION_BY_COUNTS_EXT" is undefined
           { CL_DEVICE_PARTITION_BY_COUNTS_EXT, cu, CL_PARTITION_BY_COUNTS_LIST_END_EXT,
             ^

ImgConv_ocl.cc(276): error: identifier "CL_PARTITION_BY_COUNTS_LIST_END_EXT" is undefined
           { CL_DEVICE_PARTITION_BY_COUNTS_EXT, cu, CL_PARTITION_BY_COUNTS_LIST_END_EXT,
                                                    ^

ImgConv_ocl.cc(277): error: identifier "CL_PROPERTIES_LIST_END_EXT" is undefined
             CL_PROPERTIES_LIST_END_EXT };
             ^

ImgConv_ocl.cc(283): error: expression must have class type
      device_id[0].createSubDevices( subdevice_properties, subdevices );

what seems wrong?

0 Likes

Originally posted by: akhal ok thanks for the hint, but as i followed their example, I got errors:

 

ImgConv_ocl.cc(275): error: identifier "cl_device_partition_property_ext" is undefined       cl_device_partition_property_ext subdevice_properties[] =       ^ ImgConv_ocl.cc(276): error: identifier "CL_DEVICE_PARTITION_BY_COUNTS_EXT" is undefined            { CL_DEVICE_PARTITION_BY_COUNTS_EXT, cu, CL_PARTITION_BY_COUNTS_LIST_END_EXT,              ^ ImgConv_ocl.cc(276): error: identifier "CL_PARTITION_BY_COUNTS_LIST_END_EXT" is undefined            { CL_DEVICE_PARTITION_BY_COUNTS_EXT, cu, CL_PARTITION_BY_COUNTS_LIST_END_EXT,                                                     ^ ImgConv_ocl.cc(277): error: identifier "CL_PROPERTIES_LIST_END_EXT" is undefined              CL_PROPERTIES_LIST_END_EXT };              ^ ImgConv_ocl.cc(283): error: expression must have class type       device_id[0].createSubDevices( subdevice_properties, subdevices );

 

what seems wrong?

 

Please include cl_ext.h or opencl.h

0 Likes

Thanks it worked 🙂

0 Likes