Hello:
Is it possible to determine the cpu capacity of each parfor worker?
The reason of my question is the following:
I have a code with 100 iterations. In each iteration a lot of simulations must be performed, for which I am using a parfor loop in order to distribut the simulations among the parfor workers, so that I can reduce the total iteration time. My problem is that as iterations passes, the number of simulations that must be performed on each iteration decreases and maybe some workers does not have to perform a simulation in that iteration. Therefore, I would like to transfer the cpu capacity of the workers that are sleeping to those who are not.
The summary of my code is bellow. My problem is that while in the first iterations the "total_simulations_to_perfor_in_the_iteration" are higher than the number of workers, in the previous iterions this number reduces and some workers are not used.
for iteration_index=1:100 total_simulations_to_perfor_in_the_iteration=compute_no_of_simulations_required (input_data); parfor simulation_index=1:total_simulations_to_perfor_in_the_iteration %code for running the simulations
end end
Thanks in advance,
David
Best Answer