Question

What do you think? What would be faster and how much faster: Doing sparse matrix (CSR) multiplication (with a vector) on the GPU or the CPU (multithreaded)?

Was it helpful?

Solution

It depends upon the size of the matrix and number of iterations that needs to be performed. This is because you need to copy the matrix data from CPU memory to GPU memory and copy back the results from the GPU to CPU. If you are gonna perform only one iteration on the matrix, its always better to do it on the CPU rather than doing it on a GPU. Moreover, GPU suffers from startup time. So, if you have more iterations to be performed, then go for GPU, else my option will be CPU. Likewise size of the matrix also affects the performance due to the data copying.

OTHER TIPS

My guess is that there would not be a big win with a GPU implementation, since you don't have the kind of homogeneous data structure that lends itself to embarallel processing.

I think veda hits the nail on its head. I am by no means an expert on this but I believe there is an overhead in putting the gpu to work and if the size of the computation isn't big enough the winnings of the gpu processing is lost to the overhead. However if you have something like a character skeleton where you have lots of matrices being multiplied then this would be more suited for the gpu. I'm currently also looking into these things for a project of mine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top