Model running for days

조회 수: 3 (최근 30일)
Alexandra
Alexandra 2016년 7월 6일
댓글: Alexandra 2016년 7월 8일
Hi, I know this is a very open question but the Monte Carlo simulation I built is getting so massive that the model is running for almost a week.
I have a 64bit PC with 8GB memory. Is there anything I can do to make the model run in just one day? Like, changing the data to an external server with more memory, getting a better computer, changing anything else? Any ideas?
Many thanks,
  댓글 수: 3
Alexandra
Alexandra 2016년 7월 7일
I Swarooph, I am not using Simulink. I saw a toolbox: Parallel computing. I don't really understand how this works. Would the code be broken in pieces so each worker computed a block? Because the code has a sequence and it would be difficult to compute without the order. A cloud wouldn't mean the internet?
José-Luis
José-Luis 2016년 7월 7일
As John, said, this is a question that cannot be intelligently answered without looking at your code. If the execution really needs to be sequential, then the gains from straight on application of the parallel computing toolbox might probably be minimal.

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2016년 7월 6일
We cannot possibly answer this intelligently. Yes, finding a faster, newer computer, with more memory, more RAM, etc, will help. A better drive, using a SSD will often improve things. Depending on how old the system is that you have, you MIGHT get a speedup of 2-4 times at most.
But the problem is, we do not know where/what is the bottleneck. So we cannot know what is your problem. Only you can learn that.
The point is, a HUGE amount of time can often be gained by something far easier to fix. Learn to speed your code up. Learn to use the profile tool. Crappy code is by far the most likely source of wasted CPU cycles. And if you don't know enough about MATLAB to know how to speed your code up, then very often you might be able to gain orders of magnitude in speed, just by writing better code. I have seen people do obscene things with code, not knowing any better. And many of them want to know if THEY should get a faster computer too. The point is, blaming slow code on a computer is easy when the person who wrote the code was the real culprit. (Sorry, but often true.)
So spend some time with the profile tool. Find the bottlenecks in your code. See how to speed them up. Well written code can almost always do far more for you than a faster computer.
  댓글 수: 1
Alexandra
Alexandra 2016년 7월 8일
Hi John, The crappiest part of my code is a loop that uses a function. Since I couldn't build a function depending on (k,j), I am writting a different loop for each j. Around 20 loops. Do you think you could help me reducing the 20 loops into just one? Thanks,

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Test Model Components에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by