How to run a custom function to gpu?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Joss Knight
il 4 Ago 2020
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 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!