JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java™ (public API).
CLQueueContext.java
Go to the documentation of this file.
1/*
2 * Created on Friday, May 06 2011 21:02
3 */
4package com.jogamp.opencl.util.concurrent;
5
6import com.jogamp.opencl.CLCommandQueue;
7import com.jogamp.opencl.CLContext;
8import com.jogamp.opencl.CLKernel;
9import com.jogamp.opencl.CLProgram;
10import com.jogamp.opencl.CLResource;
11import java.util.Map;
12
13/**
14 * Superclass for all per-queue contexts as used in {@link CLCommandQueuePool}s.
15 * A context will usually hold queue (and therefore often device) specific resources used
16 * in tasks of the same queue.
17 * <p>
18 * Possible candidates for those resources can be compiled CLPrograms, CLKernels
19 * or even pre allocated CLBuffers.
20 * </p>
21 * @author Michael Bien
22 */
23public abstract class CLQueueContext implements CLResource {
24
25 public final CLCommandQueue queue;
26
28 this.queue = queue;
29 }
30
32 return queue;
33 }
34
36 return queue.getContext();
37 }
38
39 /**
40 * A simple queue context holding a precompiled program and its kernels.
41 * @author Michael Bien
42 */
43 public static class CLSimpleQueueContext extends CLQueueContext {
44
45 public final CLProgram program;
46 public final Map<String, CLKernel> kernels;
47
49 super(queue);
50 this.program = program;
51 this.kernels = program.createCLKernels();
52 }
53
54 public Map<String, CLKernel> getKernels() {
55 return kernels;
56 }
57
58 public CLKernel getKernel(final String name) {
59 return kernels.get(name);
60 }
61
63 return program;
64 }
65
66 @Override
67 public void release() {
69 }
70
71 @Override
72 public boolean isReleased() {
73 return program.isReleased();
74 }
75
76 }
77
78}
The command queue is used to queue a set of operations for a specific CLDevice.
CLContext is responsible for managing objects such as command-queues, memory, program and kernel obje...
Definition: CLContext.java:79
High level abstraction for an OpenCL Kernel.
Definition: CLKernel.java:53
CLContext getContext()
Returns the context for this OpenCL object.
Definition: CLObject.java:58
Represents a OpenCL program executed on one or more CLDevices.
Definition: CLProgram.java:64
Map< String, CLKernel > createCLKernels()
Creates all kernels of this program and stores them a Map with the kernel name as key.
Definition: CLProgram.java:430
void release()
Releases this program with its kernels.
Definition: CLProgram.java:478
A simple queue context holding a precompiled program and its kernels.
CLSimpleQueueContext(final CLCommandQueue queue, final CLProgram program)
boolean isReleased()
Returns true if release() has been called.
Superclass for all per-queue contexts as used in CLCommandQueuePools.
Releasable OpenCL resource.
Definition: CLResource.java:35