1 | package net.bmahe.genetics4j.gpu.opencl; | |
2 | ||
3 | import org.apache.commons.lang3.StringUtils; | |
4 | import org.apache.commons.lang3.Validate; | |
5 | import org.apache.logging.log4j.LogManager; | |
6 | import org.apache.logging.log4j.Logger; | |
7 | import org.jocl.CL; | |
8 | import org.jocl.cl_device_id; | |
9 | import org.jocl.cl_platform_id; | |
10 | ||
11 | import net.bmahe.genetics4j.gpu.opencl.model.Device; | |
12 | import net.bmahe.genetics4j.gpu.opencl.model.DeviceType; | |
13 | ||
14 | public class DeviceReader { | |
15 | public static final Logger logger = LogManager.getLogger(DeviceReader.class); | |
16 | ||
17 | public Device read(final cl_platform_id platformId, final cl_device_id deviceId) { | |
18 | Validate.notNull(platformId); | |
19 | Validate.notNull(deviceId); | |
20 | ||
21 |
1
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::builder → NO_COVERAGE |
final var deviceBuilder = Device.builder(); |
22 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::deviceId with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::deviceId → NO_COVERAGE |
deviceBuilder.deviceId(deviceId); |
23 | ||
24 |
2
1. read : Substituted 4139 with 4140 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoString → NO_COVERAGE |
final String name = DeviceUtils.getDeviceInfoString(deviceId, CL.CL_DEVICE_NAME); |
25 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::name → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::name with receiver → NO_COVERAGE |
deviceBuilder.name(name); |
26 | ||
27 |
2
1. read : Substituted 4140 with 4141 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoString → NO_COVERAGE |
final String vendor = DeviceUtils.getDeviceInfoString(deviceId, CL.CL_DEVICE_VENDOR); |
28 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::vendor with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::vendor → NO_COVERAGE |
deviceBuilder.vendor(vendor); |
29 | ||
30 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoString → NO_COVERAGE 2. read : Substituted 4143 with 4144 → NO_COVERAGE |
final String deviceVersion = DeviceUtils.getDeviceInfoString(deviceId, CL.CL_DEVICE_VERSION); |
31 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::deviceVersion → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::deviceVersion with receiver → NO_COVERAGE |
deviceBuilder.deviceVersion(deviceVersion); |
32 | ||
33 |
2
1. read : Substituted 4141 with 4142 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoString → NO_COVERAGE |
final String driverVersion = DeviceUtils.getDeviceInfoString(deviceId, CL.CL_DRIVER_VERSION); |
34 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::driverVersion with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::driverVersion → NO_COVERAGE |
deviceBuilder.driverVersion(driverVersion); |
35 | ||
36 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoString → NO_COVERAGE 2. read : Substituted 4159 with 4160 → NO_COVERAGE |
final String builtInKernelsStr = DeviceUtils.getDeviceInfoString(deviceId, CL.CL_DEVICE_BUILT_IN_KERNELS); |
37 |
4
1. read : removed conditional - replaced equality check with false → NO_COVERAGE 2. read : removed conditional - replaced equality check with true → NO_COVERAGE 3. read : removed call to org/apache/commons/lang3/StringUtils::isNotBlank → NO_COVERAGE 4. read : negated conditional → NO_COVERAGE |
if (StringUtils.isNotBlank(builtInKernelsStr)) { |
38 |
1
1. read : removed call to java/lang/String::split → NO_COVERAGE |
final String[] builtInKernelsArr = builtInKernelsStr.split(";"); |
39 |
4
1. read : removed conditional - replaced comparison check with true → NO_COVERAGE 2. read : negated conditional → NO_COVERAGE 3. read : changed conditional boundary → NO_COVERAGE 4. read : removed conditional - replaced comparison check with false → NO_COVERAGE |
if (builtInKernelsArr.length > 0) { |
40 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addBuiltInKernels with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addBuiltInKernels → NO_COVERAGE |
deviceBuilder.addBuiltInKernels(builtInKernelsArr); |
41 | } | |
42 | } | |
43 | ||
44 |
2
1. read : Substituted 4096 with 4097 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoLong → NO_COVERAGE |
final long deviceTypeLong = DeviceUtils.getDeviceInfoLong(deviceId, CL.CL_DEVICE_TYPE); |
45 |
4
1. read : Substituted -1 with 0 → NO_COVERAGE 2. read : negated conditional → NO_COVERAGE 3. read : removed conditional - replaced equality check with false → NO_COVERAGE 4. read : removed conditional - replaced equality check with true → NO_COVERAGE |
if (deviceTypeLong == CL.CL_DEVICE_TYPE_ALL) { |
46 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.ALL); |
47 | } else { | |
48 | ||
49 |
6
1. read : Replaced bitwise AND with OR → NO_COVERAGE 2. read : Substituted 0 with 1 → NO_COVERAGE 3. read : negated conditional → NO_COVERAGE 4. read : removed conditional - replaced equality check with false → NO_COVERAGE 5. read : Substituted 1 with 2 → NO_COVERAGE 6. read : removed conditional - replaced equality check with true → NO_COVERAGE |
if ((deviceTypeLong & CL.CL_DEVICE_TYPE_DEFAULT) != 0) { |
50 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.DEFAULT); |
51 | } | |
52 |
6
1. read : negated conditional → NO_COVERAGE 2. read : removed conditional - replaced equality check with false → NO_COVERAGE 3. read : removed conditional - replaced equality check with true → NO_COVERAGE 4. read : Substituted 2 with 3 → NO_COVERAGE 5. read : Replaced bitwise AND with OR → NO_COVERAGE 6. read : Substituted 0 with 1 → NO_COVERAGE |
if ((deviceTypeLong & CL.CL_DEVICE_TYPE_CPU) != 0) { |
53 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.CPU); |
54 | } | |
55 |
6
1. read : Substituted 4 with 5 → NO_COVERAGE 2. read : removed conditional - replaced equality check with false → NO_COVERAGE 3. read : Substituted 0 with 1 → NO_COVERAGE 4. read : removed conditional - replaced equality check with true → NO_COVERAGE 5. read : negated conditional → NO_COVERAGE 6. read : Replaced bitwise AND with OR → NO_COVERAGE |
if ((deviceTypeLong & CL.CL_DEVICE_TYPE_GPU) != 0) { |
56 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.GPU); |
57 | } | |
58 |
6
1. read : removed conditional - replaced equality check with false → NO_COVERAGE 2. read : removed conditional - replaced equality check with true → NO_COVERAGE 3. read : Substituted 0 with 1 → NO_COVERAGE 4. read : Substituted 8 with 9 → NO_COVERAGE 5. read : Replaced bitwise AND with OR → NO_COVERAGE 6. read : negated conditional → NO_COVERAGE |
if ((deviceTypeLong & CL.CL_DEVICE_TYPE_ACCELERATOR) != 0) { |
59 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.ACCELERATOR); |
60 | } | |
61 |
6
1. read : removed conditional - replaced equality check with false → NO_COVERAGE 2. read : negated conditional → NO_COVERAGE 3. read : removed conditional - replaced equality check with true → NO_COVERAGE 4. read : Substituted 16 with 17 → NO_COVERAGE 5. read : Replaced bitwise AND with OR → NO_COVERAGE 6. read : Substituted 0 with 1 → NO_COVERAGE |
if ((deviceTypeLong & CL.CL_DEVICE_TYPE_CUSTOM) != 0) { |
62 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::addDeviceType → NO_COVERAGE |
deviceBuilder.addDeviceType(DeviceType.CUSTOM); |
63 | } | |
64 | } | |
65 | ||
66 |
3
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt with argument → NO_COVERAGE 3. read : Substituted 4098 with 4099 → NO_COVERAGE |
final int maxComputeUnits = DeviceUtils.getDeviceInfoInt(deviceId, CL.CL_DEVICE_MAX_COMPUTE_UNITS); |
67 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxComputeUnits with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxComputeUnits → NO_COVERAGE |
deviceBuilder.maxComputeUnits(maxComputeUnits); |
68 | ||
69 |
3
1. read : Substituted 4099 with 4100 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt → NO_COVERAGE 3. read : replaced call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt with argument → NO_COVERAGE |
final int maxWorkItemDimensions = DeviceUtils.getDeviceInfoInt(deviceId, CL.CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS); |
70 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkItemDimensions with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkItemDimensions → NO_COVERAGE |
deviceBuilder.maxWorkItemDimensions(maxWorkItemDimensions); |
71 | ||
72 |
3
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt with argument → NO_COVERAGE 3. read : Substituted 4108 with 4109 → NO_COVERAGE |
final int maxClockFrequency = DeviceUtils.getDeviceInfoInt(deviceId, CL.CL_DEVICE_MAX_CLOCK_FREQUENCY); |
73 |
2
1. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxClockFrequency with receiver → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxClockFrequency → NO_COVERAGE |
deviceBuilder.maxClockFrequency(maxClockFrequency); |
74 | ||
75 |
3
1. read : Substituted 4118 with 4119 → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt → NO_COVERAGE 3. read : replaced call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt with argument → NO_COVERAGE |
final int hasImageSupport = DeviceUtils.getDeviceInfoInt(deviceId, CL.CL_DEVICE_IMAGE_SUPPORT); |
76 |
7
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::imageSupport → NO_COVERAGE 2. read : Substituted 1 with 0 → NO_COVERAGE 3. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::imageSupport with receiver → NO_COVERAGE 4. read : removed conditional - replaced equality check with false → NO_COVERAGE 5. read : Substituted 0 with 1 → NO_COVERAGE 6. read : negated conditional → NO_COVERAGE 7. read : removed conditional - replaced equality check with true → NO_COVERAGE |
deviceBuilder.imageSupport(hasImageSupport != 0); |
77 | ||
78 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoLong → NO_COVERAGE 2. read : Substituted 4100 with 4101 → NO_COVERAGE |
final long maxWorkGroupSize = DeviceUtils.getDeviceInfoLong(deviceId, CL.CL_DEVICE_MAX_WORK_GROUP_SIZE); |
79 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkGroupSize → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkGroupSize with receiver → NO_COVERAGE |
deviceBuilder.maxWorkGroupSize(maxWorkGroupSize); |
80 | ||
81 |
3
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt → NO_COVERAGE 2. read : Substituted 4106 with 4107 → NO_COVERAGE 3. read : replaced call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoInt with argument → NO_COVERAGE |
final int preferredVectorWidthFloat = DeviceUtils.getDeviceInfoInt(deviceId, |
82 | CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT); | |
83 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::preferredVectorWidthFloat → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::preferredVectorWidthFloat with receiver → NO_COVERAGE |
deviceBuilder.preferredVectorWidthFloat(preferredVectorWidthFloat); |
84 | ||
85 |
1
1. read : Substituted 4101 with 4102 → NO_COVERAGE |
final long[] maxWorkItemSizes = DeviceUtils |
86 |
1
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceInfoLongArray → NO_COVERAGE |
.getDeviceInfoLongArray(deviceId, CL.CL_DEVICE_MAX_WORK_ITEM_SIZES, maxWorkItemDimensions); |
87 |
2
1. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkItemSizes → NO_COVERAGE 2. read : replaced call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::maxWorkItemSizes with receiver → NO_COVERAGE |
deviceBuilder.maxWorkItemSizes(maxWorkItemSizes); |
88 | ||
89 |
2
1. read : replaced return value with null for net/bmahe/genetics4j/gpu/opencl/DeviceReader::read → NO_COVERAGE 2. read : removed call to net/bmahe/genetics4j/gpu/opencl/model/ImmutableDevice$Builder::build → NO_COVERAGE |
return deviceBuilder.build(); |
90 | } | |
91 | } | |
Mutations | ||
21 |
1.1 |
|
22 |
1.1 2.2 |
|
24 |
1.1 2.2 |
|
25 |
1.1 2.2 |
|
27 |
1.1 2.2 |
|
28 |
1.1 2.2 |
|
30 |
1.1 2.2 |
|
31 |
1.1 2.2 |
|
33 |
1.1 2.2 |
|
34 |
1.1 2.2 |
|
36 |
1.1 2.2 |
|
37 |
1.1 2.2 3.3 4.4 |
|
38 |
1.1 |
|
39 |
1.1 2.2 3.3 4.4 |
|
40 |
1.1 2.2 |
|
44 |
1.1 2.2 |
|
45 |
1.1 2.2 3.3 4.4 |
|
46 |
1.1 2.2 |
|
49 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
50 |
1.1 2.2 |
|
52 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
53 |
1.1 2.2 |
|
55 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
56 |
1.1 2.2 |
|
58 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
59 |
1.1 2.2 |
|
61 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
62 |
1.1 2.2 |
|
66 |
1.1 2.2 3.3 |
|
67 |
1.1 2.2 |
|
69 |
1.1 2.2 3.3 |
|
70 |
1.1 2.2 |
|
72 |
1.1 2.2 3.3 |
|
73 |
1.1 2.2 |
|
75 |
1.1 2.2 3.3 |
|
76 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |
|
78 |
1.1 2.2 |
|
79 |
1.1 2.2 |
|
81 |
1.1 2.2 3.3 |
|
83 |
1.1 2.2 |
|
85 |
1.1 |
|
86 |
1.1 |
|
87 |
1.1 2.2 |
|
89 |
1.1 2.2 |