Image processing using gpu array

8 views (last 30 days)
nahyun lee
nahyun lee on 16 Mar 2020
Answered: Sai Bhargav Avula on 23 Mar 2020
Hi all,
I am now trying to process the image using gpu array.
I made the code so that the gpu can be used, but I confirmed that matlab is running using CPU instead of using GPU on the computer.
The code to use gpu is as follows.
O = gather(video_ycbcr(gpuArray(video)))
O_cpu = {};
O_cpu{1} = O(:,:,001:149); % Can be easily extend to multiple GPU
O_gpu{1} = gpuArray(O_cpu{1}); % Move array from CPU to GPU for acceleration
R_gpu{1}=RainDetect(O_gpu{1},paras);
R_cpu{1}=gather(cat(3,R_gpu{1}{:}));
R = R_cpu{1};
What parts of this code need to be modified to use GPU properly on a computer?
Thank you.
  3 Comments
Walter Roberson
Walter Roberson on 16 Mar 2020
O = num2cell(O,[1 2])
It is not obvious to me that produces a cell on the gpu or that the entries will be on the gpu. I do not understand why you convert to cell instead of just indexing the input?

Sign in to comment.

Answers (1)

Sai Bhargav Avula
Sai Bhargav Avula on 23 Mar 2020
Hi,
The link attached below gives a better insight on how to use GPU for better performance.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!