Skip to content

Commit caeb607

Browse files
committed
Added CLDevice.getPartitionType()
1 parent dc90deb commit caeb607

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Core/src/main/velocity/com/nativelibs4java/opencl/CLDevice.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,12 +734,25 @@ public static PartitionType getEnum(long v) {
734734
735735
@InfoName("CL_DEVICE_PARTITION_PROPERTIES")
736736
public EnumSet<PartitionType> getPartitionProperties() {
737+
return getPartitionTypeInfo(CL_DEVICE_PARTITION_PROPERTIES);
738+
}
739+
740+
@InfoName("CL_DEVICE_PARTITION_TYPE")
741+
public EnumSet<PartitionType> getPartitionType() {
742+
return getPartitionTypeInfo(CL_DEVICE_PARTITION_TYPE);
743+
}
744+
745+
private EnumSet<PartitionType> getPartitionTypeInfo(int info) {
737746
EnumSet<PartitionType> ret = EnumSet.noneOf(PartitionType.class);
738-
Pointer<?> ptr = infos.getPointer(getEntity(), CL_DEVICE_PARTITION_PROPERTIES);;
747+
Pointer<?> ptr = infos.getPointer(getEntity(), info);
739748
if (ptr != null) {
740749
Pointer<SizeT> props = ptr.as(SizeT.class);
741750
for (long i = 0, n = props.getValidElements(); i < n; i++) {
742-
ret.add(PartitionType.getEnum(props.getSizeTAtIndex(i)));
751+
long value = props.getSizeTAtIndex(i);
752+
if (value == 0) {
753+
break;
754+
}
755+
ret.add(PartitionType.getEnum(value));
743756
}
744757
}
745758
return ret;
@@ -756,7 +769,11 @@ public EnumSet<AffinityDomain> getPartitionAffinityDomains() {
756769
if (ptr != null) {
757770
Pointer<SizeT> props = ptr.as(SizeT.class);
758771
for (long i = 0, n = props.getValidElements(); i < n; i++) {
759-
ret.add(AffinityDomain.getEnum(props.getSizeTAtIndex(i)));
772+
long value = props.getSizeTAtIndex(i);
773+
if (value == 0) {
774+
break;
775+
}
776+
ret.add(AffinityDomain.getEnum(value));
760777
}
761778
}
762779
return ret;

0 commit comments

Comments
 (0)