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!