CL_DEVICE_NOT_AVAILABLE error from clBuildProgram

How can I fix the following problem?

clBuildProgram yields the error code CL_DEVICE_NOT_AVAILABLE

  • This is not in compliance with the 1.2 specification
  • Context was successfully created with 1 device
  • This occurs if I use the default device list (0, NULL) or an explicit device list
  • This occurs for every device on my system

On MacBookPro, OS X 10.13 OpenCL device printout follows:


Platform number is: 1
Platform #0 is: Apple - Apple
	 Device number is: 3
	 Device #0: Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
		 CL_DEVICE_MAX_CLOCK_FREQUENCY = 3100
		 CL_DEVICE_MAX_COMPUTE_UNITS = 8
		 PROFILING = POSSIBLE
		 CL_DEVICE_MAX_WORK_GROUP_SIZE = 1024
		 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[0] = 1024
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[1] = 1
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[2] = 1
		 CL_DEVICE_HOST_UNIFIED_MEMORY = 1
		 CL_DEVICE_GLOBAL_MEM_SIZE = 17179869184
		 CL_DEVICE_LOCAL_MEM_TYPE = CL_GLOBAL
			 CL_DEVICE_LOCAL_MEM_SIZE = 32768
		 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 65536
		 CL_DEVICE_IMAGE_SUPPORT = 1
			 CL_DEVICE_IMAGE2D_MAX_WIDTH = 8192
			 CL_DEVICE_IMAGE2D_MAX_HEIGHT = 8192
			 CL_DEVICE_MAX_SAMPLERS = 16
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 16
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 8
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 4
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 2
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 4
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 2
		 CL_DEVICE_EXTENSIONS:
			 cl_APPLE_SetMemObjectDestructor
			 cl_APPLE_ContextLoggingFunctions
			 cl_APPLE_clut
			 cl_APPLE_query_kernel_names
			 cl_APPLE_gl_sharing
			 cl_khr_gl_event
			 cl_khr_fp64
			 cl_khr_global_int32_base_atomics
			 cl_khr_global_int32_extended_atomics
			 cl_khr_local_int32_base_atomics
			 cl_khr_local_int32_extended_atomics
			 cl_khr_byte_addressable_store
			 cl_khr_int64_base_atomics
			 cl_khr_int64_extended_atomics
			 cl_khr_3d_image_writes
			 cl_khr_image2d_from_buffer
			 cl_APPLE_fp64_basic_ops
			 cl_APPLE_fixed_alpha_channel_orders
			 cl_APPLE_biased_fixed_point_image_formats
			 cl_APPLE_command_queue_priority
	 Device #1: Intel(R) HD Graphics 630
		 CL_DEVICE_MAX_CLOCK_FREQUENCY = 1100
		 CL_DEVICE_MAX_COMPUTE_UNITS = 24
		 PROFILING = POSSIBLE
		 CL_DEVICE_MAX_WORK_GROUP_SIZE = 256
		 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[0] = 256
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[1] = 256
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[2] = 256
		 CL_DEVICE_HOST_UNIFIED_MEMORY = 1
		 CL_DEVICE_GLOBAL_MEM_SIZE = 1610612736
		 CL_DEVICE_LOCAL_MEM_TYPE = CL_LOCAL
			 CL_DEVICE_LOCAL_MEM_SIZE = 65536
		 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 65536
		 CL_DEVICE_IMAGE_SUPPORT = 1
			 CL_DEVICE_IMAGE2D_MAX_WIDTH = 16384
			 CL_DEVICE_IMAGE2D_MAX_HEIGHT = 16384
			 CL_DEVICE_MAX_SAMPLERS = 16
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0
		 CL_DEVICE_EXTENSIONS:
			 cl_APPLE_SetMemObjectDestructor
			 cl_APPLE_ContextLoggingFunctions
			 cl_APPLE_clut
			 cl_APPLE_query_kernel_names
			 cl_APPLE_gl_sharing
			 cl_khr_gl_event
			 cl_khr_global_int32_base_atomics
			 cl_khr_global_int32_extended_atomics
			 cl_khr_local_int32_base_atomics
			 cl_khr_local_int32_extended_atomics
			 cl_khr_byte_addressable_store
			 cl_khr_image2d_from_buffer
			 cl_khr_gl_depth_images
			 cl_khr_depth_images
			 cl_khr_3d_image_writes
	 Device #2: AMD Radeon Pro 560 Compute Engine
		 CL_DEVICE_MAX_CLOCK_FREQUENCY = 907
		 CL_DEVICE_MAX_COMPUTE_UNITS = 16
		 PROFILING = POSSIBLE
		 CL_DEVICE_MAX_WORK_GROUP_SIZE = 256
		 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 3
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[0] = 256
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[1] = 256
			 CL_DEVICE_MAX_WORK_ITEM_SIZES[2] = 256
		 CL_DEVICE_HOST_UNIFIED_MEMORY = 0
		 CL_DEVICE_GLOBAL_MEM_SIZE = 4294967296
		 CL_DEVICE_LOCAL_MEM_TYPE = CL_LOCAL
			 CL_DEVICE_LOCAL_MEM_SIZE = 32768
		 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 65536
		 CL_DEVICE_IMAGE_SUPPORT = 1
			 CL_DEVICE_IMAGE2D_MAX_WIDTH = 16384
			 CL_DEVICE_IMAGE2D_MAX_HEIGHT = 16384
			 CL_DEVICE_MAX_SAMPLERS = 16
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 4
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 2
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 1
		 CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 1
		 CL_DEVICE_EXTENSIONS:
			 cl_APPLE_SetMemObjectDestructor
			 cl_APPLE_ContextLoggingFunctions
			 cl_APPLE_clut
			 cl_APPLE_query_kernel_names
			 cl_APPLE_gl_sharing
			 cl_khr_gl_event
			 cl_khr_global_int32_base_atomics
			 cl_khr_global_int32_extended_atomics
			 cl_khr_local_int32_base_atomics
			 cl_khr_local_int32_extended_atomics
			 cl_khr_byte_addressable_store
			 cl_khr_image2d_from_buffer
			 cl_khr_depth_images
			 cl_APPLE_command_queue_priority
			 cl_APPLE_command_queue_select_compute_units
			 cl_khr_fp64

For what it is worth, all of the code in question successfully compiles & runs on Windows machines (Intel & Nvidia platforms). The issue is only encountered when trying to run on OS X.

Here are the error strings provided by the 3 devices…
I’m investigating a reason for these errors.

Nevertheless, CL_DEVICE_NOT_AVAILABLE is not an allowed return value according to the v1.2 specification from 11/14/12

Platform = Apple
Device = Intel® Core™ i7-7920HQ CPU @ 3.10GHz
Error: CL_DEVICE_NOT_AVAILABLE
build program driver returned (-3):
Intel® Core™ i7-7920HQ CPU @ 3.10GHz:
No kernels or only kernel prototypes found when build executable.

Platform = Apple
Device = Intel® HD Graphics 630
Error: CL_DEVICE_NOT_AVAILABLE
Build Program driver returned (10015):
Intel® HD Graphics 630:
Compile Server Error.

Platform = Apple
Device = AMD Radeon Pro 560 Compute Engine
Error: CL_DEVICE_NOT_AVAILABLE
Build Program driver returned (-2):
AMD Radeon Pro 560 Compute Engine:
No kernels or only kernel prototypes found.

Found the reason for the errors.
Question regarding standards compliance remains…

I Think problem in driver side…