How to run a custom function to gpu?
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi everyone,
I want to run a custom function in matlab. Actually, in this example is the gctest function from matlab, but I wonder how I can do this with any function.
Suppose that I have an nxm matrix ret, then I want to run the gctest of the first column against the remaining columns.
The code that I use is the following:
ret = gpuArray(ret);
arrayfun( @(i) gctest( ret(:,1), ret(:,i)), sample, 'UniformOutput', true);
but I get the following error:
The following error occurred converting from gpuArray to double: Conversion to double from gpuArray is not possible.
Error in varm/estimate (line 403) Z(:,iColumns) = kron(Y(t-i,:),I);
Error in gctest (line 204) [EstMdl,~,~,~,Sigma] = estimate(Mdl,Data);
So, if I understand correct matlab tries to convert ret back to double.
Any ideas how to solve this?
Thank you in advance.
댓글 수: 0
답변 (1개)
Joss Knight
2020년 8월 4일
I guess the basic problem is that the gctest function doesn't support gpuArray data. You could try taking a copy of it and fixing the issues it has with that support. In this case, the LHS of the assignment, Z, needs to be a gpuArray for that statement to work.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!