How to run a custom function to gpu?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Joss Knight
el 4 de Ag. de 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 comentarios
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!