Huge time difference if function is called from within another function
조회 수: 2 (최근 30일)
이전 댓글 표시
Function A, when called directly, runs in 10 minutes. However, if function A is called by function B, and I run function B, the time spent of running function A is 100 minutes or so. Is this is a feature of Matlab?
Also, if I run two instances of Matlab, and run the same function on both these instances, can it happen that the first instance takes less time compared to the other?
댓글 수: 2
James Tursa
2015년 8월 5일
You need to give more information about what functions you are calling and how you are calling them. There is no generic 10x time penalty for calling a function from within another function.
답변 (1개)
Walter Roberson
2015년 8월 5일
What you describe could happen if function B restricts the number of threads to execute on, or opens a parpool that is smaller than the number of cores, and A is working with large matrices using data patterns that can normally be divided up into multiple cores automatically by BLAS or MLK or the like.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!