// Developing with JOCL on AMD, Intel and Nvidia OpenCL platforms
One nice feature of OpenCL is that the platform abstraction was handled in the spec from the first day on. You can install all OpenCL drivers side by side and let the application choose at runtime, on which device and on which platform it should execute the kernels.
As of today there are three four vendors which provide OpenCL implementations for the desktop. AMD and Intel support the OpenCL 1.1 specification where Nvidia apparently tries to stick with 1.0 to encourage their customers to stick with CUDA ;-). [edit] And of course there is also Apple providing out-of-the box OpenCL 1.0 support in MacOS 10.6.
JOCL contains a small CLInfo utility which can be used to quickly verify OpenCL installations. Here is the output on my system (ubuntu was booted) having all three SDKs installed:
CL_PLATFORM_NAME | ATI Stream | NVIDIA CUDA | Intel(R) OpenCL | |
---|---|---|---|---|
CL_PLATFORM_VERSION | OpenCL 1.1 ATI-Stream-v2.2 (302) | OpenCL 1.0 CUDA 4.0.1 | OpenCL 1.1 LINUX | |
CL_PLATFORM_PROFILE | FULL_PROFILE | FULL_PROFILE | FULL_PROFILE | |
CL_PLATFORM_VENDOR | Advanced Micro Devices, Inc. | NVIDIA Corporation | Intel(R) Corporation | |
CL_PLATFORM_ICD_SUFFIX_KHR | AMD | NV | Intel | |
CL_PLATFORM_EXTENSIONS | [cl_khr_icd, cl_amd_event_callback] | [cl_khr_icd, cl_khr_byte_addressable_store, cl_nv_compiler_options, cl_nv_pragma_unroll, cl_nv_device_attribute_query, cl_khr_gl_sharing] | [cl_khr_icd, cl_khr_byte_addressable_store, cl_khr_fp64, cl_khr_local_int32_extended_atomics, cl_khr_local_int32_base_atomics, cl_khr_global_int32_base_atomics, cl_khr_gl_sharing, cl_intel_printf, cl_khr_global_int32_extended_atomics, cl_ext_device_fission] | |
CL_DEVICE_NAME | Intel(R) Core(TM) i7 CPU 940 @ 2.93GHz | GeForce GTX 295 | GeForce GTX 295 | Intel(R) Core(TM) i7 CPU 940 @ 2.93GHz |
CL_DEVICE_TYPE | CPU | GPU | GPU | CPU |
CL_DEVICE_AVAILABLE | true | true | true | true |
CL_DEVICE_VERSION | OpenCL 1.1 ATI-Stream-v2.2 (302) | OpenCL 1.0 CUDA | OpenCL 1.0 CUDA | OpenCL 1.1 |
CL_DEVICE_PROFILE | FULL_PROFILE | FULL_PROFILE | FULL_PROFILE | FULL_PROFILE |
CL_DEVICE_ENDIAN_LITTLE | true | true | true | true |
CL_DEVICE_VENDOR | GenuineIntel | NVIDIA Corporation | NVIDIA Corporation | Intel(R) Corporation |
CL_DEVICE_EXTENSIONS | [cl_amd_device_attribute_query, cl_khr_byte_addressable_store, cl_khr_int64_extended_atomics, cl_khr_local_int32_extended_atomics, cl_amd_fp64, cl_amd_printf, cl_khr_local_int32_base_atomics, cl_khr_int64_base_atomics, cl_khr_global_int32_base_atomics, cl_khr_gl_sharing, cl_khr_global_int32_extended_atomics, cl_ext_device_fission] | [cl_khr_icd, cl_khr_byte_addressable_store, cl_khr_fp64, cl_khr_local_int32_extended_atomics, cl_khr_local_int32_base_atomics, cl_nv_compiler_options, cl_nv_pragma_unroll, cl_nv_device_attribute_query, cl_khr_global_int32_base_atomics, cl_khr_gl_sharing, cl_khr_global_int32_extended_atomics] | [cl_khr_icd, cl_khr_byte_addressable_store, cl_khr_fp64, cl_khr_local_int32_extended_atomics, cl_khr_local_int32_base_atomics, cl_nv_compiler_options, cl_nv_pragma_unroll, cl_nv_device_attribute_query, cl_khr_global_int32_base_atomics, cl_khr_gl_sharing, cl_khr_global_int32_extended_atomics] | [cl_khr_byte_addressable_store, cl_khr_fp64, cl_khr_local_int32_extended_atomics, cl_khr_local_int32_base_atomics, cl_khr_global_int32_base_atomics, cl_khr_gl_sharing, cl_intel_printf, cl_khr_global_int32_extended_atomics, cl_ext_device_fission] |
CL_DEVICE_MAX_COMPUTE_UNITS | 8 | 30 | 30 | 8 |
CL_DEVICE_MAX_CLOCK_FREQUENCY | 2934 | 1242 | 1242 | 2930 |
CL_DEVICE_VENDOR_ID | 4098 | 4318 | 4318 | 32902 |
CL_DEVICE_OPENCL_C_VERSION | OpenCL C 1.1 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info string [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info string [error: CL_INVALID_VALUE] | OpenCL C 1.1 |
CL_DRIVER_VERSION | 2.0 | 270.41.06 | 270.41.06 | 1.1 |
CL_DEVICE_ADDRESS_BITS | 64 | 32 | 32 | 64 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT | 8 | 1 | 1 | 8 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR | 16 | 1 | 1 | 16 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT | 4 | 1 | 1 | 4 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG | 2 | 1 | 1 | 2 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT | 4 | 1 | 1 | 4 |
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE | 0 | 1 | 1 | 2 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR | 16 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 16 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT | 8 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 8 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT | 4 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 4 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG | 2 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 2 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF | 0 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 0 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT | 4 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 4 |
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE | 0 | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | 2 |
CL_DEVICE_MAX_WORK_GROUP_SIZE | 1024 | 512 | 512 | 1024 |
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS | 3 | 3 | 3 | 3 |
CL_DEVICE_MAX_WORK_ITEM_SIZES | [1024, 1024, 1024] | [512, 512, 64] | [512, 512, 64] | [1024, 1024, 1024] |
CL_DEVICE_MAX_PARAMETER_SIZE | 4096 | 4352 | 4352 | 1024 |
CL_DEVICE_MAX_MEM_ALLOC_SIZE | 1073741824 | 234831872 | 234700800 | 3154703360 |
CL_DEVICE_GLOBAL_MEM_SIZE | 3221225472 | 939327488 | 938803200 | 12618813440 |
CL_DEVICE_LOCAL_MEM_SIZE | 32768 | 16384 | 16384 | 32768 |
CL_DEVICE_HOST_UNIFIED_MEMORY | true | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | com.jogamp.opencl.CLException$CLInvalidValueException: error while asking for info value [error: CL_INVALID_VALUE] | true |
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE | 65536 | 65536 | 65536 | 131072 |
CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE | 64 | 0 | 0 | 64 |
CL_DEVICE_GLOBAL_MEM_CACHE_SIZE | 32768 | 0 | 0 | 262144 |
CL_DEVICE_MAX_CONSTANT_ARGS | 8 | 9 | 9 | 128 |
CL_DEVICE_IMAGE_SUPPORT | false | true | true | true |
CL_DEVICE_MAX_READ_IMAGE_ARGS | 0 | 128 | 128 | 128 |
CL_DEVICE_MAX_WRITE_IMAGE_ARGS | 0 | 8 | 8 | 128 |
CL_DEVICE_IMAGE2D_MAX_WIDTH | 0 | 4096 | 4096 | 8192 |
CL_DEVICE_IMAGE2D_MAX_HEIGHT | 0 | 32768 | 32768 | 8192 |
CL_DEVICE_IMAGE3D_MAX_WIDTH | 0 | 2048 | 2048 | 2048 |
CL_DEVICE_IMAGE3D_MAX_HEIGHT | 0 | 2048 | 2048 | 2048 |
CL_DEVICE_IMAGE3D_MAX_DEPTH | 0 | 2048 | 2048 | 2048 |
CL_DEVICE_MAX_SAMPLERS | 0 | 16 | 16 | 128 |
CL_DEVICE_PROFILING_TIMER_RESOLUTION | 1 | 1000 | 1000 | 340831 |
CL_DEVICE_EXECUTION_CAPABILITIES | [EXEC_KERNEL, EXEC_NATIVE_KERNEL] | [EXEC_KERNEL] | [EXEC_KERNEL] | [EXEC_KERNEL, EXEC_NATIVE_KERNEL] |
CL_DEVICE_HALF_FP_CONFIG | [] | [] | [] | [] |
CL_DEVICE_SINGLE_FP_CONFIG | [DENORM, INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO] | [INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO, FMA] | [INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO, FMA] | [DENORM, INF_NAN, ROUND_TO_NEAREST] |
CL_DEVICE_DOUBLE_FP_CONFIG | [] | [DENORM, INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO, FMA] | [DENORM, INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO, FMA] | [DENORM, INF_NAN, ROUND_TO_NEAREST, ROUND_TO_INF, ROUND_TO_ZERO, FMA] |
CL_DEVICE_LOCAL_MEM_TYPE | GLOBAL | LOCAL | LOCAL | GLOBAL |
CL_DEVICE_GLOBAL_MEM_CACHE_TYPE | READ_WRITE | NONE | NONE | READ_WRITE |
CL_DEVICE_QUEUE_PROPERTIES | [PROFILING_MODE] | [OUT_OF_ORDER_MODE, PROFILING_MODE] | [OUT_OF_ORDER_MODE, PROFILING_MODE] | [OUT_OF_ORDER_MODE, PROFILING_MODE] |
CL_DEVICE_COMPILER_AVAILABLE | true | true | true | true |
CL_DEVICE_ERROR_CORRECTION_SUPPORT | false | false | false | false |
cl_khr_fp16 | false | false | false | false |
cl_khr_fp64 | false | true | true | true |
cl_khr_gl_sharing | cl_APPLE_gl_sharing | true | true | true | true |
The CLInfo utility is part of the jocl-demos project and is also available via webstart. For a plain text version of the above output you can run:
java -jar jocl.jar:gluegen-rt.jar\ -Djava.library.path="path/to/jocl/libs:path/to/gluegen/libs" com.jogamp.opencl.util.CLInfo
(btw to install the intel sdk on debian based systems follow this link)
happy coding!