Hi,Is it possible to multiply 2 big matrixes using OpenGL as fast as possible? In the other word, I want to do so by using GPU. Thanks
Hi,Is it possible to multiply 2 big matrixes using OpenGL as fast as possible? In the other word, I want to do so by using GPU. Thanks
It is not the intended use, especially if you want precise results.
Anyway, here is a good site about general "General-Purpose computation on GPUs" :
http://www.gpgpu.org/
http://www.gpgpu.org/wiki/FAQ
Why do you think it is not intended use? In fact, I want to multiply 2 double matrixes faster than writting a simple and normal code. Someone says that OpenGL can be used as an interface to GPU. Is it true?
Of course it is possible, and for GPGPU computations OpenGL is a good API to use, see the FAQ link I posted for more details.
What I mean is that graphic accelerators are not intented to be used as high performance scientific clusters, basically you will have to trade off precision and flexibility to get cheap processing power.
EDIT : ie. it is already hard to get float precision, for double it will be even harder.
OK, By using OpenGL as an Interface to GPGPU programming, I think there is no need to tackle with GPGPU directly.I mean that we write our codes in OpenGL and this is the OpenGL who runs the codes in GPU. Is it true? If so, could you please give me an example to show how can I multiply 2 matrixes in OpenGL? Thank you very much!
Read The Links.
1. RTFM
2. What is your exact definition of "big"? Don't tell me it's 4x4.
GLIM - Immediate Mode Emulation for GL3
1.OUCHOriginally posted by Jan:
1. RTFM
2. What is your exact definition of "big"? Don't tell me it's 4x4.
![]()
The links that Zbuffer provided are quite good.
Anyway, to my knowledge there is no native support for matrix multiplication beyond 4x4. However, matrix multiplication is inherently vectorizable, meaning it is possible to compute the product of matrices as the product of sub-matrices or vectors.
For instance, a matrix-vector product can be vectorized as 4 vector scales and 4 vector adds. A matrix-matrix multiply can likewise be coded as 4 matrix-vector multiplies. An NxM-MxQ multiply can be perhaps optimally coded as combination of 4x4 sub-matrices. For starters, I would try to decompose the input matrix into a blocked matrix consisting of 4x4 sub-matrix entries. For example, given 2 8x8 matrices P and Q,
If your matrix dimensions are not already multiples of 4, consider padding them with zeros as necessary.Code :PQ = ( A B )(E F) = (AE+BG AF+BH) ( C D )(G H) (CE+DG CF+DH) where A, B, C, D, E, F, G and H are each 4x4 sub-matrices of P and Q.
At any rate, the trick to computational speed with GPUs is vectorizing your operations. Bear in mind this speed has to be weighed against time needed to transfer the operations to and from the GPU, assuming that you need the results in you app.
Alternatively, SSE or 3DNOW! intrinsics could be leveraged in place of GPU processing, scenario permitting. You may find an introduction to these intrinsics helpful in understanding the general concepts in SIMD architectures.
I hope this helps.
I want to multiply a 50000x9 matrix by a 9x9 matrix. Now, is it possible to do it in GPU? If so, is it possible to do it by using OpenGL?