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>
16   * As we may execute across multiple GPUs, may of these are computed at runtime
17   * and may vary from GPU to GPU as their specs may differ
18   */
19  @Value.Immutable
20  public interface SingleKernelFitnessDescriptor {
21  
22  	/**
23  	 * Name of the kernel to execute
24  	 * 
25  	 * @return
26  	 */
27  	String kernelName();
28  
29  	/**
30  	 * Computer for the kernel execution context (ex: globak work size)
31  	 * 
32  	 * @return
33  	 */
34  	KernelExecutionContextComputer kernelExecutionContextComputer();
35  
36  	/**
37  	 * Association of kernel argument index and a static data loader
38  	 * 
39  	 * @return
40  	 */
41  	Map<Integer, StaticDataLoader> staticDataLoaders();
42  
43  	/**
44  	 * Association of kernel argument index and a data loader
45  	 * 
46  	 * @return
47  	 */
48  	Map<Integer, DataLoader> dataLoaders();
49  
50  	/**
51  	 * Association of kernel argument index and a local memory allocator
52  	 * 
53  	 * @return
54  	 */
55  	Map<Integer, LocalMemoryAllocator> localMemoryAllocators();
56  
57  	/**
58  	 * Association of kernel argument index and a result allocator
59  	 * 
60  	 * @return
61  	 */
62  	Map<Integer, ResultAllocator> resultAllocators();
63  
64  	static class Builder extends ImmutableSingleKernelFitnessDescriptor.Builder {
65  	}
66  
67  	static Builder builder() {
68  		return new Builder();
69  	}
70  }