Error: Creation of Function Handle is not supported by arrayFun call.
Ältere Kommentare anzeigen
I am trying my hand at using GPU tools for ODE computation in efforts to emulate a project that did that. I tried running a simple program through the same. My code is divided into three parts
My Main Function -
tspan = gpuArray([0,20]);
y1=gpuArray(2);
corrected = arrayfun(@wrap,tspan,y1);
[t,y] = gather(corrected);
A wrap function that calls ode45-
function [t,y] = wrap(tspan,y0)
[t,y]= ode45(@vbp1,tspan,y0);
end
vbp1
function dydt = vbp1(t,ya)
dydt = [ya(2); (1-ya(1)^2)*ya(2)-ya(1)];
end
This is the error I seem to be getting
Error using main (line 4)
Creation of function handles is not supported.
For more information see Tips.
Error in 'wrap' (line: 2)
Can anyone figure out why this error is being thrown. I'm fairly new to MATLAB, so please forgive me if the errors are rudimentary.
Antworten (1)
Walter Roberson
am 19 Okt. 2022
1 Stimme
You have more than one challenge here.
The one that is more limiting is that ode45 and the similar functions do not support GPUs.
[https://www.mathworks.com/help/matlab/referencelist.html?type=function&capability=gpuarrays>
This is not why you received the error, but it tells you that the other problem is not worth solving at this point.
1 Kommentar
Sohan
am 21 Okt. 2022
Kategorien
Mehr zu Parallel Computing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!