How to create a sequence of numbers on the GPU
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David Parks
am 21 Jan. 2016
Bearbeitet: David Parks
am 21 Jan. 2016
I want to do the follow in a new GPU Array, efficiently:
myarray = 1:100000
gpuArray(1:100000) works of course, but if I'm not wrong it's creating the large array in main memory then moving the whole thing to the GPU. I would expect that I can create the sequence of numbers on the GPU directly more efficiently, as I can do with many random numbers.
0 Kommentare
Akzeptierte Antwort
Edric Ellis
am 21 Jan. 2016
The direct equivalent is to use gpuArray.colon, like so:
myarray = gpuArray.colon(1,100000);
1 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu GPU Computing in MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!