|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nativelibs4java.opencl.CLProgram
public class CLProgram
OpenCL program.
An OpenCL program consists of a set of kernels that are identified as functions declared with the __kernel qualifier in the program source. OpenCL programs may also contain auxiliary functions and constant data that can be used by __kernel functions. The program executable can be generated online or offline by the OpenCL compiler for the appropriate target device(s).
A program object encapsulates the following information:
CLContext.setCacheBinaries(boolean).CLContext.createProgram(java.lang.String[])
| Field Summary | |
|---|---|
protected CLContext |
context
|
protected T |
entity
|
static boolean |
passMacrosAsSources
|
| Method Summary | ||
|---|---|---|
void |
addBuildOption(String option)
Please see OpenCL's clBuildProgram documentation for details on supported build options. |
|
void |
addInclude(String path)
Add a path (file or URL) to the list of paths searched for included files. |
|
void |
addSource(String src)
|
|
void |
allocate()
|
|
CLProgram |
build()
Returns the context of this program |
|
protected void |
clear()
|
|
protected String |
computeCacheSignature()
|
|
protected Runnable |
copyIncludesToTemporaryDirectory()
|
|
CLKernel |
createKernel(String name,
Object... args)
Find a kernel by its functionName, and optionally bind some arguments to it. |
|
CLKernel[] |
createKernels()
Return all the kernels found in the program. |
|
CLProgram |
defineMacro(String name,
Object value)
|
|
void |
defineMacros(Map<String,Object> macros)
|
|
boolean |
equals(Object obj)
Underyling implementation pointer-based equality test |
|
protected void |
finalize()
|
|
Map<CLDevice,byte[]> |
getBinaries()
Get the binaries of the program (one for each device, in order) |
|
CLContext |
getContext()
Returns the context of this program |
|
CLDevice[] |
getDevices()
|
|
static
|
getEntities(A[] objects,
org.bridj.Pointer<E> out)
|
|
protected OpenCLLibrary.cl_program |
getEntity()
|
|
String |
getIncludedSourceContent(String path)
|
|
URL |
getIncludedSourceURL(String path)
|
|
protected String |
getOptionsString()
|
|
protected Set<String> |
getProgramBuildInfo(OpenCLLibrary.cl_program pgm,
org.bridj.Pointer<OpenCLLibrary.cl_device_id> deviceIds)
|
|
String |
getSource()
Get the source code of this program |
|
int |
hashCode()
Underyling implementation pointer-based hashCode computation |
|
boolean |
isCached()
|
|
static com.nativelibs4java.util.Pair<Map<CLDevice,byte[]>,String> |
readBinaries(List<CLDevice> allowedDevices,
String expectedContentSignatureString,
InputStream in)
|
|
void |
release()
Manual release of the OpenCL resources represented by this object. |
|
Map<String,URL> |
resolveInclusions()
|
|
protected void |
setBinaries(Map<CLDevice,byte[]> binaries)
|
|
void |
setCached(boolean cached)
|
|
void |
setFastRelaxedMath()
Add the -cl-fast-relaxed-math compile option. |
|
void |
setFiniteMathOnly()
Add the -cl-finite-math-only compile option. |
|
void |
setMadEnable()
Add the -cl-mad-enable compile option. |
|
void |
setNoSignedZero()
Add the -cl-no-signed-zero compile option. |
|
void |
setNVMaximumRegistryCount(int N)
Add the -cl-nv-maxrregcount=N compilation option (NVIDIA GPUs only) Specify the maximum number of registers that GPU functions can use. |
|
void |
setNVOptimizationLevel(int N)
Add the -cl-nv-opt-level compilation option (NVIDIA GPUs only) Specify optimization level (default value: 3) |
|
void |
setNVVerbose()
Add the -cl-nv-verbose compilation option (NVIDIA GPUs only) Enable verbose mode. |
|
void |
setUnsafeMathOptimizations()
Add the -cl-unsafe-math-optimizations option. |
|
void |
store(OutputStream out)
Write the compiled binaries of this program (for all devices it was compiled for), so that it can be restored later using CLContext.loadProgram(java.io.InputStream) |
|
CLProgram |
undefineMacro(String name)
|
|
static void |
writeBinaries(Map<CLDevice,byte[]> binaries,
String source,
String contentSignatureString,
OutputStream out)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final CLContext context
public static boolean passMacrosAsSources
protected volatile T extends org.bridj.TypedPointer entity
| Method Detail |
|---|
protected void setBinaries(Map<CLDevice,byte[]> binaries)
public void store(OutputStream out)
throws CLBuildException,
IOException
CLContext.loadProgram(java.io.InputStream)
out - will be closed
CLBuildException
IOException
public static void writeBinaries(Map<CLDevice,byte[]> binaries,
String source,
String contentSignatureString,
OutputStream out)
throws IOException
IOException
public static com.nativelibs4java.util.Pair<Map<CLDevice,byte[]>,String> readBinaries(List<CLDevice> allowedDevices,
String expectedContentSignatureString,
InputStream in)
throws IOException
IOExceptionpublic CLDevice[] getDevices()
public void allocate()
protected OpenCLLibrary.cl_program getEntity()
public void addInclude(String path)
#include "subpath/file.cl" statements.
path - A file or URL that points to the root path from which includes can be resolved.public void addSource(String src)
protected Runnable copyIncludesToTemporaryDirectory()
throws IOException
IOException
public Map<String,URL> resolveInclusions()
throws IOException
IOException
public String getIncludedSourceContent(String path)
throws IOException
IOException
public URL getIncludedSourceURL(String path)
throws MalformedURLException
MalformedURLExceptionpublic String getSource()
public Map<CLDevice,byte[]> getBinaries()
throws CLBuildException
CLBuildExceptionpublic CLContext getContext()
public CLProgram defineMacro(String name,
Object value)
public CLProgram undefineMacro(String name)
public void defineMacros(Map<String,Object> macros)
public void setFastRelaxedMath()
public void setNoSignedZero()
public void setMadEnable()
public void setFiniteMathOnly()
public void setUnsafeMathOptimizations()
public void setNVVerbose()
public void setNVMaximumRegistryCount(int N)
N - positive integerpublic void setNVOptimizationLevel(int N)
N - positive integer, or 0 (no optimization).public void addBuildOption(String option)
protected String getOptionsString()
public void setCached(boolean cached)
public boolean isCached()
protected String computeCacheSignature()
throws IOException
IOException
protected Set<String> getProgramBuildInfo(OpenCLLibrary.cl_program pgm,
org.bridj.Pointer<OpenCLLibrary.cl_device_id> deviceIds)
public CLProgram build()
throws CLBuildException
CLBuildExceptionprotected void clear()
public CLKernel[] createKernels()
throws CLBuildException
CLBuildException
public CLKernel createKernel(String name,
Object... args)
throws CLBuildException
CLBuildExceptionpublic void release()
public static <E extends org.bridj.TypedPointer,A extends com.nativelibs4java.opencl.CLAbstractEntity<E>> org.bridj.Pointer<E> getEntities(A[] objects,
org.bridj.Pointer<E> out)
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||