How to create a sequence of numbers on the GPU
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Edric Ellis
2016-1-21
The direct equivalent is to use gpuArray.colon, like so:
myarray = gpuArray.colon(1,100000);
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!