Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-opencl-utils Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 03:55:52 2022 GMT+0.
Next: Systems, Previous: The cl-opencl-utils Reference Manual, Up: The cl-opencl-utils Reference Manual [Contents][Index]
cl-opencl-utils is a library of utilities for working with OpenCL, especially including a Lispified version of OpenCL C. It is built on top of the cl-opencl library (https://www.github.com/ghollisjr/cl-opencl). The examples/ directory has examples showing how to use some of the included utilities. Features implemented so far: * Lispified OpenCL C language * Complex numbers (full suite of functions in progress, including libcerf) * Map (make-opencl-mapper), multiple-input single-output mapping * Reduce (make-opencl-reducer), only associative 2-argument functions at the moment * Device-side RNG (pcg32 for PCG-XSH-RR 32 bit) * Function sampling (make-opencl-function-sampler) * Finite-domain integration (make-opencl-integrator, make-opencl-complex-integrator) * Splines (make-opencl-spline-form) * Runge-Kutta 4th order algorithm (make-opencl-rk4) cl-opencl-utils is GPL3 with the exception of a few snippets of code that may or may not be able to be promoted to GPL from e.g. the MIT license. If they can't be promoted then they're still MIT license as noted above each snippet. The Lispified OpenCL C language follows a few rules: 1. If a symbol has not been given special meaning, it will be translated into an all-lowercase string, non-alphanumeric symbols preserved. 2. If the first element of a list does not contain a symbol with a special meaning, it is translated into a C-style function call. E.g., (f x y) ==> f(x,y). 3. Specialized meanings for symbols are defined with defclc, which causes the #'clc function to generate a different C source code string result. E.g., (clc `(zerop x)) ==> ((x) == 0) since zerop has a special meaning already defined. 4. Functions in C that have a Lisp equivalent have their Lisp aliases defined. E.g., (expt x y) ==> pow(x,y), but (pow x y) ==> pow(x,y) as well. 5. Variables are declared via the var and vararray operators: (var x :int 0) ==> int x = 0. (var f (const :double) 5d0) ==> const double f = 5.0; (vararray x :double (2 3)) ==> double x[2][3]. (vararray y :double (5) 1 2 3 4 5) ==> double x[5] = {1,2,3,4,5} I tend to use the CFFI-style keyword symbols for types as it improves readability, but it's not technically necessary. 6. Blocks are created with progn: (progn (var i :int 0) (var j :int i)) ==> {int i = 0; int j = i;} 7. for, while, and do-while provide for-loops, while-loops and do-while loops: (for (var i :int 0) (< i 10) (incf i) (setf sum (+ sum i))) ==> for(int i = 0; i < 10; ++i) { sum = sum + i; } (var x :double 1d0) (var i :int 0) (while (< i 5) (incf i) (setf x (* x 2d0))) ==> double x = 1.0; int i = 0; while(i < 5) { ++i; x = x*2.0; } (do-while (< i 5) (incf i) (setf x (* x 2d0))) ==> do { ++i; x = x*2.0; } while(i < 5); 8. Non-lower case terms can be supplied with Lisp strings, whereas symbols are converted to lowercase. (function "Hello" :int () (return 1)) ==> int Hello () {return 1;} Whereas (function Hello :int () (return 1)) ==> int hello () {return 1;} This also works with the defclcfun and defclckernel macros: (defclcfun "AddSomeNumbers" :int ((var x :int) (var y:int)) (return (+ x y))) ("AddSomeNumbers" 1 2) ==> 3 Whereas (AddSomeNumbers 1 2) ==> compilation error 9. Typecasting works using either the typecast or coerce operators: (typecast x :int) ==> ((int) x) (coerce x :int) ==> ((int) x) 10. Pointers have a type operator, pointer. The address and value operators return the address or value of their argument: (var x :int 0) ;; create pointer variable to address of x (var px (pointer :int) (address x)) ;; get value of x through the pointer px (value px) 11. Arrays are accessed with aref: (aref xs 5) ==> x[5] (aref ys 1 2 3) ==> y[1][2][3] 12. Structs are defined with defstruct: (defstruct mystruct (var x :double) (var y :int)) ==> struct mystruct { double x; int y; }; Members are accessed by member and pmember, member for struct objects and pmember for pointers to struct objects: (member s x) ==> s.x (pmember p x) ==> p->x Structs can also be defined in a similar way to functions via defclcstruct, which both defines a CFFI type accessible to Lisp and an OpenCL C struct of the same size and structure available on the OpenCL device. The above example could be defined in Lisp via (defclcstruct mystruct (:x :double) (:y :int)) and later referred to as a type in Lispified OpenCL C code, e.g. (var s (:struct mystruct)) (setf (member s :x) 1d0) ; setf works with members with the definition for "mystruct" automatically included in the OpenCL C source string produced by the various compiler functions listed below. Note that the (:struct structname) form must be used to refer to structs in Lispified OpenCL C, while support for bare structs in CFFI is deprecated but still possible. Good practice is to use (:struct structname) for both. See examples/struct.lisp. Also note that as stated below, #'clc de-packages symbols (except functions, kernels, and structs defined with defclcfun, defclckernel, and defclcstruct), so members can be defined and referred to using any package. To match CFFI style, keyword symbols are recommended for defclcstruct, but in the above examples you can change the package of any of the slot names and the same OpenCL C code will result. To easily support CFFI-Lisp translation, you can use the :class keyword during struct definition and define methods for translate-from-foreign-memory etc.: (defclcstruct (mystruct :class mystruct) (:x :double) (:y :int)) (defmethod translate-from-foreign (pointer (type mystruct)) (list :x (foreign-slot-value pointer '(:struct mystruct) :x) :y (foreign-slot-value pointer '(:struct mystruct) :y))) ;; example usage: (convert-from-foreign some-cffi-pointer '(:struct mystruct)) ==> (list :x some-x-value :y some-y-value) See https://www.common-lisp.net/project/cffi/manual/html_node/Foreign-Type-Translators.html for more information on defining CFFI-Lisp translation methods. 13. Macros can be defined with defclcmacro: (defclcmacro square (x) `(* ,x ,x)) (square 2) ==> (* 2 2) ==> 2*2 Macros have already been used to define complex+ and complex- in math.lisp, for example. 14. Global variables can be defined with defclcglobalvar: (defclcglobalvar (var G_X :double 0d0)) ==> double g_x 0.0; //note case (defclcglobalvar (var "G_X" :double 0d0)) ==> double G_X 0.0; //note case 15. Complex numbers are supported by CFFI type (:struct cl_complex). Note that native Lisp complex numbers are automatically converted to and from CFFI, so this type can be used with the OpenCL functions and native complex data can be sent and received. See examples/complex.lisp. When in doubt, test a form with the #'clc function to see what OpenCL C code it produces. Note that the OpenCL C code generated has many technically unnecessary parentheses and code blocks from the perspective of well-written C code, but this is to ensure that all possible use cases from the Lisp perspective lead to reasonable code. You can have overly specific C code generated from Lisp and be safe, but ambiguous code can lead to strange problems, so I went with the safe route. Note that symbols are essentially de-packaged from the perspective of defclc and clc, as they are interned into the cl-opencl-utils package before processing. This allows the use of symbols from any package to denote Lispified OpenCL C code, which is surprisingly inconvenient to use when symbols are treated as if they belong to a single package and you don't want to import all of cl-opencl-utils into the package you're using. E.g., (clc `(cl:+ 2 2)) ==> (2+2) (clc `(some-package:+ 2 2)) ==> (2+2) However, there are mechanisms for defining OpenCL C functions and struct types, and these are package-dependent so as to allow different utility libraries to define functions without worrying about clashes. See notes on defclcfun, defclckernel, and defclcstruct. OpenCL source code is still converted into strings and supplied to the cl-opencl Lisp API functions like cl-create-program-with-source, but there are a few options for how to generate the OpenCL C source code from the Lispified code. The following functions and accompanying macros aid in this: * program-source-from-forms-fn: Function to create source code from top-level forms of Lispified OpenCL C code. You provide the Lispified code as arguments to this function directly, and any defined kernels or programs with the defclcfun and defclckernel macros are automatically added to the source code when they're referred to by the supplied code. * program-source-from-forms: Macro version of the same where arguments aren't evaluated. * program-source-from-kernels-fn: Creates source code for a program from just the kernel symbols supplied. The definitions and necessary previously defined functions are found and included in the OpenCL C program generated. * program-source-from-kernels: Macro version where the arguments aren't evaluated. For example, a basic hello-world kernel might be produced via: ;; Kernel definition (defclckernel hello ((var n (global (pointer :uint))) (var buf (global (pointer :uint)))) (var gid :int (get-global-id 0)) (when (< gid (value n)) (setf (aref buf gid) gid))) ;; Make kernel (let* ((platform (first (cl-get-platform-ids))) (device (first (cl-get-device-ids platform +CL-DEVICE-TYPE-ALL+))) (context (cl-create-context platform (list device))) (source (program-source-from-kernels hello)) (program (cl-create-program-with-source context source))) (cl-build-program-with-log program (list device)) (cl-create-kernel program "hello")) I recommend reading the examples at least once to get an idea of how to use the utilities in a complementary way.
Next: Files, Previous: Introduction, Up: The cl-opencl-utils Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
OpenCL utility library built on cl-opencl
Gary Hollis
GPLv3
cl-opencl (system).
Next: Packages, Previous: Systems, Up: The cl-opencl-utils Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-opencl-utils/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-opencl-utils (system).
Next: cl-opencl-utils/utils.lisp, Previous: cl-opencl-utils/cl-opencl-utils.asd, Up: Lisp [Contents][Index]
cl-opencl-utils (system).
Next: cl-opencl-utils/macro.lisp, Previous: cl-opencl-utils/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/clc.lisp, Previous: cl-opencl-utils/utils.lisp, Up: Lisp [Contents][Index]
utils.lisp (file).
cl-opencl-utils (system).
defclcmacro (macro).
Next: cl-opencl-utils/clc-utils.lisp, Previous: cl-opencl-utils/macro.lisp, Up: Lisp [Contents][Index]
macro.lisp (file).
cl-opencl-utils (system).
clc (function).
Next: cl-opencl-utils/function.lisp, Previous: cl-opencl-utils/clc.lisp, Up: Lisp [Contents][Index]
clc.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/struct.lisp, Previous: cl-opencl-utils/clc-utils.lisp, Up: Lisp [Contents][Index]
clc-utils.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/syntax.lisp, Previous: cl-opencl-utils/function.lisp, Up: Lisp [Contents][Index]
function.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/headers.lisp, Previous: cl-opencl-utils/struct.lisp, Up: Lisp [Contents][Index]
struct.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/var.lisp, Previous: cl-opencl-utils/syntax.lisp, Up: Lisp [Contents][Index]
syntax.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/control.lisp, Previous: cl-opencl-utils/headers.lisp, Up: Lisp [Contents][Index]
headers.lisp (file).
cl-opencl-utils (system).
defclcglobalvar (macro).
Next: cl-opencl-utils/bool.lisp, Previous: cl-opencl-utils/var.lisp, Up: Lisp [Contents][Index]
var.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/math.lisp, Previous: cl-opencl-utils/control.lisp, Up: Lisp [Contents][Index]
control.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/raw-functions.lisp, Previous: cl-opencl-utils/bool.lisp, Up: Lisp [Contents][Index]
bool.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/compile.lisp, Previous: cl-opencl-utils/math.lisp, Up: Lisp [Contents][Index]
math.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/complex.lisp, Previous: cl-opencl-utils/raw-functions.lisp, Up: Lisp [Contents][Index]
raw-functions.lisp (file).
cl-opencl-utils (system).
program-source (function).
Next: cl-opencl-utils/math-functions.lisp, Previous: cl-opencl-utils/compile.lisp, Up: Lisp [Contents][Index]
compile.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/libcerf.lisp, Previous: cl-opencl-utils/complex.lisp, Up: Lisp [Contents][Index]
complex.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/cleanup.lisp, Previous: cl-opencl-utils/math-functions.lisp, Up: Lisp [Contents][Index]
math-functions.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/map-reduce.lisp, Previous: cl-opencl-utils/libcerf.lisp, Up: Lisp [Contents][Index]
libcerf.lisp (file).
cl-opencl-utils (system).
with-opencl-cleanup (macro).
Next: cl-opencl-utils/convolution.lisp, Previous: cl-opencl-utils/cleanup.lisp, Up: Lisp [Contents][Index]
cleanup.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/function-sampling.lisp, Previous: cl-opencl-utils/map-reduce.lisp, Up: Lisp [Contents][Index]
map-reduce.lisp (file).
cl-opencl-utils (system).
make-opencl-convolutor (function).
Next: cl-opencl-utils/integration.lisp, Previous: cl-opencl-utils/convolution.lisp, Up: Lisp [Contents][Index]
convolution.lisp (file).
cl-opencl-utils (system).
make-opencl-function-sampler (function).
Next: cl-opencl-utils/spline.lisp, Previous: cl-opencl-utils/function-sampling.lisp, Up: Lisp [Contents][Index]
function-sampling.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/random.lisp, Previous: cl-opencl-utils/integration.lisp, Up: Lisp [Contents][Index]
integration.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/blas.lisp, Previous: cl-opencl-utils/spline.lisp, Up: Lisp [Contents][Index]
spline.lisp (file).
cl-opencl-utils (system).
Next: cl-opencl-utils/rk4.lisp, Previous: cl-opencl-utils/random.lisp, Up: Lisp [Contents][Index]
random.lisp (file).
cl-opencl-utils (system).
make-opencl-axpy (function).
Previous: cl-opencl-utils/blas.lisp, Up: Lisp [Contents][Index]
blas.lisp (file).
cl-opencl-utils (system).
make-opencl-rk4 (function).
Next: Definitions, Previous: Files, Up: The cl-opencl-utils Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: Indexes, Previous: Packages, Up: The cl-opencl-utils Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Macros, Previous: Public Interface, Up: Public Interface [Contents][Index]
Next: Ordinary functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Defines a OpenCL C function which is loaded automatically into a program’s code.
Defines a global variable using form. form should be one of (var ...) or (vararray ...). The name of the global variable is taken from the var form.
Defines a OpenCL C kernel which is loaded automatically into a program’s code.
Defines a Lispified OpenCL C macro.
Defines both a CFFI struct and an analogous struct available to OpenCL C.
Defines struct available to OpenCL C, but no CFFI type.
Calls defrawclcfun using the contents of a source file located at body-path. body-path is evaluated, no other arguments are evaluated. Make sure that the file contains only the body with enclosing braces {}, and does not include the prototype, name, or type information. Can include these in a comment, and this is recommended for good style.
Macro version of defheader-fn
Defines a OpenCL C function from its type, name, argument list, string for body, and allows specification of explicit header, cheader and function dependencies of the function. No arguments are evaluated. Make sure that the string contains only the body with enclosing braces {}, and does not include the prototype, name, or type information. Can include these in a comment.
Macro version of program-fn where top-level-forms are not evaluated.
Returns all source code needed to create program using the functions supplied.
Returns all source code needed to create program using the kernels supplied.
Defines a C header as well as executing the defclc forms
Many functions in cl-opencl-utils return a list (object cleanup) where cleanup is called once object is no longer needed. This macro sets var to the value of object and automatically calls the cleanup function at the end of the body.
Next: Standalone methods, Previous: Macros, Up: Public Interface [Contents][Index]
Looks up either 1. Form if form is an atom, or 2. First element of form if form is a list in the operator table *opsymbol->opfunction* and calls the function mapped there with no arguments for atoms or the remaining arguments in the form for lists. If there is no defined operator corresponding to the first element of the list, standard function call notation is assumed and the symbol is downcased as a string for the function name.
Returns all compilation flags required by code form clc
Defines a OpenCL C header or set of headers by its filename(s) fnames,
the OpenCL C objects it provides, and the flags necessary for compiling and
linking.
flags must be a string of compile & link flags for your OpenCL C compiler.
Returns list of explicit headers for that symbol
Returns (axpy cleanup) where axpy is of the form (lambda (a xbuf
ybuf &key count event-wait-list)...) which sets ybuf to the value of a*x + y where a is a scalar
x and y are OpenCL buffers treated as vectors. The return value of
axpy is an event to be waited on for the completion of the OpenCL
operation.
cleanup should be called once the axpy function is no longer needed.
with-opencl-cleanup is useful here.
count is the number of elements to use in the x and y buffers. If not
supplied, then the minimum number of elements that would fit in xbuf
or ybuf of the given type will be used.
type is the OpenCL type to use for a, xbuf, and ybuf.
Same as make-opencl-integrator, but with complex output values for expr. See make-opencl-integrator documentation for details on return values and usage. The only missing keyword parameter is type, as the (:struct cl_complex) type uses double-precision.
Returns a list (convolutor cleanup), where convolutor accepts an
input value and returns the convolution of functions A and B at that
point, and cleanup is a function to call to cleanup foreign and OpenCL
memory allocations.
expr-A and expr-B should be functions that accept a list of strings
and return an OpenCL C expression for the A or B function value
respectively. The first string will be the primary argument, and the
rest of the the strings will be parameter values.
ndomain is the number of samples to take from domain in order to
perform the numerical integration.
convolutor will be a function (lambda (x &key params-A params-B event-wait-list)...)
with sticky values for params-A and params-B so that they only need
supplying when they need to be changed. The number of parameters are
set by the nparams-A and nparams-B for A and B respectively.
Returns a list (function cleanup) where function is of the form
(lambda (out-buffer &key low high nsamples out-start event-wait-list) ...)
that will perform a function sampling operation according to the input
parameters. out-buffer must be an OpenCL memory object with write
ability, and low, high, and nsamples are parameters for function
sampling that must be set at least once. The optional parameters are
sticky, so that once set, they maintain their value until changed.
The results will be written to out-buffer starting at out-start.
out-start defaults to 0. The return value of the generated function
is an event that will need to be waited on and released at some point.
queue must be an OpenCL queue handle.
input-type should be a CFFI type designator.
If output-type is not specified, it is assumed to be input-type.
expr should be a Lisp function accepting one string and returning
OpenCL C code for an expression of a unary operation to apply to the
variable referenced in the string argument. The expression can refer
to code defined in the preamble string argument or included in one of
the headers. opencl-function-expr can be useful to generate
expressions from already-defined OpenCL C functions.
memobj is the source memory buffer.
preamble can be Lispified OpenCL C code or a string of OpenCL C code
to be placed below headers but above the reduction kernel. Useful for
defining utility functions to call in the expression.
headers can be a list of device header file names to include in the
kernel OpenCL C code.
options can be compiler options for the OpenCL kernel.
start can be an initial index offset to start reading from the buffer.
end can be a final index offset to stop reading from the buffer. Uses
subseq index convention, i.e. the element at index=end is not
included.
kernel and program will need to be released at some point once you’re done using the reducer.
Returns a list (integrator cleanup), where integrator is of the form
(lambda (xlow xhigh &key params (ndomain (expt 10 3)) event-wait-list)...)
which returns the value of the integral of a function between xlow and
xhigh, where the function is supplied as a Lispified OpenCL expression
generated by the expr function.
expr should accept a string representing the input x value and
returning Lispified OpenCL C code for the value of the function at
that x value, optionally accepting additional parameter arguments up
to nparams.
ndomain controls the number of points sampled from the domain
[xlow,xhigh] and is a sticky parameter in that once it’s set, it
maintains its value until changed.
params are a sticky argument supplying optional parameters to the
integrated function.
mode can be one of :simpson, :midpoint, :trapezoid, :left, or :right to use the corresponding sampling method.
Returns a list (mapper cleanup) where mapper is of the form
(lambda (in-buffers out-buffer &key params event-wait-list) ...)
that will perform a map operation according to the input parameters.
in-buffers and out-buffer must be a list of OpenCL memory objects and
a single object respectively. The results will be written to
out-buffer starting at 0. If only a subset of a buffer should be read
from or written to, use OpenCL sub buffers via cl-create-sub-buffer.
The return value of the generated function is an event that will need
to be waited on and released at some point.
cleanup should be called once the mapper is done being used so that
OpenCL memory can be cleaned up. The with-opencl-cleanup macro can be
useful.
queue must be an OpenCL queue handle.
input-types should be a list of CFFI type designators or a single type
designator. In the case of a single type designator, in-starts and
in-ends are assumed to be indices rather than lists of indices.
If output-type is not specified, it is assumed to be the first
input-type.
mexpr should be a Lisp function accepting one string and returning
OpenCL C code for an expression of a unary operation to apply to the
variable referenced in the string argument. The expression can refer
to code defined in the preamble string argument or included in one of
the headers.
params can be a list of parameters to supply to the mexpr form in
addition to the primary argument. They will be handed to OpenCL
through a buffer.
memobj is the source memory buffer.
preamble can be a string of OpenCL C code to be placed below headers
but above the reduction kernel. Useful for defining utility functions
to call in the expression.
headers can be a list of device header file names to include in the
kernel OpenCL C code.
options can be compiler options for the OpenCL kernel.
kernel and program will need to be released at some point once you’re done using the reducer.
Returns a list (reducer cleanup) where reducer is of the form
(lambda (buffer &key start end event-wait-list) ...)
that will perform a reduction operation according to the input
parameters. buffer must an OpenCL memory object, and start and end
are optional indices into the buffer. cleanup should be called once
the reducer is done being used so that OpenCL memory can be cleaned
up.
queue must be an OpenCL queue handle.
type should be a CFFI type designator.
rexpr should be a Lisp function accepting two strings and returning
either Lispified OpenCL C code or a string for an OpenCL C expression
of a binary operation. The expression can refer to code defined in
the preamble string argument or included in one of the headers.
memobj is the source memory buffer.
preamble can be a string of OpenCL C code to be placed below headers
but above the reduction kernel. Useful for defining utility functions
to call in the expression.
headers can be a list of device header file names to include in the
kernel OpenCL C code.
options can be compiler options for the OpenCL kernel.
start can be an initial index offset to start reading from the buffer.
end can be a final index offset to stop reading from the buffer. Uses
subseq index convention, i.e. the element at index=end is not
included.
kernel and program will need to be released at some point once you’re done using the reducer.
Returns (stepper cleanup) where stepper is of the form (lambda (buf
&key x-delta event-wait-list params x0) ...) and has the effect of stepping the differential
equation solution for y(x) forward by x-delta using the RK4 algorithm.
buf will be modified by this, as it will contain the estimated value
of y(x + x-delta).
params is an optional argument supplying values to be placed in the
last argument to the kernel, either as a list of data to transfer to
the device or a buffer ID for data already on the device. If
parameters will be supplied, set nparams to the total number of
parameters required. It is up to the user to interpret the parameters
and make use of them in the various kernels supplied as arguments.
x-delta is a sticky parameter that retains its value between calls
until changed.
x0 when set to non-NIL will manually set the x0 value before starting
another iteration of the RK4 algorithm. This is useful for reusing an
existing RK4 stepper starting at a different place on the x-axis but
for the same differential equation. Make sure to set the values of
the supplied buffer to the proper initial conditions prior to calling
the stepper function.
The x0 argument supplied to make-opencl-rk4 is automatically set to
either 0f0 or 0d0 depending on the value of type.
Each element of dy/dx-kernels should the symbol name of a kernel or a
kernel of the form
(kernel dy/dx-kernel
((var x (global (pointer type)))
(var y (global (pointer type)))
(var dy (global (pointer type)))
(var params (global (pointer type))))
...)
which has the effect of setting dy to the value of dy/dx given x and
y. x will always be a single value, but there are y-count elements
available in y.
Note that each dy/dx-kernel does not need to check (get-global-id 0)
to see if it is below y-count, as this is automatically checked before
the kernel is called.
Returns Lispified OpenCL code for a spline function called name. Can be supplied to the preamble of other utilities like make-opencl-integrator or make-opencl-function-sampler.
Returns an expression function generating the Lispified OpenCL code to call that function when supplied with a list of arguments. Useful for multiple utilities, e.g. make-opencl-reducer, make-opencl-mapper, make-opencl-convolutor.
Returns string for the entire OpenCL C program consisting of the top-level forms preceded by any required headers
Returns string source code of program containing all code needed for the supplied function names, including other functions and header includes.
Returns string source code of program containing all code needed for the supplied kernel names, including other functions and header includes.
Returns the list of required headers for a form
Creates list of coefficients from 2-D coefficient array as stored in a cl-ana polynomial-spline.
Defines explicit function dependencies. op can be :set, :add, or :reset.
Defines explicit headers for symbol. op can be :set, :add,
or :reset to either set the header list, add new headers to the list,
or clear all headers for that symbol.
Do not use keyword symbols. Symbols are treated as package-less.
Next: Classes, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
cffi.
cffi.
Previous: Standalone methods, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Map from OpenCL C function symbol to alternative definitions
Default compilation flags for all OpenCL C programs
Map from OpenCL C function symbol or string to function code description
Map from OpenCL C function symbol to explicit function symbol dependencies.
Map from symbol to explicit list of headers required by that symbol.
Map from operation symbol to C-generating function.
Next: Ordinary functions, Previous: Special variables, Up: Internals [Contents][Index]
Defines an operator which takes arguments as specified in
lambda-list and executes the body. Body must return the resulting
string for the generated OpenCL C code.
&body will be replaced with &rest in the lambda-list since it will be supplied to the lambda operator.
Next: Generic functions, Previous: Macros, Up: Internals [Contents][Index]
Compress list such that duplicate elements are combined into a
single pair entry which has as the car the element value and as the
cdr the count.
The singleton-pairs option controls whether single elements are still placed inside a pair. This is useful when the elements of the list you wish to compress are cons cells, as this would otherwise lead to ambiguity in the result.
Returns OpenCL C code for the definition of a function.
Finds & repeatedly expands any res-macros present in expr until none are present.
Returns explicit OpenCL C function dependencies of that symbol.
Returns map from clc to header for that clc symbol
Returns list with duplicates removed
Returns full program source code (minus headers) given top-level forms
Returns OpenCL C code for the prototype of a function definition
Returns list of required functions for code
Returns list of required global variables of code in dependence ordering.
Returns list of required structs for code in order of dependence.
Returns list of required structs for code in reverse order of dependence.
Checks to see if list is a list with exactly one element.
Returns OpenCL C code for the definition of a struct.
Previous: Ordinary functions, Up: Internals [Contents][Index]
Generates an OpenCL string for the Lisp object.
args can be used along with side effects to ensure that the OpenCL C
string is sensible.
Previous: Definitions, Up: The cl-opencl-utils Reference Manual [Contents][Index]
Jump to: | A C D E F G L M O P R S T U W |
---|
Jump to: | A C D E F G L M O P R S T U W |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
+
S |
---|
Jump to: | *
+
S |
---|
Jump to: | B C F H I L M P R S U V |
---|
Jump to: | B C F H I L M P R S U V |
---|