why the program take long time?
1 view (last 30 days)
Show older comments
Sir I am using a program which have several .m function file. To run all those file i use this command
T=linspace(0,25,2)
for i=1:length(T);
t=KB.*T(i)./EF;
yA=ym./t;
yt=yn.*sqrt(t);
mu=t.*log(exp(1./t)-1);
if T(i)==0
tdt(i)=0
else
tdt(i)=Main_drag(mu,KF,t,yA,yt,d,e,ep,epa,L,ND)./T(i).^2
end
It take approximate 20 minute, but when I use T=linspace(0,25,6) it takes more than two hours. And for T=linspace(0,25) I haven't got the results even after one weak.
What is the problem here.
Tell me about the parallel computing for this code.
Tell me also, how could I increase the running speed of program, for example by using graphics, cloud and cluster.?
2 Comments
KSSV
on 30 May 2019
T=linspace(0,25,6) ; this case input is small. Only six numbers
T=linspace(0,25 ); This case input has 100 numbers. So time taken is large compared to previous case.
What is the problem here. We don' tknow......we cannot help you unless we know what is in the function Main_drag.m.
Tell me about the parallel computing for this code. Don't get fancy without making the present code fast. First confirm whether parallel is really required?
Tell me also, how could I increase the running speed of program, for example by using graphics, cloud and cluster.? We can't unless the function is known.
Stephen23
on 30 May 2019
Edited: Stephen23
on 30 May 2019
"What is the problem here."
You did not upload the function Main_drag, which will likely take most of the evaluation time (judging by the very simple loop that you did show us), so we do not know why your code is slow.
"how could I increase the running speed of program, for example by using graphics, cloud and cluster.?"
Instead of jumping into GPU and cluster computing, you should start by ensuring that your choice of algorithm and your implementation are efficient.
Did you profile the code? Did you follow the guidelines in the documentation?:
If you want help with this, then upload Main_drag by clicking the paperclip button.
Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!