Reputation: 157
I run on my computer very often Matlab programs compiled using mcc, in which I execute parfor. Each program has slow startup time, I think because the parallel worker pool is created (it takes about 20 seconds just to startup the parallel pool). It would be more efficient for me if the pool could remain open all the time in the background. For example when opening a parpool in the matlab interface, it says that the parpool will remain open for 30 minutes and so there is no need to open a parpool for each matlab script. Is something like that possible also when the code is compiled, or are there other solutions?
Upvotes: 0
Views: 279
Reputation: 110
You could increase the time for which the pool is opened. During testing, you can type
>> preferences
and choosing Parallel Computing Toolbox settings on left menu .
You can achieve the same result adding to the code
p = parpool
p.IdleTimeout = 120 %minutes
If you have the pool opened for a longer time you should be able to run multiple scripts without the need for opening and closing it multiple times.
I would avoid leaving it opened permanently.
Upvotes: 0