Code optimization with GPU
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
POHL Michel
le 16 Jan 2021
Commenté : Joss Knight
le 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 commentaires
Réponse acceptée
Joss Knight
le 16 Jan 2021
Modifié(e) : Joss Knight
le 16 Jan 2021
I = reshape(gpuArray.eye(q),q,1,q);
U = I.*my_line_vector;
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur GPU Computing in MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!