GPUFitnessEvaluator.java

1
package net.bmahe.genetics4j.gpu;
2
3
import java.io.IOException;
4
import java.nio.charset.StandardCharsets;
5
import java.util.ArrayList;
6
import java.util.HashMap;
7
import java.util.List;
8
import java.util.Map;
9
import java.util.Objects;
10
import java.util.Set;
11
import java.util.concurrent.CompletableFuture;
12
import java.util.concurrent.ExecutorService;
13
14
import org.apache.commons.collections4.ListUtils;
15
import org.apache.commons.io.IOUtils;
16
import org.apache.commons.lang3.Validate;
17
import org.apache.commons.lang3.tuple.Pair;
18
import org.apache.logging.log4j.LogManager;
19
import org.apache.logging.log4j.Logger;
20
import org.jocl.CL;
21
import org.jocl.cl_command_queue;
22
import org.jocl.cl_context;
23
import org.jocl.cl_context_properties;
24
import org.jocl.cl_device_id;
25
import org.jocl.cl_kernel;
26
import org.jocl.cl_platform_id;
27
import org.jocl.cl_program;
28
import org.jocl.cl_queue_properties;
29
30
import net.bmahe.genetics4j.core.Genotype;
31
import net.bmahe.genetics4j.core.evaluation.FitnessEvaluator;
32
import net.bmahe.genetics4j.gpu.opencl.DeviceReader;
33
import net.bmahe.genetics4j.gpu.opencl.DeviceUtils;
34
import net.bmahe.genetics4j.gpu.opencl.KernelInfoReader;
35
import net.bmahe.genetics4j.gpu.opencl.OpenCLExecutionContext;
36
import net.bmahe.genetics4j.gpu.opencl.PlatformReader;
37
import net.bmahe.genetics4j.gpu.opencl.PlatformUtils;
38
import net.bmahe.genetics4j.gpu.opencl.model.Device;
39
import net.bmahe.genetics4j.gpu.opencl.model.KernelInfo;
40
import net.bmahe.genetics4j.gpu.opencl.model.Platform;
41
import net.bmahe.genetics4j.gpu.spec.GPUEAConfiguration;
42
import net.bmahe.genetics4j.gpu.spec.GPUEAExecutionContext;
43
import net.bmahe.genetics4j.gpu.spec.Program;
44
45
/**
46
 * GPU-accelerated fitness evaluator that leverages OpenCL for high-performance evolutionary algorithm execution.
47
 * 
48
 * <p>GPUFitnessEvaluator implements the core {@link FitnessEvaluator} interface to provide GPU acceleration for fitness
49
 * computation in evolutionary algorithms. This evaluator manages the complete OpenCL lifecycle, from device discovery
50
 * and kernel compilation to memory management and resource cleanup.
51
 * 
52
 * <p>Key responsibilities include:
53
 * <ul>
54
 * <li><strong>OpenCL initialization</strong>: Platform and device discovery, context creation, and kernel
55
 * compilation</li>
56
 * <li><strong>Resource management</strong>: Managing OpenCL contexts, command queues, programs, and kernels</li>
57
 * <li><strong>Population partitioning</strong>: Distributing work across multiple OpenCL devices</li>
58
 * <li><strong>Asynchronous execution</strong>: Coordinating concurrent GPU operations with CPU-side logic</li>
59
 * <li><strong>Memory lifecycle</strong>: Ensuring proper cleanup of GPU resources</li>
60
 * </ul>
61
 * 
62
 * <p>Architecture overview:
63
 * <ol>
64
 * <li><strong>Initialization ({@link #preEvaluation})</strong>: Discover platforms/devices, compile kernels, create
65
 * contexts</li>
66
 * <li><strong>Evaluation ({@link #evaluate})</strong>: Partition population, execute fitness computation on GPU</li>
67
 * <li><strong>Cleanup ({@link #postEvaluation})</strong>: Release all OpenCL resources and contexts</li>
68
 * </ol>
69
 * 
70
 * <p>Multi-device support:
71
 * <ul>
72
 * <li><strong>Device filtering</strong>: Selects devices based on user-defined criteria (type, capabilities)</li>
73
 * <li><strong>Load balancing</strong>: Automatically distributes population across available devices</li>
74
 * <li><strong>Parallel execution</strong>: Concurrent fitness evaluation on multiple GPUs or devices</li>
75
 * <li><strong>Asynchronous coordination</strong>: Non-blocking execution with CompletableFuture-based results</li>
76
 * </ul>
77
 * 
78
 * <p>Resource management patterns:
79
 * <ul>
80
 * <li><strong>Lazy initialization</strong>: OpenCL resources created only when needed</li>
81
 * <li><strong>Automatic cleanup</strong>: Guaranteed resource release through lifecycle methods</li>
82
 * <li><strong>Error recovery</strong>: Robust handling of OpenCL errors and device failures</li>
83
 * <li><strong>Memory optimization</strong>: Efficient GPU memory usage and transfer patterns</li>
84
 * </ul>
85
 * 
86
 * <p>Example usage in GPU EA system:
87
 * 
88
 * <pre>{@code
89
 * // GPU configuration with OpenCL kernel
90
 * Program fitnessProgram = Program.ofResource("/kernels/optimization.cl");
91
 * GPUEAConfiguration<Double> config = GPUEAConfigurationBuilder.<Double>builder()
92
 * 		.program(fitnessProgram)
93
 * 		.fitness(new MyGPUFitness())
94
 * 		// ... other EA configuration
95
 * 		.build();
96
 * 
97
 * // Execution context with device preferences
98
 * GPUEAExecutionContext<Double> context = GPUEAExecutionContextBuilder.<Double>builder()
99
 * 		.populationSize(2000)
100
 * 		.deviceFilter(device -> device.type() == DeviceType.GPU)
101
 * 		.platformFilter(platform -> platform.profile() == PlatformProfile.FULL_PROFILE)
102
 * 		.build();
103
 * 
104
 * // Evaluator handles all OpenCL lifecycle automatically
105
 * GPUFitnessEvaluator<Double> evaluator = new GPUFitnessEvaluator<>(context, config, executorService);
106
 * 
107
 * // Used by EA system - lifecycle managed automatically
108
 * EASystem<Double> system = EASystemFactory.from(config, context, executorService, evaluator);
109
 * }</pre>
110
 * 
111
 * <p>Performance characteristics:
112
 * <ul>
113
 * <li><strong>Initialization overhead</strong>: One-time setup cost for OpenCL compilation and context creation</li>
114
 * <li><strong>Scalability</strong>: Performance scales with population size and problem complexity</li>
115
 * <li><strong>Memory bandwidth</strong>: Optimal for problems with high computational intensity</li>
116
 * <li><strong>Concurrency</strong>: Supports concurrent evaluation across multiple devices</li>
117
 * </ul>
118
 * 
119
 * <p>Error handling:
120
 * <ul>
121
 * <li><strong>Device failures</strong>: Graceful degradation when devices become unavailable</li>
122
 * <li><strong>Memory errors</strong>: Proper cleanup and error reporting for GPU memory issues</li>
123
 * <li><strong>Compilation errors</strong>: Clear error messages for kernel compilation failures</li>
124
 * <li><strong>Resource leaks</strong>: Guaranteed cleanup even in exceptional circumstances</li>
125
 * </ul>
126
 * 
127
 * @param <T> the type of fitness values produced, must be comparable for selection operations
128
 * @see FitnessEvaluator
129
 * @see GPUEAConfiguration
130
 * @see GPUEAExecutionContext
131
 * @see OpenCLExecutionContext
132
 * @see net.bmahe.genetics4j.gpu.fitness.OpenCLFitness
133
 */
