필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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.

채택된 답변

Joss Knight
Joss Knight 2018년 7월 4일
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;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by