[DOCS] ExecutionContext - Javadoc
*/
package uk.ac.manchester.tornado.api;
+/**
+ * Generic interface for TornadoVM to implement a Thread-Context API. This
+ * interface allows the client to implement barriers, allocate memory in local
+ * memory (OpenCL) or in shared memory (NVIDIA PTX).
+ */
public interface ExecutionContext {
+ /**
+ * It adds a barrier for sync all threads within the same work-group to ensure
+ * correct order in local memory (OpenCL terminology).
+ *
+ * Similar the OpenCL construct:
+ *
+ * <code>
+ * barrier(CLK_LOCAL_MEM_FENCE);
+ * </code>
+ */
void localBarrier();
+ /**
+ * It adds a barrier for sync all threads within the same work-group to ensure
+ * correct order in global memory (OpenCL terminology).
+ *
+ * Similar the OpenCL construct:
+ *
+ * <code>
+ * barrier(CLK_GLOBAL_MEM_FENCE);
+ * </code>
+ */
void globalBarrier();
+ /**
+ * Array Allocation in Local Memory (OpenCL terminology)
+ *
+ * @param size
+ * size of the int-array.
+ * @return int[]
+ */
int[] allocateIntLocalArray(int size);
+ /**
+ * Array Allocation in Local Memory (OpenCL terminology)
+ *
+ * @param size
+ * size of the long-array.
+ * @return long[]
+ */
long[] allocateLongLocalArray(int size);
+ /**
+ * Array Allocation in Local Memory (OpenCL terminology).
+ *
+ * @param size
+ * size of the float-array.
+ * @return float[]
+ */
float[] allocateFloatLocalArray(int size);
+ /**
+ * Array Allocation in Local Memory (OpenCL terminology).
+ *
+ * @param size
+ * size of the double-array.
+ * @return double[]
+ */
double[] allocateDoubleLocalArray(int size);
+ /**
+ * It launches a dynamic kernel.
+ *
+ * @param f
+ * function {@link FunctionalInterface} to be launched within the
+ * kernel.
+ * @param grid
+ * {@link WorkerGrid} to be used as a thread deployment for the
+ * function.
+ */
void launch(FunctionalInterface f, WorkerGrid grid);
+ /**
+ * Obtain a {@link WorkerGrid}.
+ *
+ * @return {@link WorkerGrid}
+ */
WorkerGrid getGrid();
}
