Can I use GPU computing inside of a parfor loop?

16 views (last 30 days)
I am in the process of upgrading my computer and I am wondering if there is a potential for upgrading my GPU. Right now I am only using parfor. However, within the parfor loop there are operations that would seem to benefit from using GPU computing. I get the impression from this entry ( https://www.mathworks.com/matlabcentral/answers/36235-parfor-on-gpu ) that for what I want to do, I would need to use multiple GPUs. Now, I don't know enough about GPUs to know what kind of questions to ask, but I'll start with these:
If I am running 8 workers with parfor, does this mean that I would need to allocate 8 GPUs? Does GPU = graphics card and if so, then I need to buy 8 graphics cards (impractical)? Or do graphics cards have multiple GPUs? If this is possible, how would I go about choosing the right graphics card for the job?
Thanks in advance -jz

Accepted Answer

Edric Ellis
Edric Ellis on 7 Mar 2014
You do not need 8 separate graphics cards even if you have 8 workers using gpuArrays simultaneously. (In fact, I'm not even sure that you can put 8 GPUs in a single system). Having multiple workers using a single GPU simultaneously is called "oversubscribing". Whether or not you see any performance benefit from this depends strongly on the details of your problem - and how much of that you can actually run on the GPU.
For example, consider a case where you have a problem that, when run in a single MATLAB session, only spends 1/4 of its time using the GPU. In that case, you might expect good performance running 4 workers accessing the same GPU (providing the arrays all still fit in memory). If you run that against 8 workers, you will see diminishing returns as the workers all contend for access to the GPU.
  4 Comments
Jay
Jay on 7 Mar 2014
Great! Thanks for the answer. If you don't mind me asking, when looking for a graphics card, what should I look for? Do I have to make sure the graphics card memory can support the array(s) of data I will be sending it? Does more GPU cores = faster processing?
Edric Ellis
Edric Ellis on 10 Mar 2014
You could take a look at the GPUBench results. Generally speaking, NVIDIA's 'Tesla' series of cards are aimed more at computation and usually have better double-precision performance, as well as features like error correction (ECC). The 'GTX' cards often have very good single-precision performance.

Sign in to comment.

More Answers (1)

Matt J
Matt J on 7 Mar 2014
Edited: Matt J on 7 Mar 2014
I get the impression from this entry ( https://www.mathworks.com/matlabcentral/answers/36235-parfor-on-gpu ) that for what I want to do, I would need to use multiple GPUs.
That's not the impression I get. Edric said in that thread that 1 GPU (he uses "GPU" to mean graphics card) might be enough, depending on the computation that you're doing. Have you tried it on your current graphics card?
  3 Comments
Matt J
Matt J on 7 Mar 2014
Edited: Matt J on 7 Mar 2014
If you don't currently have a CUDA capable graphics card, what is your theory that it will benefit you based on? What does your computation look like?
Jay
Jay on 7 Mar 2014
I have been going through the tutorials for GPU computing and it seemed like I could benefit from it. And most of my processing is image processing on 4MP images.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!