gpu array calculation limited memory

1 view (last 30 days)
AA
AA on 20 Dec 2014
Commented: AA on 21 Dec 2014
Hi, i have a quadro 2200 with 4 gig ram. I would like to do a calculation with a variable that is 6 gigabytes big. Since gpuarray is limited, I wanted to know if there is any other solutiob
  2 Comments
Matt J
Matt J on 21 Dec 2014
Edited: Matt J on 21 Dec 2014
What do you mean "other" solution? What solution are you using now? And in what way isn't it working?
The obvious solution that comes to mind is just to split the data into smaller pieces and send them in separate jobs.
AA
AA on 21 Dec 2014
That is what I had in my mind, but how do I have to reset my gpuarray after that each time? That is time consuming. Is there an overwrite function or something like that? For instance consider the variable x which is 6 gigabyte. That variable is split into x1 and x2, of which each of them is 3 gigabyte. Now I do gpuArray(x1) perform the calculation and then I have to do gpuArray(x2) but that is not accepted as the gpumemory is full with x1. How do I incorporate gpuArray(x2)?

Sign in to comment.

Accepted Answer

Matt J
Matt J on 21 Dec 2014
Edited: Matt J on 21 Dec 2014
You should clear memory on the GPU before doing further calculations. For example, if y1 is the gpuArray resulting from the calculation with x1, then you could clear x1 and bring y1 back to the CPU with,
clear x1
y1=double(y1);
This will free memory on the GPU for x2.
  3 Comments
Matt J
Matt J on 21 Dec 2014
Edited: Matt J on 21 Dec 2014
clear q(x,y)
would give you an error, I'd expect. Also, If you want s{x,y} data held on the host device instead of the GPU, you could do instead,
s{x,y} = double( sum(b, 2) );
AA
AA on 21 Dec 2014
clear q command doesnt give me an error because it gets cleared after each loop and the result stays at the gpu. I have enough space to store all of s on the gpu but not to store q. So q gets thrown out of the GPU.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!