Skip to content

Mathematics library taking advantage of OpenCL hardware acceleration. Single-precision floating-point square matrix multiplication is all that is currently implemented. May be extended to other operations in the future. Assignment for UAA's CSCE 448 course.

License

Notifications You must be signed in to change notification settings

jacobsee/CL-Math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About CL-Math

Mathematics library taking advantage of OpenCL hardware acceleration. Written for UAA's CSCE 448 course.

Current Status

Single-precision floating-point square matrix multiplication is all that is currently implemented. May be extended to other operations in the future.

Usage

More documentation is available in the wiki.

"lib/cl-math.h" must be included in any code you wish to use it in.

#include <lib/cl-math.h>

Multiplication of square single-precision floating-point matrices is as simple as the following:

CLMath* math = new CLMath();

Matrix a = math -> CreateSquareMatrix(SIZE, INIT_RANDOM); // or INIT_ZEROES
Matrix b = math -> CreateSquareMatrix(SIZE, INIT_RANDOM); // or INIT_ZEROES
Matrix c;

math -> CLSquareMatrixMultiply(a, b, c, SIZE, DEVICE_TYPE_GPU); // or DEVICE_TYPE_CPU

The matrices can be printed to console as shown:

math -> PrintMatrix(c, SIZE);

Matrix elements can be directly interacted with as floating point values:

Matrix a = math -> CreateSquareMatrix(3, INIT_ZEROES);
a[1][1] = 5;

The CreateSquareMatrix function takes a side length as the first argument. Matrices are later accessed using zero-indexing, so a 3x3 matrix generated using CreateSquareMatrix(3, INIT_ZEROES) is valid from [0-2][0-2].

License

Released under the MIT License. See file LICENSE for details.

About

Mathematics library taking advantage of OpenCL hardware acceleration. Single-precision floating-point square matrix multiplication is all that is currently implemented. May be extended to other operations in the future. Assignment for UAA's CSCE 448 course.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published