Parallel computing seems to do nothing in fmincon and patternsearch

3 views (last 30 days)
I am using both fmincon and patternsearch algorithms. Note that, with regard to fmincon, I have no analytical gradient (therefore, I should use
parallelisation in this case). However, I do not understand why parallelization does not take place. How can I say this? There are 2 evidences: First, I see no reduction in computing time and second I hear no LOUDER voice in my pc (always when I use parfor I hear a lot of noise). I attach here the part of my code which is about applying parallelisation :
Also, I see something wierd. It apears to me that matlab completely ignores UseParallel,'true'. And when I try something wrong like UseParallel,'hahahahaha' it does not throw any error message :-) (so, it seems it is not active at all).
Any idea?
Thanks in advance,

Answers (1)

Walter Roberson
Walter Roberson on 25 Aug 2022
You have posted
but you would need
Note that parallel computing is only used in gradient estimation. If you have a low number of variables, that might not make much difference to your execution time.
Raymond Norris
Raymond Norris on 25 Aug 2022
I'm surprised to hear MATLAB doesn't throw an error. I tried two of your examples and they both threw errors
>> options=optimoptions('fmincon',UseParallel,'on','OutputFcn',@(x,A,state)myoutput_Spline(x,A,state,dt,M),'StepTolerance',10^(-12),'FunctionTolerance',10^(-12),'MaxFunEvals',10^8,'MaxIter',10^8);
Unrecognized function or variable 'UseParallel'.
>> options=optimoptions('fmincon',{'UseParallel','on'},'OutputFcn',@(x,A,state)myoutput_Spline(x,A,state,dt,M),'StepTolerance',10^(-12),'FunctionTolerance',10^(-12),'MaxFunEvals',10^8,'MaxIter',10^8);
Error using optimoptions (line 108)
Invalid option name specified. Provide a character vector or scalar string (such as 'Display').
A list of options can be found on the FMINCON documentation page.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!