Effacer les filtres
Effacer les filtres

How can a create a vector directly on GPU, just like we can create a vector on CPU?

1 vue (au cours des 30 derniers jours)
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.

Réponse acceptée

Joss Knight
Joss Knight le 4 Juil 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;

Plus de réponses (0)

Catégories

En savoir plus sur GPU Computing dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by