| 1 | package net.bmahe.genetics4j.gpu.spec.fitness.cldata; | |
| 2 | ||
| 3 | import org.apache.commons.lang3.Validate; | |
| 4 | import org.jocl.CL; | |
| 5 | import org.jocl.Sizeof; | |
| 6 | import org.jocl.cl_image_desc; | |
| 7 | import org.jocl.cl_image_format; | |
| 8 | import org.jocl.cl_mem; | |
| 9 | ||
| 10 | import net.bmahe.genetics4j.gpu.spec.fitness.MultipleComputer; | |
| 11 | ||
| 12 | public class ResultAllocators { | |
| 13 | ||
| 14 | private ResultAllocators() { | |
| 15 | } | |
| 16 | ||
| 17 | public static ResultAllocator ofSize(final int type, final int size) { | |
| 18 | Validate.isTrue(type > 0); | |
| 19 | Validate.isTrue(size > 0); | |
| 20 | ||
| 21 |
1
1. ofSize : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE |
return (openCLExecutionContext, kernelExecutionContext, generation, genotypes) -> { |
| 22 | ||
| 23 |
1
1. lambda$ofSize$0 : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE |
final var clContext = openCLExecutionContext.clContext(); |
| 24 | ||
| 25 |
3
1. lambda$ofSize$0 : removed call to org/jocl/CL::clCreateBuffer → NO_COVERAGE 2. lambda$ofSize$0 : Substituted 2 with 3 → NO_COVERAGE 3. lambda$ofSize$0 : Replaced integer multiplication with division → NO_COVERAGE |
final cl_mem clMem = CL.clCreateBuffer(clContext, CL.CL_MEM_WRITE_ONLY, type * size, null, null); |
| 26 | ||
| 27 |
2
1. lambda$ofSize$0 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE 2. lambda$ofSize$0 : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofSize$0 → NO_COVERAGE |
return CLData.of(clMem, type, size); |
| 28 | }; | |
| 29 | } | |
| 30 | ||
| 31 | public static ResultAllocator ofSizeFloat(final int size) { | |
| 32 | Validate.isTrue(size > 0); | |
| 33 | ||
| 34 |
3
1. ofSizeFloat : Substituted 4 with 5 → NO_COVERAGE 2. ofSizeFloat : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSizeFloat → NO_COVERAGE 3. ofSizeFloat : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE |
return ofSize(Sizeof.cl_float, size); |
| 35 | } | |
| 36 | ||
| 37 | public static ResultAllocator ofSizeInt(final int size) { | |
| 38 | Validate.isTrue(size > 0); | |
| 39 | ||
| 40 |
3
1. ofSizeInt : Substituted 4 with 5 → NO_COVERAGE 2. ofSizeInt : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE 3. ofSizeInt : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSizeInt → NO_COVERAGE |
return ofSize(Sizeof.cl_int, size); |
| 41 | } | |
| 42 | ||
| 43 | public static ResultAllocator ofMultiplePopulationSizeFloat(final MultipleComputer multipleComputer) { | |
| 44 | Validate.notNull(multipleComputer); | |
| 45 | ||
| 46 |
1
1. ofMultiplePopulationSizeFloat : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE |
return (openCLExecutionContext, kernelExecutionContext, generation, genotypes) -> { |
| 47 | ||
| 48 |
1
1. lambda$ofMultiplePopulationSizeFloat$1 : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE |
final var clContext = openCLExecutionContext.clContext(); |
| 49 | ||
| 50 | final int multiple = multipleComputer | |
| 51 |
1
1. lambda$ofMultiplePopulationSizeFloat$1 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/MultipleComputer::compute → NO_COVERAGE |
.compute(openCLExecutionContext, kernelExecutionContext, generation, genotypes); |
| 52 |
2
1. lambda$ofMultiplePopulationSizeFloat$1 : removed call to java/util/List::size → NO_COVERAGE 2. lambda$ofMultiplePopulationSizeFloat$1 : Replaced integer multiplication with division → NO_COVERAGE |
final int length = genotypes.size() * multiple; |
| 53 | ||
| 54 |
4
1. lambda$ofMultiplePopulationSizeFloat$1 : Substituted 4 with 5 → NO_COVERAGE 2. lambda$ofMultiplePopulationSizeFloat$1 : Replaced integer multiplication with division → NO_COVERAGE 3. lambda$ofMultiplePopulationSizeFloat$1 : Substituted 2 with 3 → NO_COVERAGE 4. lambda$ofMultiplePopulationSizeFloat$1 : removed call to org/jocl/CL::clCreateBuffer → NO_COVERAGE |
final cl_mem clMem = CL.clCreateBuffer(clContext, CL.CL_MEM_WRITE_ONLY, Sizeof.cl_float * length, null, null); |
| 55 | ||
| 56 |
3
1. lambda$ofMultiplePopulationSizeFloat$1 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE 2. lambda$ofMultiplePopulationSizeFloat$1 : Substituted 4 with 5 → NO_COVERAGE 3. lambda$ofMultiplePopulationSizeFloat$1 : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofMultiplePopulationSizeFloat$1 → NO_COVERAGE |
return CLData.of(clMem, Sizeof.cl_float, length); |
| 57 | }; | |
| 58 | } | |
| 59 | ||
| 60 | public static ResultAllocator ofMultiplePopulationSizeFloat(final int multiple) { | |
| 61 | Validate.isTrue(multiple > 0); | |
| 62 | ||
| 63 |
2
1. ofMultiplePopulationSizeFloat : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE 2. ofMultiplePopulationSizeFloat : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE |
return ofMultiplePopulationSizeFloat( |
| 64 |
1
1. lambda$ofMultiplePopulationSizeFloat$2 : replaced int return with 0 for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofMultiplePopulationSizeFloat$2 → NO_COVERAGE |
(openCLExecutionContext, kernelExecutionContext, generation, genotypes) -> multiple); |
| 65 | } | |
| 66 | ||
| 67 | public static ResultAllocator ofPopulationSizeFloat() { | |
| 68 |
3
1. ofPopulationSizeFloat : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofPopulationSizeFloat → NO_COVERAGE 2. ofPopulationSizeFloat : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE 3. ofPopulationSizeFloat : Substituted 1 with 0 → NO_COVERAGE |
return ofMultiplePopulationSizeFloat(1); |
| 69 | } | |
| 70 | ||
| 71 | public static ResultAllocator ofImage(final int width, final int height, final int channelOrder, | |
| 72 | final int dataType) { | |
| 73 | Validate.isTrue(width > 0); | |
| 74 | Validate.isTrue(height > 0); | |
| 75 | Validate.isTrue(channelOrder > 0); | |
| 76 | Validate.isTrue(dataType > 0); | |
| 77 | ||
| 78 |
1
1. ofImage : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE |
return (openCLExecutionContext, kernelExecutionContext, generation, genotypes) -> { |
| 79 |
1
1. lambda$ofImage$3 : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE |
final var clContext = openCLExecutionContext.clContext(); |
| 80 | ||
| 81 |
1
1. lambda$ofImage$3 : removed call to org/jocl/cl_image_desc::<init> → NO_COVERAGE |
final cl_image_desc imageDesc = new cl_image_desc(); |
| 82 |
2
1. lambda$ofImage$3 : Removed assignment to member variable image_type → NO_COVERAGE 2. lambda$ofImage$3 : Substituted 4337 with 4338 → NO_COVERAGE |
imageDesc.image_type = CL.CL_MEM_OBJECT_IMAGE2D; |
| 83 |
1
1. lambda$ofImage$3 : Removed assignment to member variable image_width → NO_COVERAGE |
imageDesc.image_width = width; |
| 84 |
1
1. lambda$ofImage$3 : Removed assignment to member variable image_height → NO_COVERAGE |
imageDesc.image_height = height; |
| 85 | ||
| 86 |
1
1. lambda$ofImage$3 : removed call to org/jocl/cl_image_format::<init> → NO_COVERAGE |
cl_image_format imageFormat = new cl_image_format(); |
| 87 |
1
1. lambda$ofImage$3 : Removed assignment to member variable image_channel_order → NO_COVERAGE |
imageFormat.image_channel_order = channelOrder; |
| 88 |
1
1. lambda$ofImage$3 : Removed assignment to member variable image_channel_data_type → NO_COVERAGE |
imageFormat.image_channel_data_type = dataType; |
| 89 | ||
| 90 |
1
1. lambda$ofImage$3 : Substituted 2 with 3 → NO_COVERAGE |
final cl_mem clImageMem = CL |
| 91 |
1
1. lambda$ofImage$3 : removed call to org/jocl/CL::clCreateImage → NO_COVERAGE |
.clCreateImage(clContext, CL.CL_MEM_WRITE_ONLY, imageFormat, imageDesc, null, null); |
| 92 |
3
1. lambda$ofImage$3 : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofImage$3 → NO_COVERAGE 2. lambda$ofImage$3 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE 3. lambda$ofImage$3 : Substituted 1 with 0 → NO_COVERAGE |
return CLData.of(clImageMem, Sizeof.cl_mem, 1); |
| 93 | }; | |
| 94 | } | |
| 95 | ||
| 96 | public static ResultAllocator ofImage(final int width, final int height) { | |
| 97 |
4
1. ofImage : replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE 2. ofImage : Substituted 4277 with 4278 → NO_COVERAGE 3. ofImage : removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE 4. ofImage : Substituted 4318 with 4319 → NO_COVERAGE |
return ofImage(width, height, CL.CL_RGBA, CL.CL_FLOAT); |
| 98 | } | |
| 99 | } | |
Mutations | ||
| 21 |
1.1 |
|
| 23 |
1.1 |
|
| 25 |
1.1 2.2 3.3 |
|
| 27 |
1.1 2.2 |
|
| 34 |
1.1 2.2 3.3 |
|
| 40 |
1.1 2.2 3.3 |
|
| 46 |
1.1 |
|
| 48 |
1.1 |
|
| 51 |
1.1 |
|
| 52 |
1.1 2.2 |
|
| 54 |
1.1 2.2 3.3 4.4 |
|
| 56 |
1.1 2.2 3.3 |
|
| 63 |
1.1 2.2 |
|
| 64 |
1.1 |
|
| 68 |
1.1 2.2 3.3 |
|
| 78 |
1.1 |
|
| 79 |
1.1 |
|
| 81 |
1.1 |
|
| 82 |
1.1 2.2 |
|
| 83 |
1.1 |
|
| 84 |
1.1 |
|
| 86 |
1.1 |
|
| 87 |
1.1 |
|
| 88 |
1.1 |
|
| 90 |
1.1 |
|
| 91 |
1.1 |
|
| 92 |
1.1 2.2 3.3 |
|
| 97 |
1.1 2.2 3.3 4.4 |