Real GPU parallel computation ?

Dear all,
I want to improve my code by using parallel & GPU computation .
I currently use parfor and gpuArray, for example
x = gpuArray(rand(256,256)) ;
# all variable are in the type of gpuArray
parfor i=1:50000
m = 0:255;
list = (beta/2)* ((x(i) - m).^2) + (eta/2)*(m.^gamma) + ((zeta/2)*((m - Y(i))).^2) + (kappa/2)*((u(i) - m)).^2 ;
[~,Index] = min(list) ;
M(i) = Index;
end
I also try to increase the workers in a parallel pool from 4 to 24 works, but it will not change anything.
The computation time is always between 24s ~ 26s in my device (i7-6700, GTX 1060 6GB)
and the max utilization of CPU & GPU are 50 & 65, respectively.
I have some questions about that
  1. What is the max number of workers in a parallel pool in a 8-cores CPU?
  2. Is the workers from CPU or GPU?
  3. Is there any possible I can use the GPU thread directly to do any GPU parallel computation?
  4. Can I increase the GPU usage to accelerate my code?
I suppose my code is only use CPU parallelization and GPU computation instead of GPU parallel computation
Thank you for reading my question.

댓글 수: 2

Joss Knight
Joss Knight 2018년 5월 2일
To get parallelism on a GPU you need to formulate your code to operate on large vectors and matrices instead of using loops (see Vectorization). MATLAB then takes care of spreading all that work over the GPU cores for you.
You do not explicitly write code to run on different GPU cores, not unless you want to write your own kernels in CUDA C++.
Bibby Lai
Bibby Lai 2018년 5월 7일
Thank your for your answer.
I'll try to vectorize my code, but right now I accelerate my code by using GPU Coder, the computation time is less than 0.1 second.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 GPU Computing에 대해 자세히 알아보기

질문:

2018년 4월 30일

댓글:

2018년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by