ResultAllocators.java

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

Mutations

23

1.1
Location : ofSize
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE

25

1.1
Location : lambda$ofSize$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE

27

1.1
Location : lambda$ofSize$0
Killed by : none
removed call to org/jocl/CL::clCreateBuffer → NO_COVERAGE

2.2
Location : lambda$ofSize$0
Killed by : none
Substituted 2 with 3 → NO_COVERAGE

3.3
Location : lambda$ofSize$0
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

29

1.1
Location : lambda$ofSize$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE

2.2
Location : lambda$ofSize$0
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofSize$0 → NO_COVERAGE

36

1.1
Location : ofSizeFloat
Killed by : none
Substituted 4 with 5 → NO_COVERAGE

2.2
Location : ofSizeFloat
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSizeFloat → NO_COVERAGE

3.3
Location : ofSizeFloat
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE

42

1.1
Location : ofSizeInt
Killed by : none
Substituted 4 with 5 → NO_COVERAGE

2.2
Location : ofSizeInt
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSize → NO_COVERAGE

3.3
Location : ofSizeInt
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofSizeInt → NO_COVERAGE

48

1.1
Location : ofMultiplePopulationSizeFloat
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE

50

1.1
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE

53

1.1
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/MultipleComputer::compute → NO_COVERAGE

54

1.1
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

2.2
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

56

1.1
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
Substituted 4 with 5 → NO_COVERAGE

2.2
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

3.3
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
Substituted 2 with 3 → NO_COVERAGE

4.4
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
removed call to org/jocl/CL::clCreateBuffer → NO_COVERAGE

58

1.1
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
Substituted 4 with 5 → NO_COVERAGE

2.2
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofMultiplePopulationSizeFloat$0 → NO_COVERAGE

3.3
Location : lambda$ofMultiplePopulationSizeFloat$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE

65

1.1
Location : ofMultiplePopulationSizeFloat
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE

2.2
Location : ofMultiplePopulationSizeFloat
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE

66

1.1
Location : lambda$ofMultiplePopulationSizeFloat$1
Killed by : none
replaced int return with 0 for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofMultiplePopulationSizeFloat$1 → NO_COVERAGE

70

1.1
Location : ofPopulationSizeFloat
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofPopulationSizeFloat → NO_COVERAGE

2.2
Location : ofPopulationSizeFloat
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofMultiplePopulationSizeFloat → NO_COVERAGE

3.3
Location : ofPopulationSizeFloat
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

80

1.1
Location : ofImage
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE

81

1.1
Location : lambda$ofImage$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::clContext → NO_COVERAGE

83

1.1
Location : lambda$ofImage$0
Killed by : none
removed call to org/jocl/cl_image_desc::<init> → NO_COVERAGE

84

1.1
Location : lambda$ofImage$0
Killed by : none
Removed assignment to member variable image_type → NO_COVERAGE

2.2
Location : lambda$ofImage$0
Killed by : none
Substituted 4337 with 4338 → NO_COVERAGE

85

1.1
Location : lambda$ofImage$0
Killed by : none
Removed assignment to member variable image_width → NO_COVERAGE

86

1.1
Location : lambda$ofImage$0
Killed by : none
Removed assignment to member variable image_height → NO_COVERAGE

88

1.1
Location : lambda$ofImage$0
Killed by : none
removed call to org/jocl/cl_image_format::<init> → NO_COVERAGE

89

1.1
Location : lambda$ofImage$0
Killed by : none
Removed assignment to member variable image_channel_order → NO_COVERAGE

90

1.1
Location : lambda$ofImage$0
Killed by : none
Removed assignment to member variable image_channel_data_type → NO_COVERAGE

92

1.1
Location : lambda$ofImage$0
Killed by : none
Substituted 2 with 3 → NO_COVERAGE

93

1.1
Location : lambda$ofImage$0
Killed by : none
removed call to org/jocl/CL::clCreateImage → NO_COVERAGE

94

1.1
Location : lambda$ofImage$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/CLData::of → NO_COVERAGE

2.2
Location : lambda$ofImage$0
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

3.3
Location : lambda$ofImage$0
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::lambda$ofImage$0 → NO_COVERAGE

99

1.1
Location : ofImage
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE

2.2
Location : ofImage
Killed by : none
Substituted 4277 with 4278 → NO_COVERAGE

3.3
Location : ofImage
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/cldata/ResultAllocators::ofImage → NO_COVERAGE

4.4
Location : ofImage
Killed by : none
Substituted 4318 with 4319 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support