Can I run custom Matlab function or gpuArray on another GPU?
조회 수: 4(최근 30일)
표시 이전 댓글
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
채택된 답변
Joss Knight
2022년 4월 20일
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.
추가 답변(0개)
참고 항목
범주
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!