이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
suddenly MATLAB process is too slow
조회 수: 3 (최근 30일)
이전 댓글 표시
Rahim Rahim
2021년 2월 6일
I am using windows 10 and Matlab 2018b. I have a code was run fast, but suddenly it become so slow. The pseudo code of my code is as follows:
for i=1 : 200
for j=1 : 200
for k=1 : 200
NewMatrix = Archive(i,j)*Archive(k,j) + Archive(j,k)
end
end
end
where the Archive is a matrix of [200,6]
I don't know where is the problem. I am using CPU. could you help me please ?
댓글 수: 19
Adam Danz
2021년 2월 6일
> suddenly it become so slow
Does that mean it became slow durring evaluation of the loops or one day you ran this in Matlab and the whole process was slower that previously, using the same inputs?
Rahim Rahim
2021년 2월 6일
I used the same code, the same input, the same output but the runing is become slow
Adam Danz
2021년 2월 6일
That's helpful to know but I still have the same quesiton.
The running became slow during the evaluation (i.e, after the first 1000 iterations) or the entire process from iteration #1 became slower compared to previous days?
Rahim Rahim
2021년 2월 6일
Yes, the running became slow during the evaluation. In the past, it take 1 minutes to run but he become take 30 minutes !!!
Adam Danz
2021년 2월 6일
편집: Adam Danz
2021년 2월 6일
I was just having the same conversaion a couple of days ago with another user and volunteer in the thread below. There are 3 relevant points to check out in that thread:
- How to hone in on the problem using tic/toc timing or profiling.
- The possibilty that the size of your variables are changing and requiring more resources as interations increase.
- File compression, if you're saving any of the data.
Rahim Rahim
2021년 2월 6일
@Adam Danz thank you for your email,
I used tic/toc and the time of each iteration have different time, for example iteration 10: Elapsed time is 5.993782 seconds and iteration 20 : 2.00082 seconds .
I don't understand what's the problem right now, please help me
Adam Danz
2021년 2월 6일
I haven't emailed you; maybe you meant my comment.
Does the timing jump around between 2-6 seconds or is there a pattern in certain sections of the loops?
Did you preallocate the NewMatrix array? That's very important.
Rahim Rahim
2021년 2월 6일
편집: Rahim Rahim
2021년 2월 6일
I did not change anything, 3 days ago the timing was 1 second. Now, between 2 and 6, yes it jumps
Adam Danz
2021년 2월 6일
I didn't understand that last question. But you haven't answered this one:
Did you preallocate the NewMatrix array? That's very important.
If you haven't preallocated, it will drastically slow down your code.
Rahim Rahim
2021년 2월 7일
@Adam Danz I used my code in another laptop, it run without delay ( run fast ). so the problem in my laptop, I don't exactly know what is the problem !!
Adam Danz
2021년 2월 7일
> I used preallocate but without any differences.
I highly doubt there was no difference between with/without preallocation if you're storing something within the nested loops. If you're not storing anything, then that's more believable.
> I used my code in another laptop, it run without delay
> Yes, the running became slow during the evaluation.
It sounds like the slow-down is caused both by the machine you're using and the sequence of iterations within the nested loops. The link I provided may help to explain why the process is slowing down during the loops. If there's a difference between machines and you're using the exact same version of code, version of Matlab, and inputs. then obviously the machine is causing the difference. There could be a difference in processors, RAM, etc.
Adam Danz
2021년 2월 7일
Here's my recommendation.
Run matlab's profiler on your code on both computers using the exact same version of the code, the exact same inputs and the the exact same release of Matlab. Then compare the reports.
Rahim Rahim
2021년 2월 8일
@Adam Danz I am so sorry, I putted a lot of questions, and I am begginer on matlab.
This is the results of profile('status')
ProfilerStatus: 'off'
DetailLevel: 'mmex'
Timer: 'performance'
HistoryTracking: 'timestamp'
HistorySize: 1000000
and this the results of profile('info')
FunctionTable: [0×1 struct]
FunctionHistory: [4×0 double]
ClockPrecision: 1.000000000000000e-07
ClockSpeed: 2.592000000000000e+09
Name: 'MATLAB'
Overhead: 0
David Goodmanson
2021년 2월 8일
Hi Rahim,
One thing worth checking is, with windows 10 bring up the task mananger, click the Perfomance tab, start the program and see what the memory, disk and possibly cpu activity looks like as a function of time.
Adam Danz
2021년 2월 8일
Please spend some time reading the documentation for that function.
You need to follow the second example, "Profile Function and Save Results as HTML".
Then you need to view the reports and compare them.
And don't forget to take time to formally accept answers that were helpful to you so you can give credit to the volunteers who gave their time to you. This isn't an answer, it's just a comment, but you can go into your profile and see many questions that have been answered and none accepted.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)