Skip to main content

Hello,



I'm using the ZOS-API-MATLAB to run many local optimizations within a for loop (where the merit function is of a Physical Optics Propagation result). Since this process is slow, I'm wondering if I would be able to run multiple for loops at once using the parallel pool matlab toolbox and take advantage of my multi-core computer... Would this work or am I missing other bottlenecks in the process that would not allow me to use API in this way?



Thanks! 

Hi Adrian,



This is just my thoughts, but assuming you have a standard number of core, say below 32. You'd have to allcoate those cores to either the optimizer or the FOR loops, and I'm not sure you'd gain significant speed by doing so.



For example, with 32 cores, you can run a single FOR loop with the optimizer at 32 cores (fast optimization, slow loop). If you want to take advantage of MATLAB parallel processing, you could save 4 cores to run a PARFOR loop, but the optimizer can only be allowed 8 (32 divided by 4), which will give you slower optimization, and faster loop.



That being said, I think you should be able to do it. Just make sure you allocate the cores accordingly.



Let me know if this makes sense.



Take care,



David


Reply