OpenCLTemplate
Class to help editing OpenCL code
Constructor. Takes care of a Rich Text Box KeyUp event to paint things
RichTextBox to control
Help indentation?
Regular text color
Regular text font
Comments color
Comments font
List of string structures to mark
KeyUp event handler
Forces OpenCL RichTextBox to be updated
Stops updating text box while coloring text
Rich text box to lock
Restarts updating text box
Rich text box to unlock
Defines a structure of strings to mark
Description of string type
Color to use for this string type
Font to be used in this list of strings
List of strings of this type
Displays OpenCL related information
Constructor.
Required designer variable.
Clean up any resources being used.
true if managed resources should be disposed; otherwise, false.
Required method for Designer support - do not modify
the contents of this method with the code editor.
The main entry point for the application.
OpenCL Helper Editor
Required designer variable.
Clean up any resources being used.
true if managed resources should be disposed; otherwise, false.
Required method for Designer support - do not modify
the contents of this method with the code editor.
Constructor.
Button to test code
OpenCL calculations class
String to include to enable Double Precision calculations
Currently used acceleration
Initialization error
Sets CLCalc status to NotUsingCL
Initializes OpenCL and reads devices
Initializes OpenCL from an existing Context and reads devices
Existing context pointer
Existing command queue pointer
Tries to execute actual code in device to check its availability.
Command queue number to check
Releases OpenCL resources
Last found error
List of available platforms
List of available devices
Gets string to include to enable Double Precision calculations
Gets acceleration type being used
Gets initialization error description
Last error. Throws exception if not set to success.
OpenCL accelerations
Has not tested what type of acceleration is going to be used.
OpenCL used to accelerate calculations
No OpenCL used/supported
Class to hold OpenCL devices
Device ID
Device type string
Device name string
Device vendor string
OpenCL version string
Execution capabilities of the device
Is device available?
Is device compiler available?
Maximum memory allocation size in bytes
Memory size in bytes
Maximum number of work-items
that can be specified in each dimension of the work-group
to clEnqueueNDRangeKernel.
Maximum number of work-items in a
work-group executing a kernel using the data parallel execution model.
Constructor
Device ID
Class to hold OpenCL Platforms
Platform ID
OpenCL profile string. Profile name supported by the implementation.
OpenCL version string.
OpenCL name string.
OpenCL vendor string.
OpenCL extensions string.
Constructor.
Sets this platform's ID
Program related stuff
Local event
OpenCL context using all devices
Synchronous command queues that are executed in call order
Asynchronous command queues
Default synchronous command queue set as the first GPU, for ease of use.
Compiled program
Ends all commands being executed
Compiles program contained in a single string.
Source code to compile
Compiles program contained in a single string. Returns build logs for each device.
Source code to compile
Build logs for each device
Compiles the program.
Source code to compile
Compiles the program. Returns the build logs for each device.
Source code array to compile
Build logs for each device
Variables class
Data to be stored
Original variable length
Memory buffer
Constructor. Creates from an existing OpenCL variable
OpenCL variable pointer
Original array length
sizeOf(array datatype)
Constructor.
Variable whose size will be allocated in device memory.
Constructor.
Variable whose size will be allocated in device memory.
Constructor.
Variable whose size will be allocated in device memory.
Constructor.
Variable whose size will be allocated in device memory.
Constructor.
Variable whose size will be allocated in device memory.
Constructor.
Variable whose size will be allocated in device memory.
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Writes variable to device
Values to write to device
Command queue to use
TRUE to return only after completed writing.
OpenCL Event associated to this operation
OpenCL Events that need to finish before this one can start
Writes variable to device
Values to write to device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Reads variable from device.
Values to store data coming from device
Command queue to use
TRUE to return only after completed reading.
OpenCL Event associated with this operation
OpenCL Events that need to finish before this one can start
Reads variable from device. Does not return until data has been copied.
Values to store data coming from device
Sets this variable as an argument for a kernel
Index of kernel argument
Kernel to receive argument
Releases variable from memory.
Destructor
Returns the size of the stored variable
Kernels class
Local kernel storage
Number of arguments
Creates a new Kernel
"Remember" variables
Sets kernel arguments
Variables to be set as arguments
Execute this kernel
Command queue to use
Arguments of the kernel function
Array of maximum index arrays. Total work-items = product(max[i],i+0..n-1), n=max.Length
Events to wait before executing this
Event of this command
Execute this kernel
Command queue to use
Arguments of the kernel function
Array of maximum index arrays. Total work-items = product(max[i],i+0..n-1), n=max.Length
Local work sizes
Events to wait before executing this
Event of this command
Execute this kernel
Array of maximum index arrays. Total work-items = product(max[i],i+0..n-1), n=max.Length
Arguments of the kernel function
Execute this kernel using work_dim = 1
Global work size in one-dimension. global_work_size = new int[1] {GlobalWorkSize}
Arguments of the kernel function
Execute this kernel
Array of maximum index arrays. Total work-items = product(max[i],i+0..n-1), n=max.Length
Local work sizes
Arguments of the kernel function
Releases kernel from memory
Destructor
Gets how many arguments this kernel has
OpenCL programs
Basic linear algebra functions
Float vector sum kernel
float matrix multiplication kernel
float Gauss Seidel method
LU factorizaton method
Constructor. Builds OpenCL program.
Converts vector to matrix
Vector
Matrix first dimension
Matrix second dimension
Converts matrix to vector
Matrix
Matrix first dimension
Matrix second dimension
Returns the sum of two matrices
Matrix 1
Matrix 2
Matrix multiplication
Matrix 1
Matrix 2
Gauss Seidel method for iterative linear system solving. Returns unknown x
Matrix M so that Mx=b
Initial estimate
Known vector b
Gauss-Seidel iterations per step
Maximum number of times Gauss-Seidel iterations
Desired sqrt(Sum(error[i]^2))*number of equations
Estimated absolute error per component
Gauss Seidel method for iterative linear system solving. Returns unknown x
Matrix M so that Mx=b
Initial estimate
Known vector b
Estimated error per equation
Solves linear system Mx = b by LU decomposition. Returns x
Matrix M
Vector b
Maximum acceptable absolute error
Maximum iterations
Calculates LU decomposition of M matrix
Matrix to decompose
Matrix dimension
Swap index
Gauss Seidel method. Make sure to send x = b. Replaces x.
Matrix multiplication. Dimensions { p, r }.
Basic linear algebra functions
Float vector sum kernel
double matrix multiplication kernel
double Gauss Seidel method
LU factorizaton method
Constructor. Builds OpenCL program.
Converts vector to matrix
Vector
Matrix first dimension
Matrix second dimension
Converts matrix to vector
Matrix
Matrix first dimension
Matrix second dimension
Returns the sum of two matrices
Matrix 1
Matrix 2
Matrix multiplication
Matrix 1
Matrix 2
Gauss Seidel method for iterative linear system solving. Returns unknown x
Matrix M so that Mx=b
Initial estimate
Known vector b
Gauss-Seidel iterations per step
Maximum number of times Gauss-Seidel iterations
Desired sqrt(Sum(error[i]^2))*number of equations
Estimated absolute error per component
Gauss Seidel method for iterative linear system solving. Returns unknown x
Matrix M so that Mx=b
Initial estimate
Known vector b
Estimated error per equation
Solves linear system Mx = b by LU decomposition. Returns x
Matrix M
Vector b
Maximum acceptable absolute error
Maximum iterations
Calculates LU decomposition of M matrix
Matrix to decompose
Matrix dimension
Swap index
Gauss Seidel method. Make sure to send x = b. Replaces x.
Matrix multiplication. Dimensions { p, r }.
Float differential equation integrator
Writes final Y values and estimated absolute errors
Updates X to current time
Independent variable current value in OpenCL memory
Dynamic system current state in OpenCL memory
Derivative calculator
Constructor.
Initial state of system
Desired step per integration pass
Initial independent variable value
Function to calculate derivatives vector
Integrates equation set to a final value using current stepsize. Ideally, final value
and currentX should multiples of stepsize.
Final value to reach.
Sets current state
New independent variable value
New state values
Takes an integration step. Saves and returns stepsize back to what it was.
Step size to use
Takes an integration step
Sets step size.
Step size to use
Gets current values of space-state variables (from Device).
Gets current absolute error sum
Gets current independent variable value (from Device).
Function to calculate derivatives vector
IN: Scalar. Independent variable.
IN: State-space vector.
OUT: Derivatives
OpenCL source
double differential equation integrator
Writes final Y values and estimated absolute errors
Updates X to current time
Independent variable current value in OpenCL memory
Dynamic system current state in OpenCL memory
Derivative calculator
Constructor.
Initial state of system
Desired step per integration pass
Initial independent variable value
Function to calculate derivatives vector
Integrates equation set to a final value using current stepsize. Ideally, final value
and currentX should multiples of stepsize.
Final value to reach.
Sets current state
New independent variable value
New state values
Takes an integration step. Saves and returns stepsize back to what it was.
Step size to use
Takes an integration step
Sets step size.
Step size to use
Gets current values of space-state variables (from Device).
Gets current absolute error sum
Gets current independent variable value (from Device).
Function to calculate derivatives vector
IN: Scalar. Independent variable.
IN: State-space vector.
OUT: Derivatives
OpenCL source
Discrete element modeling. Calculates derivatives of n particle-spring model into a 6n space-state
system (positions, velocities, x,y,z each).
Mass values (n)
Original positions (3n)
Origins (L) origs[i] connects to dests[i]
Destinations (L)
Spring constants (L)
Spring constants to ground (n)
Damping (L)
Damping to ground (n)
Number of Connections (1)
Initial distances (L)
Actuating forces (3*n)
Connection forces (L)
Nodes connections (int, 20*n)
Initial lengths kernel. work_dim = 1, globalsize = n
Initial length arguments
Reset forces kernel. work_dim = 1, globalsize = 3n
Reset forces arguments
Calculate forces kernel. work_dim = 1, globalsize = L
Calculate forces arguments
Calculate forces kernel. work_dim = 1, globalsize = n
Calculate forces arguments
Calculate forces kernel. work_dim = 1, globalsize = L
Calculate forces arguments
Calculate nodes connections. work_dim = 1, globalsize = n
Calculate nodes connections arguments
Constructor.
Number of masses in the system
Number of connections
Mass of each vertex
Position and velocity of vertexes
[2*3*i] - posx, [2*(3*i+1)] - posy, [2*(3*i+2)] - posz,
[1+2*3*i] - velx, [1+2*(3*i+1)] - vely, [1+2*(3*i+2)] - velz
Origin vertex of connections. Spring connects Origin[i] to Dests[i]
Destination vertex of connections. Spring connects Origin[i] to Dests[i]
Spring constant for each connection
Spring constant for each mass, connecting to ground (nMass)
Structural damping (relative-speed dependant) (nConnections)
Absolute damping proportional to speed relative to Earth (nMass)
Calculates derivatives of deformable body space-state vector dydx[6n]. dydx[2i] - i-th position deriv,
dydx[2i+1] - ith velocity deriv
Reset forces. Work_dim = 1, nmax = { nMasses }
Derivatives sketch. Work_dim = 1, nmax = { 3 * nMasses }
Forces
Masses
Independent variable
State space vector
Derivatives
Initial L0 calculation. work_dim = 1, global_work_size[0]=nConnections
Forces calculation. Returns forces. Work_dim = 1, nmax = { nConnections }
Calculates forces to ground. w_dim=1, global_work_size = nMasses
Calculates forces to ground. w_dim=1, global_work_size = nMasses
Vector sum - sums two vectors
Integer vector sum. work_dim = 1
Float vector sum. work_dim=1
Long vector sum. work_dim=1
Double vector sum. work_dim=1
Minimum differences - makes matrix of shifted differences of vectors
Differences convolution. work_dim=2
Floating point particle system physics
Motion Newton-law 1D solver. Kernel: rk46
Force applier to particles. Kernels: ResetForces, ApplyGravity, FloorCollision
Collision applier to particles. Kernels: ResetForces, ApplyGravity, FloorCollision
Initializes physics program. Components indexes: [i] - x, [i+1] - y, [i+2] - z
Number of particles
Sets particles parameters
Positions (3*numParticles)
Speeds (3*numParticles)
Masses (numParticles)
Collision sizes (numParticles)
Gets particles positions
Gets how many close neighbors a particle has. Use this to avoid drawing unnecessary particles
Gets simulation time
Stepsize
Executes an integration step
Motion step arguments
Takes an integration step
Step size
Applies gravity
Apply gravity arguments
Applies gravity force.
Gravity force. Remember to use negative for down direction.
Clear forces
Apply gravity arguments
Clears forces
Floor collision
Apply floor collision arguments
Applies floor collision?
Wall collision
Apply floor collision arguments
Applies floor collision?
Self collision
Apply self collision arguments
Applies self collision?
Reset close neighbors
Apply self collision arguments
An useful class to read/write/delete/count registry keys
To read a registry key.
input: KeyName (string)
output: value (string)
To write into a registry key.
input: KeyName (string) , Value (object)
output: true or false
To delete a registry key.
input: KeyName (string)
output: true or false
To delete a sub key and any child.
input: void
output: true or false
Retrive the count of subkeys at the current key.
input: void
output: number of subkeys
Retrive the count of values in the key.
input: void
output: number of keys
A property to show or hide error messages
(default = false)
A property to set the SubKey value
(default = "SOFTWARE\\" + Application.ProductName.ToUpper())
A property to set the BaseRegistryKey value.
(default = Registry.LocalMachine)
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Creates a Matrix of real numbers.
Matrix items
Linear Solve parameter. Maximum mean error allowable to linear solve method.
Linear Solve parameter. Limit linear solution correction iterations.
Linear Solve parameter. Should the solution method halt if a hard singulariry is found in matrix?
Linear Solve parameter. Should the method ignore if the matrix has a close-to-zero determinant and keep solving?
Constructor. Initializes a [0,0] matrix.
Constructor. Creates matrix from existing items.
Matrix items to create matrix from.
Copy constructor.
Matrix to copy from.
Constructor. Creates empty matrix with specified dimensions.
Number of rows in matrix.
Number of columns in matrix.
Sums two matrixes.
First matrix to sum.
Second matrix to sum.
Subtracts two matrixes.
Matrix to subtract from.
Matrix to be subtracted.
Matrix multiplication. Notice that m1 rows should be the same as m2 lines for compatibility.
First matrix to multiply.
Second matrix to multiply.
Matrix scalar multiplication.
Matrix to multiply.
Scalar to multiply.
Matrix scalar multiplication.
Matrix to multiply.
Scalar to multiply.
Matrix post-vector multiplication. Notice that a vector is a [1,Cols] matrix which means
vector length should be equal matrix number of columns.
Matrix to multiply.
vector to multiply.
Matrix pre-vector multiplication. Notice that a vector is a [1,Cols] matrix which means
vector length should be equal matrix number of lines.
Matrix to multiply.
vector to multiply.
Matrix scalar division.
Matrix to multiply.
Scalar to divide each element of matrix.
Compares matrixes and returns true if they are identical.
Matrix to compare to.
Returns matrix transpose.
Element-wise product. This is not regular matrix product. It multiplies elements
at corresponding positions.
Matrix to multiply element-wise.
Returns Euclidean norm of the matrix.
Dot product of two matrixes.
Matrix to dot product with/
Element-wise inversion. Returns the matrix with each element (x) inverted (1/x).
Creates internal LU factorization of this matrix.
Returns the solution x to the linear system Ax=b, A being this matrix.
Right-hand side known values.
Returns the determinant of this matrix.
Returns the inverse of this matrix.
Returns the solution x to the linear system A'Ax=A'b, A being this matrix.
Right-hand side known values.
Returns the weighted solution x to the linear system A'WAx=A'Wb,
A being this matrix. TO DO: Correct quality check
Right-hand side known values.
Weight matrix.
Returns the weighted solution x to the linear system A'DAx=A'Db,
A being this matrix. D is a diagonal weight matrix.
Right-hand side known values.
Main diagonal elements of diagonal weight matrix D.
Calculates R², corrected R² and Quadratic Error for the trySolution x to the linear system A'Ax=A'b,
A being this matrix.
Right-hand side known values.
Solution to use to evaluate quality indexers.
Applies the Gram-Schmidt orthonormalization method to this matrix, replacing
it by the orthonormalized matrix.
Applies the Gram-Schmidt orthonormalization method to this matrix, replacing
it by the orthonormalized matrix and also correcting right-hand Y values for a linear system solve.
Right-hand side known values.
Applies the Gram-Schmidt orthonormalization method to this matrix using
a pre-set order of normalization. Replaces current matrix
by the orthonormalized matrix and also correcting
right-hand Y values for a linear system solve.
Right-hand side known values.
Line order to apply the orthonormalization method.
Starts orthonormalization from line lineOrder[indStart]. Assumes previous lines are already
normalized.
Returns a string representing this matrix.
Accesses items in current matrix.
Row of element to access.
Column of element to access.
Gets the number of rows in this matrix.
Gets the number of columns in this matrix.
Returns the R² index of last fit.
Returns corrected R² index of last fit.
Returns the sum of quadratic errors of last fit.