JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java™ (public API).
CLBuildConfiguration.java
Go to the documentation of this file.
1/*
2 * Copyright 2009 - 2010 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29package com.jogamp.opencl.util;
30
31import com.jogamp.opencl.CLDevice;
32import com.jogamp.opencl.CLProgram;
33import java.io.IOException;
34import java.io.ObjectOutputStream;
35import java.util.Map;
36
37/**
38 * Configuration representing everything needed to build an OpenCL program.
39 * <p>
40 * If you use {@link #save(java.io.ObjectOutputStream)} to persist build configurations between
41 * JVM sessions it is highly recommended to call {@link #forDevice(com.jogamp.opencl.CLDevice) }
42 * or {@link #forDevices(com.jogamp.opencl.CLDevice[]) } before building the program.
43 * Driver updates or HW changes can make exact device-to-binary mapping hard, the
44 * builder will drop all unmappable binaries silently. Setting the devices explicitly will
45 * force automatic rebuilds from source in this situation.
46 * </p>
47 * @author Michael Bien
48 * @see com.jogamp.opencl.CLProgramBuilder#createConfiguration()
49 * @see com.jogamp.opencl.CLProgramBuilder#loadConfiguration(java.io.ObjectInputStream)
50 */
51public interface CLBuildConfiguration extends Cloneable {
52
53 /**
54 * Builds or rebuilds the program.
55 * @param program The program which should be build.
56 */
57 public CLProgram build(CLProgram program);
58
59 /**
60 * Builds or rebuilds the program.
61 * @param program The program which should be build.
62 * @param listener The callback who is notified when the program has built.
63 */
64 public CLProgram build(CLProgram program, CLBuildListener listener);
65
66 /**
67 * Sets the program which should be build.
68 */
70
71 /**
72 * Adds the device as build target.
73 */
75
76 /**
77 * Adds the devices as build target.
78 */
80
81 /**
82 * Resets this builder's configuration like options, devices and definitions.
83 */
85
86 /**
87 * Resets this builder's configuration options.
88 */
90
91 /**
92 * Resets this builder's macro definitions.
93 */
95
96 /**
97 * Resets this builder's device list.
98 */
100
101 /**
102 * Adds the definition to the build configuration.
103 * @see CLProgram#define(java.lang.String)
104 */
105 public CLBuildConfiguration withDefine(String name);
106
107 /**
108 * Adds the definition to the build configuration.
109 * @see CLProgram#define(java.lang.String, java.lang.Object)
110 */
111 public CLBuildConfiguration withDefine(String name, Object value);
112
113 /**
114 * Adds the definitions to the build configuration.
115 * @see com.jogamp.opencl.CLProgram#define(java.lang.String)
116 */
117 public CLBuildConfiguration withDefines(String... names);
118
119 /**
120 * Adds the definitions to the build configuration.
121 * @see com.jogamp.opencl.CLProgram#define(java.lang.String, java.lang.Object)
122 */
123 public CLBuildConfiguration withDefines(Map<String, ? extends Object> defines);
124
125 /**
126 * Adds the compiler option to the build configuration.
127 * @see com.jogamp.opencl.CLProgram.CompilerOptions
128 */
129 public CLBuildConfiguration withOption(String option);
130
131 /**
132 * Adds the compiler options to the build configuration.
133 * @see com.jogamp.opencl.CLProgram.CompilerOptions
134 */
135 public CLBuildConfiguration withOptions(String... options);
136
137 /**
138 * Clones this configuration.
139 */
141
142 /**
143 * Saves this configuration to the ObjectOutputStream.
144 * The caller is responsible for closing the stream.
145 */
146 public void save(ObjectOutputStream oos) throws IOException;
147
148}
This object represents an OpenCL device.
Definition: CLDevice.java:53
Represents a OpenCL program executed on one or more CLDevices.
Definition: CLProgram.java:64
Configuration representing everything needed to build an OpenCL program.
CLBuildConfiguration forDevices(CLDevice... devices)
Adds the devices as build target.
void save(ObjectOutputStream oos)
Saves this configuration to the ObjectOutputStream.
CLBuildConfiguration resetOptions()
Resets this builder's configuration options.
CLBuildConfiguration forDevice(CLDevice device)
Adds the device as build target.
CLBuildConfiguration withDefines(Map< String, ? extends Object > defines)
Adds the definitions to the build configuration.
CLBuildConfiguration resetDevices()
Resets this builder's device list.
CLBuildConfiguration withOptions(String... options)
Adds the compiler options to the build configuration.
CLBuildConfiguration withDefine(String name, Object value)
Adds the definition to the build configuration.
CLBuildConfiguration clone()
Clones this configuration.
CLBuildConfiguration withDefines(String... names)
Adds the definitions to the build configuration.
CLBuildConfiguration reset()
Resets this builder's configuration like options, devices and definitions.
CLProgram build(CLProgram program, CLBuildListener listener)
Builds or rebuilds the program.
CLBuildConfiguration withDefine(String name)
Adds the definition to the build configuration.
CLBuildConfiguration resetDefines()
Resets this builder's macro definitions.
CLProgramConfiguration setProgram(CLProgram program)
Sets the program which should be build.
CLProgram build(CLProgram program)
Builds or rebuilds the program.
CLBuildConfiguration withOption(String option)
Adds the compiler option to the build configuration.
A callback an application can register to be called when the program executable has been built (succe...
Configuration representing everything needed to build an OpenCL program (program included).