MATLAB Answers

nah
0

Are parallel for loops available on GPUs ?

Asked by nah
on 13 Sep 2013
Does matlab PCT have capabilities to run parallel for loops on GPUs? (like the GFOR equivalent in Jacket ? Or even Matlab's own parfor that does parallel for loops on multiple processors/workers )

  0 Comments

Sign in to comment.

1 Answer

Answer by Jill Reese
on 18 Sep 2013
 Accepted Answer

While there is no general capability to execute for loops directly on the GPU, if all of the operations inside the for loop are element-wise operations you can try to convert your code to call arrayfun to execute the for loop directly on the GPU.
If the loop body involves matrix multiplication over pages of a gpuArray, then you can replace the for loop with a single call to pagefun.

  0 Comments

Sign in to comment.