Can I run custom Matlab function or gpuArray on another GPU?
4 views (last 30 days)
Show older comments
Hello, everyone
I work on image processing and handle large scale images. I designed an algorithm that could get the result I wanted by multiple iterations, and it ran successfully.
%% code example
input = zeros(500,500,50);
a = zeros(500,500,50);
b = zeros(500,500,50);
c = zeros(500,500,50);
d = zeros(500,500,50);
input = gpuArray(input);
a = gpuArray(a);
b = gpuArray(b);
c = gpuArray(c);
d = gpuArray(d);
for i=1:100
a = input + d;
b = a + input;
c = b + a;
d = func1(c);
end
I use the gpuArray provided by matlab to speed up operations.But the size of the image I'm processing is constrained by the size of the GPU's memory.
Can I load c,d arrays on another gpu? Or can I run func1 on another GPU2? I want to reduce the consumption of memory of my current GPU1. Do you have any suggestions?
0 Comments
Accepted Answer
Joss Knight
on 20 Apr 2022
You can use parallel syntax to process other arrays on other GPUs at the same time, or to process some data on the CPU at the same time as processing others on the GPU. Try this documentation for some examples.
In your code example your initial arrays a, b and c are all immediately overwritten by other variables. Does that matter? Anyway, worth checking.
More Answers (0)
See Also
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!