JCL 示例中的错误 CL_DEVICE_NOT_AVAILABLE
Error CL_DEVICE_NOT_AVAILABLE in JOCL sampels
我需要将 OpenCl 与 java 一起使用,所以我选择了 JOCL
当我想尝试 jocl 示例 (http://www.jocl.org/samples/samples.html) 时,我总是在编译示例时发现此错误。
例如示例 (JOCLSample_1_2_KernelArgs.java) 显示此错误:
**Exception in thread "main" org.jocl.CLException: CL_DEVICE_NOT_AVAILABLE
at org.jocl.CL.checkResult(CL.java:686)
at org.jocl.CL.clCreateContext(CL.java:3803)
at org.jocl.JOCLSample_1_2_KernelArgs.defaultInitialization(JOCLSample_1_2_KernelArgs.java:177)
at org.jocl.JOCLSample_1_2_KernelArgs.main(JOCLSample_1_2_KernelArgs.java:42)**
我确定我的驱动程序运行良好。
当我编译示例时 JOCLDeviceQuery.java(显示查询并打印有关所有可用设备的信息。)
这是结果:
Number of platforms: 4
Number of devices in platform Intel(R) OpenCL: 2
Number of devices in platform NVIDIA CUDA: 1
Number of devices in platform Experimental OpenCL 2.0 CPU Only Platform: 1
Number of devices in platform AMD Accelerated Parallel Processing: 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz: ---
CL_DEVICE_NAME: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 5.0.0.57
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 4
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 / 8192 / 8192
CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1800 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 998 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 3995 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 128 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) HD Graphics 4000: ---
CL_DEVICE_NAME: Intel(R) HD Graphics 4000
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 9.17.10.2828
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 16
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 512 / 512 / 512
CL_DEVICE_MAX_WORK_GROUP_SIZE: 512
CL_DEVICE_MAX_CLOCK_FREQUENCY: 350 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 406 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 1624 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: local
CL_DEVICE_LOCAL_MEM_SIZE: 64 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST CL_FP_ROUND_TO_ZERO CL_FP_ROUND_TO_INF
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 0
--- Info for device GeForce GT 630M: ---
CL_DEVICE_NAME: GeForce GT 630M
CL_DEVICE_VENDOR: NVIDIA Corporation
CL_DRIVER_VERSION: 352.86
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 2
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 / 1024 / 64
CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1600 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 256 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 1024 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: local
CL_DEVICE_LOCAL_MEM_SIZE: 48 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST CL_FP_ROUND_TO_ZERO CL_FP_ROUND_TO_INF CL_FP_FMA CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz: ---
CL_DEVICE_NAME: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 6.0.0.1049
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 4
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 / 8192 / 8192
CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1800 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 998 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 3995 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 128 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
我的问题的解决方案是什么??????如何编译 jocl 示例???
尝试更改设备类型 CL_DEVICE_TYPE_ALL
到CL_DEVICE_TYPE_CPU或CL_DEVICE_TYPE_GPU
在OpenCL中,最好不要混用设备类型
查看 example code
public class JOCLSample_1_2_KernelArgs
{
// The platform, device type and device number that will be used
private static final int platformIndex = 0;
private static final long deviceType = CL_DEVICE_TYPE_ALL;
...
我需要将 OpenCl 与 java 一起使用,所以我选择了 JOCL 当我想尝试 jocl 示例 (http://www.jocl.org/samples/samples.html) 时,我总是在编译示例时发现此错误。
例如示例 (JOCLSample_1_2_KernelArgs.java) 显示此错误:
**Exception in thread "main" org.jocl.CLException: CL_DEVICE_NOT_AVAILABLE
at org.jocl.CL.checkResult(CL.java:686)
at org.jocl.CL.clCreateContext(CL.java:3803)
at org.jocl.JOCLSample_1_2_KernelArgs.defaultInitialization(JOCLSample_1_2_KernelArgs.java:177)
at org.jocl.JOCLSample_1_2_KernelArgs.main(JOCLSample_1_2_KernelArgs.java:42)**
我确定我的驱动程序运行良好。
当我编译示例时 JOCLDeviceQuery.java(显示查询并打印有关所有可用设备的信息。)
这是结果:
Number of platforms: 4
Number of devices in platform Intel(R) OpenCL: 2
Number of devices in platform NVIDIA CUDA: 1
Number of devices in platform Experimental OpenCL 2.0 CPU Only Platform: 1
Number of devices in platform AMD Accelerated Parallel Processing: 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz: ---
CL_DEVICE_NAME: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 5.0.0.57
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 4
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 / 8192 / 8192
CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1800 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 998 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 3995 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 128 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) HD Graphics 4000: ---
CL_DEVICE_NAME: Intel(R) HD Graphics 4000
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 9.17.10.2828
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 16
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 512 / 512 / 512
CL_DEVICE_MAX_WORK_GROUP_SIZE: 512
CL_DEVICE_MAX_CLOCK_FREQUENCY: 350 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 406 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 1624 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: local
CL_DEVICE_LOCAL_MEM_SIZE: 64 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST CL_FP_ROUND_TO_ZERO CL_FP_ROUND_TO_INF
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 0
--- Info for device GeForce GT 630M: ---
CL_DEVICE_NAME: GeForce GT 630M
CL_DEVICE_VENDOR: NVIDIA Corporation
CL_DRIVER_VERSION: 352.86
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 2
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 / 1024 / 64
CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1600 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 256 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 1024 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: local
CL_DEVICE_LOCAL_MEM_SIZE: 48 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST CL_FP_ROUND_TO_ZERO CL_FP_ROUND_TO_INF CL_FP_FMA CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz: ---
CL_DEVICE_NAME: Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DRIVER_VERSION: 6.0.0.1049
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 4
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 / 8192 / 8192
CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1800 MHz
CL_DEVICE_ADDRESS_BITS: 64
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 998 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 3995 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 128 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
CL_DEVICE_2D_MAX_WIDTH 16384
CL_DEVICE_2D_MAX_HEIGHT 16384
CL_DEVICE_3D_MAX_WIDTH 2048
CL_DEVICE_3D_MAX_HEIGHT 2048
CL_DEVICE_3D_MAX_DEPTH 2048
CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 1, SHORT 1, INT 1, LONG 1, FLOAT 1, DOUBLE 1
--- Info for device Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
我的问题的解决方案是什么??????如何编译 jocl 示例???
尝试更改设备类型 CL_DEVICE_TYPE_ALL
到CL_DEVICE_TYPE_CPU或CL_DEVICE_TYPE_GPU
在OpenCL中,最好不要混用设备类型
查看 example code
public class JOCLSample_1_2_KernelArgs
{
// The platform, device type and device number that will be used
private static final int platformIndex = 0;
private static final long deviceType = CL_DEVICE_TYPE_ALL;
...