Indexing Arrays for Loops in a gpuArray/arrayfun-called Function
이전 댓글 표시
I am using MATLAB R2016a, and I'm trying to use GPUArray to make some data processing take less than the two weeks it's taken me using "parpool"... but I've been having issues with that.
Specifically, I was under the impression that indexing is supported with my version of Matlab and the Parallel Computing Toolbox (ver. 6.8). However, I keep getting the following error:
Error using gpuArray/arrayfun
Indexing is not supported.
For more information see Tips and Restrictions.
Error in 'iterateFunc' (line: 6)
Below is my code:
cond=a 60,000-element boolean column vector;
A=gpuArray(an 60,000-by-endID matrix full of NaN's);
B=gpuArray(another 60,000-by-endID matrix full of NaN's);
for time=2:endID
valid=size(A,1);
[tint_new,dint_new]=arrayfun(@iterateFunc,timerange,A,B,valid);
tint_soFar(cond,time-1)=tint_new;
dint_soFar(cond,time-1)=dint_new;
end
...where...
function [tint_new,dint_new]=iterateFunc(timerange,A,B,valid)
tint_result=nan(valid,1);
dint_result=tint_result;
for pos=1:valid
[tint,dint,~,~]=someFunction(timerange,A(pos,:),timerange,B(pos,:),1);
tint_new(pos,1)=tint(1);
dint_new(pos,1)=dint(1);
end
end
Note that "someFunction" is the pseudonym I gave for a custom-written function which only works using 1-D vectors. I would ideally find a way to make it work with higher-dimension arrays, but that's another issue.
Given this, what could I do to return tint_new and dint_new as 60,000-by-endID matrices, some of which have non-NaN values?
Thank you!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 GPU Computing in MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!