How can a create a vector directly on GPU, just like we can create a vector on CPU?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
JAI PRAKASH
il 4 Lug 2018
Commentato: JAI PRAKASH
il 5 Lug 2018
lut = [0;0;1;1;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1];
How can I create the above vector directly on GPU.
i want to avoid gpuArray(lut). Because it takes extra time for transferring data.
0 Commenti
Risposta accettata
Joss Knight
il 4 Lug 2018
It's a little bit far-fetched to expect to be able to create an arbitrary array directly on the GPU - after all, the only way to read in the numbers you type is via main memory.
However, there are many standard build functions that create default arrays directly on the GPU: https://uk.mathworks.com/help/distcomp/establish-arrays-on-a-gpu.html#bspvmhe-1
For instance, in your case you might go:
lut = ones(40, 1, 'gpuArray');
lut([1 2 5 6]) = 0;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su GPU Computing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!