View Javadoc
1   package net.bmahe.genetics4j.gpu.spec.fitness;
2   
3   import java.util.Map;
4   
5   import org.immutables.value.Value;
6   
7   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.DataLoader;
8   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.LocalMemoryAllocator;
9   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.ResultAllocator;
10  import net.bmahe.genetics4j.gpu.spec.fitness.cldata.StaticDataLoader;
11  import net.bmahe.genetics4j.gpu.spec.fitness.kernelcontext.KernelExecutionContextComputer;
12  
13  /**
14   * Describes all the necessary information to execute an OpenCL kernel
15   * <p>As we may execute across multiple GPUs, may of these are computed at runtime and may vary from GPU to GPU as their
16   * specs may differ
17   */
18  @Value.Immutable
19  public interface SingleKernelFitnessDescriptor {
20  
21  	/**
22  	 * Name of the kernel to execute
23  	 * 
24  	 * @return
25  	 */
26  	String kernelName();
27  
28  	/**
29  	 * Computer for the kernel execution context (ex: globak work size)
30  	 * 
31  	 * @return
32  	 */
33  	KernelExecutionContextComputer kernelExecutionContextComputer();
34  
35  	/**
36  	 * Association of kernel argument index and a static data loader
37  	 * 
38  	 * @return
39  	 */
40  	Map<Integer, StaticDataLoader> staticDataLoaders();
41  
42  	/**
43  	 * Association of kernel argument index and a data loader
44  	 * 
45  	 * @return
46  	 */
47  	Map<Integer, DataLoader> dataLoaders();
48  
49  	/**
50  	 * Association of kernel argument index and a local memory allocator
51  	 * 
52  	 * @return
53  	 */
54  	Map<Integer, LocalMemoryAllocator> localMemoryAllocators();
55  
56  	/**
57  	 * Association of kernel argument index and a result allocator
58  	 * 
59  	 * @return
60  	 */
61  	Map<Integer, ResultAllocator> resultAllocators();
62  
63  	static class Builder extends ImmutableSingleKernelFitnessDescriptor.Builder {
64  	}
65  
66  	static Builder builder() {
67  		return new Builder();
68  	}
69  }