OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.

atomic_add 64bit

Aizin__Artium
Beginner
732 Views

Hello,

I need to use atomic add 64bit with intel opencl 1.2.

how can I do that ? is it possible ? what are my other possibilities ?

Thank You.

0 Kudos
1 Reply
Michael_C_Intel1
Moderator
732 Views

Hi ArtiumA,

Thanks for the interest.

This topic gets into OpenCL extensions, both vendor specific and extensions defined in the spec up on khronos.org.

OpenCL offers optional extensions with respect to a given implementation's features. These extensions are dependent on the vendor actually offering implementation support and perhaps registering on Khronos.org. These extensions may or may not only apply on a per OpenCL standard revision basis or per vendor or per vendor device family.

In this kind of case, if we look at the OpenCL-C 1.2 reference for atomic add, we'll see a 64bit version of atomic add referenced in the OpenCL-C manual pages. It's accessible through use of the extension cl_khr_int64_base_atomics: 

Reference

64bit extension reference

For use of extensions, it is required that the developer interrogate the devices capabilities to make sure kernels executed on that device are compatible with that device. See clGetDeviceInfo(...) and the CL_DEVICE_EXTENSIONS parameter:

Reference

 

Sidebar: It's theoretical OpenCL standard updates may make past optional extensions core... or vice versa... It's governed by a standard body that wants to reasonably adapt to the needs of developers. 

I hope this addresses these issues and informs some forum viewers.

 

Thanks,

 

-MichaelC

0 Kudos
Reply