134
public class GPUFitnessEvaluator<T extends Comparable<T>> implements FitnessEvaluator<T> {
135
	public static final Logger logger = LogManager.getLogger(GPUFitnessEvaluator.class);
136
137
	private final GPUEAExecutionContext<T> gpuEAExecutionContext;
138
	private final GPUEAConfiguration<T> gpuEAConfiguration;
139
	private final ExecutorService executorService;
140
141
	private List<Pair<Platform, Device>> selectedPlatformToDevice;
142
143 2 1. <init> : Removed assignment to member variable clContexts → NO_COVERAGE
2. <init> : removed call to java/util/ArrayList::<init> → NO_COVERAGE
	final List<cl_context> clContexts = new ArrayList<>();
144 2 1. <init> : removed call to java/util/ArrayList::<init> → NO_COVERAGE
2. <init> : Removed assignment to member variable clCommandQueues → NO_COVERAGE
	final List<cl_command_queue> clCommandQueues = new ArrayList<>();
145 2 1. <init> : Removed assignment to member variable clPrograms → NO_COVERAGE
2. <init> : removed call to java/util/ArrayList::<init> → NO_COVERAGE
	final List<cl_program> clPrograms = new ArrayList<>();
146 2 1. <init> : Removed assignment to member variable clKernels → NO_COVERAGE
2. <init> : removed call to java/util/ArrayList::<init> → NO_COVERAGE
	final List<Map<String, cl_kernel>> clKernels = new ArrayList<>();
147 2 1. <init> : Removed assignment to member variable clExecutionContexts → NO_COVERAGE
2. <init> : removed call to java/util/ArrayList::<init> → NO_COVERAGE
	final List<OpenCLExecutionContext> clExecutionContexts = new ArrayList<>();
148
149
	/**
150
	 * Constructs a GPU fitness evaluator with the specified configuration and execution context.
151
	 * 
152
	 * <p>Initializes the evaluator with GPU-specific configuration and execution parameters. The evaluator will use the
153
	 * provided executor service for coordinating asynchronous operations between CPU and GPU components.
154
	 * 
155
	 * <p>The constructor performs minimal initialization - the actual OpenCL setup occurs during
156
	 * {@link #preEvaluation()} to follow the fitness evaluator lifecycle pattern.
157
	 * 
158
	 * @param _gpuEAExecutionContext the GPU execution context with device filters and population settings
159
	 * @param _gpuEAConfiguration    the GPU EA configuration with OpenCL program and fitness function
160
	 * @param _executorService       the executor service for managing asynchronous operations
161
	 * @throws IllegalArgumentException if any parameter is null
162
	 */
163
	public GPUFitnessEvaluator(final GPUEAExecutionContext<T> _gpuEAExecutionContext,
164
			final GPUEAConfiguration<T> _gpuEAConfiguration,
165
			final ExecutorService _executorService) {
166
		Objects.requireNonNull(_gpuEAExecutionContext);
167
		Objects.requireNonNull(_gpuEAConfiguration);
168
		Objects.requireNonNull(_executorService);
169
170 1 1. <init> : Removed assignment to member variable gpuEAExecutionContext → NO_COVERAGE
		this.gpuEAExecutionContext = _gpuEAExecutionContext;
171 1 1. <init> : Removed assignment to member variable gpuEAConfiguration → NO_COVERAGE
		this.gpuEAConfiguration = _gpuEAConfiguration;
172 1 1. <init> : Removed assignment to member variable executorService → NO_COVERAGE
		this.executorService = _executorService;
173
174 2 1. <init> : removed call to org/jocl/CL::setExceptionsEnabled → NO_COVERAGE
2. <init> : Substituted 1 with 0 → NO_COVERAGE
		CL.setExceptionsEnabled(true);
175
	}
176
177
	private String loadResource(final String filename) {
178
		Validate.notBlank(filename);
179
180
		try {
181 3 1. loadResource : replaced call to org/apache/commons/io/IOUtils::resourceToString with argument → NO_COVERAGE
2. loadResource : replaced return value with "" for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::loadResource → NO_COVERAGE
3. loadResource : removed call to org/apache/commons/io/IOUtils::resourceToString → NO_COVERAGE
			return IOUtils.resourceToString(filename, StandardCharsets.UTF_8);
182
		} catch (IOException e) {
183 1 1. loadResource : removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE
			throw new IllegalStateException("Unable to load resource " + filename, e);
184
		}
185
	}
186
187
	private List<String> grabProgramSources() {
188 1 1. grabProgramSources : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE
		final Program programSpec = gpuEAConfiguration.program();
189
190
		logger.info("Load program source: {}", programSpec);
191
192 1 1. grabProgramSources : removed call to java/util/ArrayList::<init> → NO_COVERAGE
		final List<String> sources = new ArrayList<>();
193
194 2 1. grabProgramSources : removed call to net/bmahe/genetics4j/gpu/spec/Program::content → NO_COVERAGE
2. grabProgramSources : removed call to java/util/List::addAll → NO_COVERAGE
		sources.addAll(programSpec.content());
195
196 6 1. lambda$grabProgramSources$0 : removed call to java/util/List::add → NO_COVERAGE
2. grabProgramSources : removed call to net/bmahe/genetics4j/gpu/spec/Program::resources → NO_COVERAGE
3. grabProgramSources : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE
4. grabProgramSources : removed call to java/util/Set::stream → NO_COVERAGE
5. grabProgramSources : removed call to java/util/stream/Stream::map → NO_COVERAGE
6. grabProgramSources : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
		programSpec.resources().stream().map(this::loadResource).forEach(program -> sources.add(program));
197
198 1 1. grabProgramSources : replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::grabProgramSources → NO_COVERAGE
		return sources;
199
	}
200
201
	/**
202
	 * Initializes OpenCL resources and prepares GPU devices for fitness evaluation.
203
	 * 
204
	 * <p>This method performs the complete OpenCL initialization sequence:
205
	 * <ol>
206
	 * <li><strong>Platform discovery</strong>: Enumerates available OpenCL platforms</li>
207
	 * <li><strong>Device filtering</strong>: Selects devices based on configured filters</li>
208
	 * <li><strong>Context creation</strong>: Creates OpenCL contexts for selected devices</li>
209
	 * <li><strong>Queue setup</strong>: Creates command queues with profiling and out-of-order execution</li>
210
	 * <li><strong>Program compilation</strong>: Compiles OpenCL kernels from source code</li>
211
	 * <li><strong>Kernel preparation</strong>: Creates kernel objects and queries execution info</li>
212
	 * <li><strong>Fitness initialization</strong>: Calls lifecycle hooks on the fitness function</li>
213
	 * </ol>
214
	 * 
215
	 * <p>Device selection process:
216
	 * <ul>
217
	 * <li>Applies platform filters to discovered OpenCL platforms</li>
218
	 * <li>Enumerates devices for each qualifying platform</li>
219
	 * <li>Applies device filters to select appropriate devices</li>
220
	 * <li>Validates that at least one device is available</li>
221
	 * </ul>
222
	 * 
223
	 * <p>The method creates separate OpenCL contexts for each selected device to enable concurrent execution and optimal
224
	 * resource utilization. Each context includes compiled programs and kernel objects ready for fitness evaluation.
225
	 * 
226
	 * @throws IllegalStateException if no compatible devices are found
227
	 * @throws RuntimeException      if OpenCL initialization, program compilation, or kernel creation fails
228
	 */
229
	@Override
230
	public void preEvaluation() {
231
		logger.trace("Init...");
232 1 1. preEvaluation : removed call to net/bmahe/genetics4j/core/evaluation/FitnessEvaluator::preEvaluation → NO_COVERAGE
		FitnessEvaluator.super.preEvaluation();
233
234 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformReader::<init> → NO_COVERAGE
		final var platformReader = new PlatformReader();
235 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceReader::<init> → NO_COVERAGE
		final var deviceReader = new DeviceReader();
236 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/KernelInfoReader::<init> → NO_COVERAGE
		final var kernelInfoReader = new KernelInfoReader();
237
238 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::numPlatforms → NO_COVERAGE
		final int numPlatforms = PlatformUtils.numPlatforms();
239
		logger.info("Found {} platforms", numPlatforms);
240
241 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::platformIds → NO_COVERAGE
		final List<cl_platform_id> platformIds = PlatformUtils.platformIds(numPlatforms);
242
243
		logger.info("Selecting platform and devices");
244 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAExecutionContext::platformFilters → NO_COVERAGE
		final var platformFilters = gpuEAExecutionContext.platformFilters();
245 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAExecutionContext::deviceFilters → NO_COVERAGE
		final var deviceFilters = gpuEAExecutionContext.deviceFilters();
246
247 1 1. preEvaluation : removed call to java/util/List::stream → NO_COVERAGE
		selectedPlatformToDevice = platformIds.stream()
248
				.map(platformReader::read)
249 2 1. preEvaluation : replaced call to java/util/stream/Stream::filter with receiver → NO_COVERAGE
2. preEvaluation : removed call to java/util/stream/Stream::filter → NO_COVERAGE
				.filter(platformFilters)
250 2 1. preEvaluation : replaced call to java/util/stream/Stream::flatMap with receiver → NO_COVERAGE
2. preEvaluation : removed call to java/util/stream/Stream::flatMap → NO_COVERAGE
				.flatMap(platform -> {
251 1 1. lambda$preEvaluation$0 : removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE
					final var platformId = platform.platformId();
252 1 1. lambda$preEvaluation$0 : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::numDevices → NO_COVERAGE
					final int numDevices = DeviceUtils.numDevices(platformId);
253
					logger.trace("\tPlatform {}: {} devices", platform.name(), numDevices);
254
255 1 1. lambda$preEvaluation$0 : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceIds → NO_COVERAGE
					final var deviceIds = DeviceUtils.getDeviceIds(platformId, numDevices);
256 6 1. lambda$preEvaluation$1 : replaced return value with null for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$1 → NO_COVERAGE
2. lambda$preEvaluation$0 : replaced return value with Stream.empty for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$0 → NO_COVERAGE
3. lambda$preEvaluation$0 : removed call to java/util/stream/Stream::map → NO_COVERAGE
4. lambda$preEvaluation$1 : removed call to org/apache/commons/lang3/tuple/Pair::of → NO_COVERAGE
5. lambda$preEvaluation$0 : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE
6. lambda$preEvaluation$0 : removed call to java/util/List::stream → NO_COVERAGE
					return deviceIds.stream().map(deviceId -> Pair.of(platform, deviceId));
257
				})
258 2 1. preEvaluation : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE
2. preEvaluation : removed call to java/util/stream/Stream::map → NO_COVERAGE
				.map(platformToDeviceId -> {
259 1 1. lambda$preEvaluation$2 : removed call to org/apache/commons/lang3/tuple/Pair::getLeft → NO_COVERAGE
					final var platform = platformToDeviceId.getLeft();
260 1 1. lambda$preEvaluation$2 : removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE
					final var platformId = platform.platformId();
261 1 1. lambda$preEvaluation$2 : removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE
					final var deviceID = platformToDeviceId.getRight();
262
263 3 1. lambda$preEvaluation$2 : removed call to org/apache/commons/lang3/tuple/Pair::of → NO_COVERAGE
2. lambda$preEvaluation$2 : replaced return value with null for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$2 → NO_COVERAGE
3. lambda$preEvaluation$2 : removed call to net/bmahe/genetics4j/gpu/opencl/DeviceReader::read → NO_COVERAGE
					return Pair.of(platform, deviceReader.read(platformId, deviceID));
264
				})
265 6 1. lambda$preEvaluation$3 : replaced boolean return with true for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$3 → NO_COVERAGE
2. lambda$preEvaluation$3 : removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE
3. preEvaluation : removed call to java/util/stream/Stream::filter → NO_COVERAGE
4. lambda$preEvaluation$3 : removed call to java/util/function/Predicate::test → NO_COVERAGE
5. lambda$preEvaluation$3 : replaced boolean return with false for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$3 → NO_COVERAGE
6. preEvaluation : replaced call to java/util/stream/Stream::filter with receiver → NO_COVERAGE
				.filter(platformToDevice -> deviceFilters.test(platformToDevice.getRight()))
266 2 1. preEvaluation : Removed assignment to member variable selectedPlatformToDevice → NO_COVERAGE
2. preEvaluation : removed call to java/util/stream/Stream::toList → NO_COVERAGE
				.toList();
267
268
		if (logger.isTraceEnabled()) {
269
			logger.trace("============================");
270
			logger.trace("Selected devices:");
271 1 1. preEvaluation : removed call to java/util/List::forEach → NO_COVERAGE
			selectedPlatformToDevice.forEach(pd -> {
272
				logger.trace("{}", pd.getLeft());
273
				logger.trace("\t{}", pd.getRight());
274
			});
275
			logger.trace("============================");
276
		}
277
278
		Validate.isTrue(selectedPlatformToDevice.isEmpty() == false, "No compatible devices found for the given filters");
279
280 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::grabProgramSources → NO_COVERAGE
		final List<String> programs = grabProgramSources();
281 3 1. preEvaluation : removed call to java/util/List::size → NO_COVERAGE
2. preEvaluation : replaced call to java/util/List::toArray with argument → NO_COVERAGE
3. preEvaluation : removed call to java/util/List::toArray → NO_COVERAGE
		final String[] programsArr = programs.toArray(new String[programs.size()]);
282
283
		for (final var platformAndDevice : selectedPlatformToDevice) {
284 1 1. preEvaluation : removed call to org/apache/commons/lang3/tuple/Pair::getLeft → NO_COVERAGE
			final var platform = platformAndDevice.getLeft();
285 1 1. preEvaluation : removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE
			final var device = platformAndDevice.getRight();
286
287
			logger.info("Processing platform [{}] / device [{}]", platform.name(), device.name());
288
289
			logger.info("\tCreating context");
290 1 1. preEvaluation : removed call to org/jocl/cl_context_properties::<init> → NO_COVERAGE
			cl_context_properties contextProperties = new cl_context_properties();
291 3 1. preEvaluation : Substituted 4228 with 4229 → NO_COVERAGE
2. preEvaluation : removed call to org/jocl/cl_context_properties::addProperty → NO_COVERAGE
3. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE
			contextProperties.addProperty(CL.CL_CONTEXT_PLATFORM, platform.platformId());
292
293 3 1. preEvaluation : Substituted 1 with 0 → NO_COVERAGE
2. preEvaluation : Substituted 1 with 0 → NO_COVERAGE
3. preEvaluation : Substituted 0 with 1 → NO_COVERAGE
			final cl_context context = CL
294 2 1. preEvaluation : removed call to org/jocl/CL::clCreateContext → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE
					.clCreateContext(contextProperties, 1, new cl_device_id[] { device.deviceId() }, null, null, null);
295
296
			logger.info("\tCreating command queue");
297 1 1. preEvaluation : removed call to org/jocl/cl_queue_properties::<init> → NO_COVERAGE
			final cl_queue_properties queueProperties = new cl_queue_properties();
298 3 1. preEvaluation : removed call to org/jocl/cl_queue_properties::addProperty → NO_COVERAGE
2. preEvaluation : Substituted 4243 with 4244 → NO_COVERAGE
3. preEvaluation : Substituted 3 with 4 → NO_COVERAGE
			queueProperties.addProperty(
299
					CL.CL_QUEUE_PROPERTIES,
300
					CL.CL_QUEUE_PROFILING_ENABLE | CL.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
301
			final cl_command_queue commandQueue = CL
302 2 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE
2. preEvaluation : removed call to org/jocl/CL::clCreateCommandQueueWithProperties → NO_COVERAGE
					.clCreateCommandQueueWithProperties(context, device.deviceId(), queueProperties, null);
303
304
			logger.info("\tCreate program");
305 1 1. preEvaluation : removed call to org/jocl/CL::clCreateProgramWithSource → NO_COVERAGE
			final cl_program program = CL.clCreateProgramWithSource(context, programsArr.length, programsArr, null, null);
306
307 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE
			final var programSpec = gpuEAConfiguration.program();
308 3 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/Program::buildOptions → NO_COVERAGE
2. preEvaluation : replaced call to java/util/Optional::orElse with argument → NO_COVERAGE
3. preEvaluation : removed call to java/util/Optional::orElse → NO_COVERAGE
			final var buildOptions = programSpec.buildOptions().orElse(null);
309
			logger.info("\tBuilding program with options: {}", buildOptions);
310 3 1. preEvaluation : Substituted 0 with 1 → NO_COVERAGE
2. preEvaluation : replaced call to org/jocl/CL::clBuildProgram with argument → NO_COVERAGE
3. preEvaluation : removed call to org/jocl/CL::clBuildProgram → NO_COVERAGE
			CL.clBuildProgram(program, 0, null, buildOptions, null, null);
311
312 2 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/Program::kernelNames → NO_COVERAGE
			final Set<String> kernelNames = gpuEAConfiguration.program().kernelNames();
313
314 1 1. preEvaluation : removed call to java/util/HashMap::<init> → NO_COVERAGE
			final Map<String, cl_kernel> kernels = new HashMap<>();
315 1 1. preEvaluation : removed call to java/util/HashMap::<init> → NO_COVERAGE
			final Map<String, KernelInfo> kernelInfos = new HashMap<>();
316
			for (final String kernelName : kernelNames) {
317
318
				logger.info("\tCreate kernel {}", kernelName);
319 1 1. preEvaluation : removed call to org/jocl/CL::clCreateKernel → NO_COVERAGE
				final cl_kernel kernel = CL.clCreateKernel(program, kernelName, null);
320
				Objects.requireNonNull(kernel);
321
322 2 1. preEvaluation : removed call to java/util/Map::put → NO_COVERAGE
2. preEvaluation : replaced call to java/util/Map::put with argument → NO_COVERAGE
				kernels.put(kernelName, kernel);
323
324 2 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/KernelInfoReader::read → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE
				final var kernelInfo = kernelInfoReader.read(device.deviceId(), kernel, kernelName);
325
				logger.trace("\t{}", kernelInfo);
326 2 1. preEvaluation : removed call to java/util/Map::put → NO_COVERAGE
2. preEvaluation : replaced call to java/util/Map::put with argument → NO_COVERAGE
				kernelInfos.put(kernelName, kernelInfo);
327
			}
328
329 1 1. preEvaluation : removed call to java/util/List::add → NO_COVERAGE
			clContexts.add(context);
330 1 1. preEvaluation : removed call to java/util/List::add → NO_COVERAGE
			clCommandQueues.add(commandQueue);
331 1 1. preEvaluation : removed call to java/util/List::add → NO_COVERAGE
			clKernels.add(kernels);
332 1 1. preEvaluation : removed call to java/util/List::add → NO_COVERAGE
			clPrograms.add(program);
333
334 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::builder → NO_COVERAGE
			final var openCLExecutionContext = OpenCLExecutionContext.builder()
335 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::platform with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::platform → NO_COVERAGE
					.platform(platform)
336 2 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::device → NO_COVERAGE
2. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::device with receiver → NO_COVERAGE
					.device(device)
337 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clContext with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clContext → NO_COVERAGE
					.clContext(context)
338 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clCommandQueue with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clCommandQueue → NO_COVERAGE
					.clCommandQueue(commandQueue)
339 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernels with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernels → NO_COVERAGE
					.kernels(kernels)
340 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernelInfos with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernelInfos → NO_COVERAGE
					.kernelInfos(kernelInfos)
341 2 1. preEvaluation : replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clProgram with receiver → NO_COVERAGE
2. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clProgram → NO_COVERAGE
					.clProgram(program)
342 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::build → NO_COVERAGE
					.build();
343
344 1 1. preEvaluation : removed call to java/util/List::add → NO_COVERAGE
			clExecutionContexts.add(openCLExecutionContext);
345
		}
346
347 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE
		final var fitness = gpuEAConfiguration.fitness();
348 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeAllEvaluations → NO_COVERAGE
		fitness.beforeAllEvaluations();
349
		for (final OpenCLExecutionContext clExecutionContext : clExecutionContexts) {
350 1 1. preEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeAllEvaluations → NO_COVERAGE
			fitness.beforeAllEvaluations(clExecutionContext, executorService);
351
		}
352
	}
353
354
	/**
355
	 * Evaluates fitness for a population of genotypes using GPU acceleration.
356
	 * 
357
	 * <p>This method implements the core fitness evaluation logic by distributing the population across available OpenCL
358
	 * devices and executing fitness computation concurrently. The evaluation process follows these steps:
359
	 * 
360
	 * <ol>
361
	 * <li><strong>Population partitioning</strong>: Divides genotypes across available devices</li>
362
	 * <li><strong>Parallel dispatch</strong>: Submits evaluation tasks to each device asynchronously</li>
363
	 * <li><strong>GPU execution</strong>: Executes OpenCL kernels for fitness computation</li>
364
	 * <li><strong>Result collection</strong>: Gathers fitness values from all devices</li>
365
	 * <li><strong>Result aggregation</strong>: Combines results preserving original order</li>
366
	 * </ol>
367
	 * 
368
	 * <p>Load balancing strategy:
369
	 * <ul>
370
	 * <li>Automatically calculates partition size based on population and device count</li>
371
	 * <li>Round-robin assignment of partitions to devices for balanced workload</li>
372
	 * <li>Asynchronous execution allows devices to work at their optimal pace</li>
373
	 * </ul>
374
	 * 
375
	 * <p>The method coordinates with the configured fitness function through lifecycle hooks:
376
	 * <ul>
377
	 * <li>{@code beforeEvaluation()}: Called before each device partition evaluation</li>
378
	 * <li>{@code compute()}: Executes the actual GPU fitness computation</li>
379
	 * <li>{@code afterEvaluation()}: Called after each device partition completes</li>
380
	 * </ul>
381
	 * 
382
	 * <p>Concurrency and performance:
383
	 * <ul>
384
	 * <li>Multiple devices execute evaluation partitions concurrently</li>
385
	 * <li>CompletableFuture-based coordination for non-blocking execution</li>
386
	 * <li>Automatic workload distribution across available GPU resources</li>
387
	 * </ul>
388
	 * 
389
	 * @param generation the current generation number for context and logging
390
	 * @param genotypes  the population of genotypes to evaluate
391
	 * @return fitness values corresponding to each genotype in the same order
392
	 * @throws IllegalArgumentException if genotypes is null or empty
393
	 * @throws RuntimeException         if GPU evaluation fails or OpenCL errors occur
394
	 */
395
	@Override
396
	public List<T> evaluate(final long generation, final List<Genotype> genotypes) {
397
398 1 1. evaluate : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE
		final var fitness = gpuEAConfiguration.fitness();
399
400
		/**
401
		 * TODO make it configurable from execution context
402
		 */
403 5 1. evaluate : removed call to java/util/List::size → NO_COVERAGE
2. evaluate : Replaced double division with multiplication → NO_COVERAGE
3. evaluate : removed call to java/util/List::size → NO_COVERAGE
4. evaluate : removed call to java/lang/Math::ceil → NO_COVERAGE
5. evaluate : replaced call to java/lang/Math::ceil with argument → NO_COVERAGE
		final int partitionSize = (int) (Math.ceil((double) genotypes.size() / clExecutionContexts.size()));
404 2 1. evaluate : replaced call to org/apache/commons/collections4/ListUtils::partition with argument → NO_COVERAGE
2. evaluate : removed call to org/apache/commons/collections4/ListUtils::partition → NO_COVERAGE
		final var subGenotypes = ListUtils.partition(genotypes, partitionSize);
405
		logger.debug("Genotype decomposed in {} partition(s)", subGenotypes.size());
406
		if (logger.isTraceEnabled()) {
407 6 1. evaluate : removed conditional - replaced comparison check with true → NO_COVERAGE
2. evaluate : negated conditional → NO_COVERAGE
3. evaluate : changed conditional boundary → NO_COVERAGE
4. evaluate : Substituted 0 with 1 → NO_COVERAGE
5. evaluate : removed call to java/util/List::size → NO_COVERAGE
6. evaluate : removed conditional - replaced comparison check with false → NO_COVERAGE
			for (int i = 0; i < subGenotypes.size(); i++) {
408 1 1. evaluate : removed call to java/util/List::get → NO_COVERAGE
				final List<Genotype> subGenotype = subGenotypes.get(i);
409
				logger.trace("\tPartition {} with {} elements", i, subGenotype.size());
410
			}
411
		}
412
413 1 1. evaluate : removed call to java/util/ArrayList::<init> → NO_COVERAGE
		final List<CompletableFuture<List<T>>> subResultsCF = new ArrayList<>();
414 6 1. evaluate : removed conditional - replaced comparison check with false → NO_COVERAGE
2. evaluate : removed call to java/util/List::size → NO_COVERAGE
3. evaluate : Substituted 0 with 1 → NO_COVERAGE
4. evaluate : removed conditional - replaced comparison check with true → NO_COVERAGE
5. evaluate : negated conditional → NO_COVERAGE
6. evaluate : changed conditional boundary → NO_COVERAGE
		for (int i = 0; i < subGenotypes.size(); i++) {
415 3 1. evaluate : removed call to java/util/List::size → NO_COVERAGE
2. evaluate : removed call to java/util/List::get → NO_COVERAGE
3. evaluate : Replaced integer modulus with multiplication → NO_COVERAGE
			final var openCLExecutionContext = clExecutionContexts.get(i % clExecutionContexts.size());
416 1 1. evaluate : removed call to java/util/List::get → NO_COVERAGE
			final var subGenotype = subGenotypes.get(i);
417
418 1 1. evaluate : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeEvaluation → NO_COVERAGE
			fitness.beforeEvaluation(generation, subGenotype);
419 1 1. evaluate : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeEvaluation → NO_COVERAGE
			fitness.beforeEvaluation(openCLExecutionContext, executorService, generation, subGenotype);
420
421 1 1. evaluate : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::compute → NO_COVERAGE
			final var resultsCF = fitness.compute(openCLExecutionContext, executorService, generation, subGenotype)
422 2 1. evaluate : removed call to java/util/concurrent/CompletableFuture::thenApply → NO_COVERAGE
2. evaluate : replaced call to java/util/concurrent/CompletableFuture::thenApply with receiver → NO_COVERAGE
					.thenApply(results -> {
423
424 1 1. lambda$evaluate$0 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterEvaluation → NO_COVERAGE
						fitness.afterEvaluation(openCLExecutionContext, executorService, generation, subGenotype);
425 1 1. lambda$evaluate$0 : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterEvaluation → NO_COVERAGE
						fitness.afterEvaluation(generation, subGenotype);
426
427 1 1. lambda$evaluate$0 : replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$evaluate$0 → NO_COVERAGE
						return results;
428
					});
429
430 1 1. evaluate : removed call to java/util/List::add → NO_COVERAGE
			subResultsCF.add(resultsCF);
431
		}
432
433 2 1. evaluate : removed call to java/util/ArrayList::<init> → NO_COVERAGE
2. evaluate : removed call to java/util/List::size → NO_COVERAGE
		final List<T> resultsEvaluation = new ArrayList<>(genotypes.size());
434
		for (final CompletableFuture<List<T>> subResultCF : subResultsCF) {
435 1 1. evaluate : removed call to java/util/concurrent/CompletableFuture::join → NO_COVERAGE
			final var fitnessResults = subResultCF.join();
436 1 1. evaluate : removed call to java/util/List::addAll → NO_COVERAGE
			resultsEvaluation.addAll(fitnessResults);
437
		}
438 1 1. evaluate : replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::evaluate → NO_COVERAGE
		return resultsEvaluation;
439
	}
440
441
	/**
442
	 * Cleans up OpenCL resources and releases GPU memory after evaluation completion.
443
	 * 
444
	 * <p>This method performs comprehensive cleanup of all OpenCL resources in the proper order to prevent memory leaks
445
	 * and ensure clean shutdown. The cleanup sequence follows OpenCL best practices for resource deallocation:
446
	 * 
447
	 * <ol>
448
	 * <li><strong>Fitness cleanup</strong>: Calls lifecycle hooks on the fitness function</li>
449
	 * <li><strong>Kernel release</strong>: Releases all compiled kernel objects</li>
450
	 * <li><strong>Program release</strong>: Releases compiled OpenCL programs</li>
451
	 * <li><strong>Queue release</strong>: Releases command queues and pending operations</li>
452
	 * <li><strong>Context release</strong>: Releases OpenCL contexts and associated memory</li>
453
	 * <li><strong>Reference cleanup</strong>: Clears internal data structures and references</li>
454
	 * </ol>
455
	 * 
456
	 * <p>Resource management guarantees:
457
	 * <ul>
458
	 * <li>All GPU memory allocations are properly released</li>
459
	 * <li>OpenCL objects are released in dependency order to avoid errors</li>
460
	 * <li>No resource leaks occur even if individual cleanup operations fail</li>
461
	 * <li>Evaluator returns to a clean state ready for potential reinitialization</li>
462
	 * </ul>
463
	 * 
464
	 * <p>The method coordinates with the configured fitness function to ensure any fitness-specific resources (buffers,
465
	 * textures, etc.) are also properly cleaned up through the {@code afterAllEvaluations()} lifecycle hooks.
466
	 * 
467
	 * @throws RuntimeException if cleanup operations fail (logged but not propagated to prevent interference with EA
468
	 *                          system shutdown)
469
	 */
470
	@Override
471
	public void postEvaluation() {
472
473 1 1. postEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE
		final var fitness = gpuEAConfiguration.fitness();
474
475
		for (final OpenCLExecutionContext clExecutionContext : clExecutionContexts) {
476 1 1. postEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterAllEvaluations → NO_COVERAGE
			fitness.afterAllEvaluations(clExecutionContext, executorService);
477
		}
478 1 1. postEvaluation : removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterAllEvaluations → NO_COVERAGE
		fitness.afterAllEvaluations();
479
480
		logger.debug("Releasing kernels");
481
482
		for (final Map<String, cl_kernel> kernels : clKernels) {
483 1 1. postEvaluation : removed call to java/util/Map::values → NO_COVERAGE
			for (final cl_kernel clKernel : kernels.values()) {
484 1 1. postEvaluation : removed call to org/jocl/CL::clReleaseKernel → NO_COVERAGE
				CL.clReleaseKernel(clKernel);
485
			}
486
		}
487 1 1. postEvaluation : removed call to java/util/List::clear → NO_COVERAGE
		clKernels.clear();
488
489
		logger.debug("Releasing programs");
490
		for (final cl_program clProgram : clPrograms) {
491 1 1. postEvaluation : removed call to org/jocl/CL::clReleaseProgram → NO_COVERAGE
			CL.clReleaseProgram(clProgram);
492
		}
493 1 1. postEvaluation : removed call to java/util/List::clear → NO_COVERAGE
		clPrograms.clear();
494
495
		logger.debug("Releasing command queues");
496
		for (final cl_command_queue clCommandQueue : clCommandQueues) {
497 1 1. postEvaluation : removed call to org/jocl/CL::clReleaseCommandQueue → NO_COVERAGE
			CL.clReleaseCommandQueue(clCommandQueue);
498
		}
499 1 1. postEvaluation : removed call to java/util/List::clear → NO_COVERAGE
		clCommandQueues.clear();
500
501
		logger.debug("Releasing contexts");
502
		for (final cl_context clContext : clContexts) {
503 1 1. postEvaluation : removed call to org/jocl/CL::clReleaseContext → NO_COVERAGE
			CL.clReleaseContext(clContext);
504
		}
505 1 1. postEvaluation : removed call to java/util/List::clear → NO_COVERAGE
		clContexts.clear();
506
507 1 1. postEvaluation : removed call to java/util/List::clear → NO_COVERAGE
		clExecutionContexts.clear();
508 1 1. postEvaluation : Removed assignment to member variable selectedPlatformToDevice → NO_COVERAGE
		selectedPlatformToDevice = null;
509
510 1 1. postEvaluation : removed call to net/bmahe/genetics4j/core/evaluation/FitnessEvaluator::postEvaluation → NO_COVERAGE
		FitnessEvaluator.super.postEvaluation();
511
	}
512
}

Mutations

143

1.1
Location : <init>
Killed by : none
Removed assignment to member variable clContexts → NO_COVERAGE

2.2
Location : <init>
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

144

1.1
Location : <init>
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

2.2
Location : <init>
Killed by : none
Removed assignment to member variable clCommandQueues → NO_COVERAGE

145

1.1
Location : <init>
Killed by : none
Removed assignment to member variable clPrograms → NO_COVERAGE

2.2
Location : <init>
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

146

1.1
Location : <init>
Killed by : none
Removed assignment to member variable clKernels → NO_COVERAGE

2.2
Location : <init>
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

147

1.1
Location : <init>
Killed by : none
Removed assignment to member variable clExecutionContexts → NO_COVERAGE

2.2
Location : <init>
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

170

1.1
Location : <init>
Killed by : none
Removed assignment to member variable gpuEAExecutionContext → NO_COVERAGE

171

1.1
Location : <init>
Killed by : none
Removed assignment to member variable gpuEAConfiguration → NO_COVERAGE

172

1.1
Location : <init>
Killed by : none
Removed assignment to member variable executorService → NO_COVERAGE

174

1.1
Location : <init>
Killed by : none
removed call to org/jocl/CL::setExceptionsEnabled → NO_COVERAGE

2.2
Location : <init>
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

181

1.1
Location : loadResource
Killed by : none
replaced call to org/apache/commons/io/IOUtils::resourceToString with argument → NO_COVERAGE

2.2
Location : loadResource
Killed by : none
replaced return value with "" for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::loadResource → NO_COVERAGE

3.3
Location : loadResource
Killed by : none
removed call to org/apache/commons/io/IOUtils::resourceToString → NO_COVERAGE

183

1.1
Location : loadResource
Killed by : none
removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE

188

1.1
Location : grabProgramSources
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE

192

1.1
Location : grabProgramSources
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

194

1.1
Location : grabProgramSources
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/Program::content → NO_COVERAGE

2.2
Location : grabProgramSources
Killed by : none
removed call to java/util/List::addAll → NO_COVERAGE

196

1.1
Location : lambda$grabProgramSources$0
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

2.2
Location : grabProgramSources
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/Program::resources → NO_COVERAGE

3.3
Location : grabProgramSources
Killed by : none
replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE

4.4
Location : grabProgramSources
Killed by : none
removed call to java/util/Set::stream → NO_COVERAGE

5.5
Location : grabProgramSources
Killed by : none
removed call to java/util/stream/Stream::map → NO_COVERAGE

6.6
Location : grabProgramSources
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

198

1.1
Location : grabProgramSources
Killed by : none
replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::grabProgramSources → NO_COVERAGE

232

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/core/evaluation/FitnessEvaluator::preEvaluation → NO_COVERAGE

234

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/PlatformReader::<init> → NO_COVERAGE

235

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/DeviceReader::<init> → NO_COVERAGE

236

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/KernelInfoReader::<init> → NO_COVERAGE

238

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::numPlatforms → NO_COVERAGE

241

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/PlatformUtils::platformIds → NO_COVERAGE

244

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAExecutionContext::platformFilters → NO_COVERAGE

245

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAExecutionContext::deviceFilters → NO_COVERAGE

247

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::stream → NO_COVERAGE

249

1.1
Location : preEvaluation
Killed by : none
replaced call to java/util/stream/Stream::filter with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to java/util/stream/Stream::filter → NO_COVERAGE

250

1.1
Location : preEvaluation
Killed by : none
replaced call to java/util/stream/Stream::flatMap with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to java/util/stream/Stream::flatMap → NO_COVERAGE

251

1.1
Location : lambda$preEvaluation$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE

252

1.1
Location : lambda$preEvaluation$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::numDevices → NO_COVERAGE

255

1.1
Location : lambda$preEvaluation$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/DeviceUtils::getDeviceIds → NO_COVERAGE

256

1.1
Location : lambda$preEvaluation$1
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$1 → NO_COVERAGE

2.2
Location : lambda$preEvaluation$0
Killed by : none
replaced return value with Stream.empty for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$0 → NO_COVERAGE

3.3
Location : lambda$preEvaluation$0
Killed by : none
removed call to java/util/stream/Stream::map → NO_COVERAGE

4.4
Location : lambda$preEvaluation$1
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::of → NO_COVERAGE

5.5
Location : lambda$preEvaluation$0
Killed by : none
replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE

6.6
Location : lambda$preEvaluation$0
Killed by : none
removed call to java/util/List::stream → NO_COVERAGE

258

1.1
Location : preEvaluation
Killed by : none
replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to java/util/stream/Stream::map → NO_COVERAGE

259

1.1
Location : lambda$preEvaluation$2
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::getLeft → NO_COVERAGE

260

1.1
Location : lambda$preEvaluation$2
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE

261

1.1
Location : lambda$preEvaluation$2
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE

263

1.1
Location : lambda$preEvaluation$2
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::of → NO_COVERAGE

2.2
Location : lambda$preEvaluation$2
Killed by : none
replaced return value with null for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$2 → NO_COVERAGE

3.3
Location : lambda$preEvaluation$2
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/DeviceReader::read → NO_COVERAGE

265

1.1
Location : lambda$preEvaluation$3
Killed by : none
replaced boolean return with true for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$3 → NO_COVERAGE

2.2
Location : lambda$preEvaluation$3
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
removed call to java/util/stream/Stream::filter → NO_COVERAGE

4.4
Location : lambda$preEvaluation$3
Killed by : none
removed call to java/util/function/Predicate::test → NO_COVERAGE

5.5
Location : lambda$preEvaluation$3
Killed by : none
replaced boolean return with false for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$preEvaluation$3 → NO_COVERAGE

6.6
Location : preEvaluation
Killed by : none
replaced call to java/util/stream/Stream::filter with receiver → NO_COVERAGE

266

1.1
Location : preEvaluation
Killed by : none
Removed assignment to member variable selectedPlatformToDevice → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to java/util/stream/Stream::toList → NO_COVERAGE

271

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

280

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::grabProgramSources → NO_COVERAGE

281

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to java/util/List::toArray with argument → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
removed call to java/util/List::toArray → NO_COVERAGE

284

1.1
Location : preEvaluation
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::getLeft → NO_COVERAGE

285

1.1
Location : preEvaluation
Killed by : none
removed call to org/apache/commons/lang3/tuple/Pair::getRight → NO_COVERAGE

290

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/cl_context_properties::<init> → NO_COVERAGE

291

1.1
Location : preEvaluation
Killed by : none
Substituted 4228 with 4229 → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to org/jocl/cl_context_properties::addProperty → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Platform::platformId → NO_COVERAGE

293

1.1
Location : preEvaluation
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

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

294

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/CL::clCreateContext → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE

297

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/cl_queue_properties::<init> → NO_COVERAGE

298

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/cl_queue_properties::addProperty → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
Substituted 4243 with 4244 → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
Substituted 3 with 4 → NO_COVERAGE

302

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to org/jocl/CL::clCreateCommandQueueWithProperties → NO_COVERAGE

305

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/CL::clCreateProgramWithSource → NO_COVERAGE

307

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE

308

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/Program::buildOptions → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to java/util/Optional::orElse with argument → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
removed call to java/util/Optional::orElse → NO_COVERAGE

310

1.1
Location : preEvaluation
Killed by : none
Substituted 0 with 1 → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to org/jocl/CL::clBuildProgram with argument → NO_COVERAGE

3.3
Location : preEvaluation
Killed by : none
removed call to org/jocl/CL::clBuildProgram → NO_COVERAGE

312

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::program → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/Program::kernelNames → NO_COVERAGE

314

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/HashMap::<init> → NO_COVERAGE

315

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/HashMap::<init> → NO_COVERAGE

319

1.1
Location : preEvaluation
Killed by : none
removed call to org/jocl/CL::clCreateKernel → NO_COVERAGE

322

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/Map::put → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to java/util/Map::put with argument → NO_COVERAGE

324

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/KernelInfoReader::read → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/model/Device::deviceId → NO_COVERAGE

326

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/Map::put → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to java/util/Map::put with argument → NO_COVERAGE

329

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

330

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

331

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

332

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

334

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext::builder → NO_COVERAGE

335

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::platform with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::platform → NO_COVERAGE

336

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::device → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::device with receiver → NO_COVERAGE

337

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clContext with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clContext → NO_COVERAGE

338

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clCommandQueue with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clCommandQueue → NO_COVERAGE

339

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernels with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernels → NO_COVERAGE

340

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernelInfos with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::kernelInfos → NO_COVERAGE

341

1.1
Location : preEvaluation
Killed by : none
replaced call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clProgram with receiver → NO_COVERAGE

2.2
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::clProgram → NO_COVERAGE

342

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/opencl/OpenCLExecutionContext$Builder::build → NO_COVERAGE

344

1.1
Location : preEvaluation
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

347

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE

348

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeAllEvaluations → NO_COVERAGE

350

1.1
Location : preEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeAllEvaluations → NO_COVERAGE

398

1.1
Location : evaluate
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE

403

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
Replaced double division with multiplication → NO_COVERAGE

3.3
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

4.4
Location : evaluate
Killed by : none
removed call to java/lang/Math::ceil → NO_COVERAGE

5.5
Location : evaluate
Killed by : none
replaced call to java/lang/Math::ceil with argument → NO_COVERAGE

404

1.1
Location : evaluate
Killed by : none
replaced call to org/apache/commons/collections4/ListUtils::partition with argument → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
removed call to org/apache/commons/collections4/ListUtils::partition → NO_COVERAGE

407

1.1
Location : evaluate
Killed by : none
removed conditional - replaced comparison check with true → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : evaluate
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : evaluate
Killed by : none
Substituted 0 with 1 → NO_COVERAGE

5.5
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

6.6
Location : evaluate
Killed by : none
removed conditional - replaced comparison check with false → NO_COVERAGE

408

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::get → NO_COVERAGE

413

1.1
Location : evaluate
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

414

1.1
Location : evaluate
Killed by : none
removed conditional - replaced comparison check with false → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

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

4.4
Location : evaluate
Killed by : none
removed conditional - replaced comparison check with true → NO_COVERAGE

5.5
Location : evaluate
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : evaluate
Killed by : none
changed conditional boundary → NO_COVERAGE

415

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
removed call to java/util/List::get → NO_COVERAGE

3.3
Location : evaluate
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

416

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::get → NO_COVERAGE

418

1.1
Location : evaluate
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeEvaluation → NO_COVERAGE

419

1.1
Location : evaluate
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::beforeEvaluation → NO_COVERAGE

421

1.1
Location : evaluate
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::compute → NO_COVERAGE

422

1.1
Location : evaluate
Killed by : none
removed call to java/util/concurrent/CompletableFuture::thenApply → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
replaced call to java/util/concurrent/CompletableFuture::thenApply with receiver → NO_COVERAGE

424

1.1
Location : lambda$evaluate$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterEvaluation → NO_COVERAGE

425

1.1
Location : lambda$evaluate$0
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterEvaluation → NO_COVERAGE

427

1.1
Location : lambda$evaluate$0
Killed by : none
replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::lambda$evaluate$0 → NO_COVERAGE

430

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::add → NO_COVERAGE

433

1.1
Location : evaluate
Killed by : none
removed call to java/util/ArrayList::<init> → NO_COVERAGE

2.2
Location : evaluate
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

435

1.1
Location : evaluate
Killed by : none
removed call to java/util/concurrent/CompletableFuture::join → NO_COVERAGE

436

1.1
Location : evaluate
Killed by : none
removed call to java/util/List::addAll → NO_COVERAGE

438

1.1
Location : evaluate
Killed by : none
replaced return value with Collections.emptyList for net/bmahe/genetics4j/gpu/GPUFitnessEvaluator::evaluate → NO_COVERAGE

473

1.1
Location : postEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/GPUEAConfiguration::fitness → NO_COVERAGE

476

1.1
Location : postEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterAllEvaluations → NO_COVERAGE

478

1.1
Location : postEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/gpu/spec/fitness/OpenCLFitness::afterAllEvaluations → NO_COVERAGE

483

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/Map::values → NO_COVERAGE

484

1.1
Location : postEvaluation
Killed by : none
removed call to org/jocl/CL::clReleaseKernel → NO_COVERAGE

487

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

491

1.1
Location : postEvaluation
Killed by : none
removed call to org/jocl/CL::clReleaseProgram → NO_COVERAGE

493

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

497

1.1
Location : postEvaluation
Killed by : none
removed call to org/jocl/CL::clReleaseCommandQueue → NO_COVERAGE

499

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

503

1.1
Location : postEvaluation
Killed by : none
removed call to org/jocl/CL::clReleaseContext → NO_COVERAGE

505

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

507

1.1
Location : postEvaluation
Killed by : none
removed call to java/util/List::clear → NO_COVERAGE

508

1.1
Location : postEvaluation
Killed by : none
Removed assignment to member variable selectedPlatformToDevice → NO_COVERAGE

510

1.1
Location : postEvaluation
Killed by : none
removed call to net/bmahe/genetics4j/core/evaluation/FitnessEvaluator::postEvaluation → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support