org.jocl.utils
Class Programs

java.lang.Object
  extended by org.jocl.utils.Programs

public class Programs
extends java.lang.Object

Utility methods related to programs.


Method Summary
static org.jocl.cl_program createFromFile(org.jocl.cl_context context, java.lang.String fileName, java.lang.String... compileOptions)
          Creates an OpenCL program for the function with the given name from the specified file.
static org.jocl.cl_program createFromSource(org.jocl.cl_context context, java.lang.String sourceCode, java.lang.String... compileOptions)
          Creates an OpenCL program for the function with the given name from the given source code.
static org.jocl.cl_program createFromStream(org.jocl.cl_context context, java.io.InputStream stream, java.lang.String... compileOptions)
          Creates an OpenCL program for the function with the given name from the given input stream.
static java.lang.String obtainBuildLogs(org.jocl.cl_program program)
          Returns the build logs for the given program as a string
static void release(org.jocl.cl_program... programs)
          Release each of the given programs if it is not null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createFromFile

public static org.jocl.cl_program createFromFile(org.jocl.cl_context context,
                                                 java.lang.String fileName,
                                                 java.lang.String... compileOptions)
                                          throws java.io.IOException
Creates an OpenCL program for the function with the given name from the specified file. The program will be created using the given context, and has to be released by the caller, using release(cl_program...).

Parameters:
context - The context
fileName - The file name
compileOptions - The compile options
Returns:
The program
Throws:
java.io.IOException - If the file can not be read

createFromStream

public static org.jocl.cl_program createFromStream(org.jocl.cl_context context,
                                                   java.io.InputStream stream,
                                                   java.lang.String... compileOptions)
                                            throws java.io.IOException
Creates an OpenCL program for the function with the given name from the given input stream. The program will be created using the given context, and has to be released by the caller, using release(cl_program...) The caller is responsible for closing the given stream after this method returns.

Parameters:
context - The context
stream - The stream
compileOptions - The compile options
Returns:
The program
Throws:
java.io.IOException - If the stream can not be read

createFromSource

public static org.jocl.cl_program createFromSource(org.jocl.cl_context context,
                                                   java.lang.String sourceCode,
                                                   java.lang.String... compileOptions)
Creates an OpenCL program for the function with the given name from the given source code. The program will be created using the given context, and has to be released by the caller, using release(cl_program...)

Parameters:
context - The context
sourceCode - The source code
compileOptions - The compile options
Returns:
The program

obtainBuildLogs

public static java.lang.String obtainBuildLogs(org.jocl.cl_program program)
Returns the build logs for the given program as a string

Parameters:
program - The program
Returns:
The build logs

release

public static void release(org.jocl.cl_program... programs)
Release each of the given programs if it is not null.

Parameters:
programs - The programs to release