I would like to port a physics simulation algorithm to GPU using OpenCL for performance; I have no experience with OpenCL, and I am looking around. The computations are mostly small dense matrix (3x3) and vector products, cross-products and so on.
Is there some "standard"/recommended library for such basic operations? I certainly don't want to code matrix multiplications and inversions myself (not time, and it would be inefficent)
As OpenCL does not have classes, operator overloading etc, do I have to write mmul(a,mtrans(b))
instead of a*b.transpose()
for instance?
Are there some (planned) extensions/evolution of OpenCL (or pre-processor, for that matter) to make the notation more math-like? I have the impression of going back to fortran years. (I know there is CUDA, but it is vendor-bound)
To answer your questions:
If you know for a fact that you are limited to 3-dimensional objects, then you might consider using the double3 type (or float3 if your gpu doesn't support double precision).
So far, only vectors are supported, so you will have to do some coding yourself regarding any use of matrix multiplication or inversion. However, you might be interested in the following built-in geometric functions. In particular, dot products and cross products are defined.
You might also be interested to know that there are reserved data types for futures implentations of matrices: see for example double n x m. In your case, if available in the future, you will be able to use double3x3 types for your matrices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With