Code optimization with GPU
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
POHL Michel
am 16 Jan. 2021
Kommentiert: Joss Knight
am 16 Jan. 2021
Hi everyone, I have the following line of codes which I would like to parallelize on the GPU :
U = zeros(q, M, q, 'gpuArray');
for j=1:q
U(j,:,j) = my_line_vector;
end
Is there any way to suppress the loop?
Thes are the lines of code that run the slowest in my program.
Thank you in advance
Michel
0 Kommentare
Akzeptierte Antwort
Joss Knight
am 16 Jan. 2021
Bearbeitet: Joss Knight
am 16 Jan. 2021
I = reshape(gpuArray.eye(q),q,1,q);
U = I.*my_line_vector;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu GPU Computing in MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!