编辑:问题解决了!rzymek 的回答很有帮助。
问题:对于 JOCL,如何通过设备裂变从 opencl 计算中排除一些 CPU 内核?(cl_device_partition_property 的 Java 端口在 0.1.9 版本中似乎已损坏)
编辑:我发现了这个:
clCreateSubDevices(devices[0][1],core , 1, cpuCores, coreIDs);
但 java/jocl 不接受这个:
cl_device_partition_property core=CL.CL_DEVICE_PARTITION_BY_COUNTS;
错误是:
Type mismatch: cannot convert from int to cl_device_partition_property
刚刚尝试空初始化,然后使用变量自己的方法来设置属性:
cl_device_partition_property core = null;
core.addProperty(CL_DEVICE_PARTITION_BY_COUNTS, platforms[0]);
编辑:现在它给出了
java.lang.NullPointerException,
错误。
IT 需要是 unsigned int(不是 cl_device_partition_property),但 java 没有。
使用构造函数的新尝试:
cl_device_partition_property core = new cl_device_partition_property();
错误:
A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fedb6500bf, pid=4952, tid=4852
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [amdocl64.dll+0x1800bf] clGetSamplerInfo+0x1972f
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\javalar\buraya\paralelProje\hs_err_pid4952.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[error occurred during error reporting , id 0xc0000005]
另一个尝试:
cl_device_partition_property core = (CL_UNSIGNED_INT32)CL_DEVICE_PARTITION_BY_COUNTS;
错误:
CL_UNSIGNED_INT32 cannot be resolved to a type
这也不起作用:
Pointer xyz=Pointer.to(core); // jocl's pointer type.
clCreateSubDevices(device,xyz, 1, cpuCores, coreIDs);
编辑:问题解决了!谢谢。现在可以分区我的cpu: