How to use GPU cores in matlabpool?

4 views (last 30 days)
PRANJAL
PRANJAL on 24 Jun 2014
Edited: Matt J on 24 Jun 2014
Hello, I am new to GPU computing. From what I read so far about matlabpool is that using "parfor" one can make his code parallel. But the maximum number of worker which can be allocated is 12. I have a GPU with 488 cores, how do I use these cores to create more workers? Is such thing possible?

Answers (1)

Matt J
Matt J on 24 Jun 2014
Edited: Matt J on 24 Jun 2014
No, GPU cores don't work like CPU cores and are not capable of serving as parfor workers.
To exploit the GPU, you use the gpuArray command to create matrices and arrays that reside on, and are manipulated by, the GPU with greater speed than normal MATLAB matrices.
The GPU does not give you the same flexibilty as parfor in terms of the kinds of operations that you can parallelize. You can only do operations that are defined for gpuArray objects.
  2 Comments
PRANJAL
PRANJAL on 24 Jun 2014
Thank you. But I have couple of doubts
1. I wanted to execute a for loop with large number of iteration using 'parfor'. I could execute the same now using 12 workers only. Is it not possible to use GPU cores?
2. Somewhere in my program I have a nested for loop. I can use "arryfun" instead of for loop, but the limitation is that I can't define a for loop inside "arrayfun". So do I have to declare arrayfun inside arrayfun? Does it work that way ?
Matt J
Matt J on 24 Jun 2014
Edited: Matt J on 24 Jun 2014
  1. No, as I said, GPU cores cannot serve as matlabpool/parpool workers.
  2. There is a list here of allowable functions that can be used inside gpuArray's arrayfun method. Further calls to arrayfun are not among them.
The operations that you are doing don't sound well-suited to the GPU, unless there's a way to vectorize that double for-loop.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!