필터 지우기
필터 지우기

matlabpool open local (inside a loop)

조회 수: 2 (최근 30일)
Reynaldo
Reynaldo 2011년 9월 26일
Hey! I am making this script where I need to have matlabpool open local inside a loop because I would be executing the same code on different amounts of workers. The problem is that when I start my loop at i=1, and then put matlabpool open local i, matlab does not want to take i as the number of workers I want, I only can take a number instead of a variable. Is there any way of having matlabpool open local inside a loop and changing the amount of workers each time? Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2011년 9월 26일
matlabpool('open','local',i)
but are you sure that you want to allocate 1 worker to the first iteration, 2 workers to the second iteration, and so on ?
  댓글 수: 4
Reynaldo
Reynaldo 2011년 9월 26일
Oh I see, is there any way of making matlab do the JIT parsing and optimization over again each time a function is executed?
Walter Roberson
Walter Roberson 2011년 9월 26일
feature('jit','off'); feature('accel','off')
should do that. However, that isn't usually the best way to proceed as it will give distorted views of what MATLAB is able to do.
What you should do instead is run the code first, with any convenient number of workers (e.g., 1), and throw away that timing result, and then go through your loop.
You may also wish to use the user contribution "timeit", http://www.mathworks.com/matlabcentral/fileexchange/18798

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by