Model running for days

5 ビュー (過去 30 日間)
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 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 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 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 Center および File ExchangeTest Model Components についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by