global optimization in parallel in combination with external pde solver
Mostrar comentarios más antiguos
I use MultiStart from the global optimization toolbox to run lsqnonlin solver for a bunch of start
vectors. I want to run the local run indices in parallel since one forward solve is quite expensive.
function [fval, Jacob] = myObj(x)
% write params to file
...
% invoke pde solver with system call
system(path_to_pde_solver);
% read fval and Jacob from files
...
end
As you can see, the objective function writes the current point in parameter space to a file,
invokes the pde solver (Abaqus,...) which reads the parameter file and writes fval and Jacob in a
file. Finally, the objective function reads fval and Jacob from files which were generated by the
pde solver.
This, of course, does not work if multiple run indices operate on the same files since things get
mixed up.
However, it is safe if there are as many file exchange directories as there are run indices running
in parallel. For instance, say I call MultiStart in parallel with six cores on my local machine. Then,
six directories are created and the indices running successively on core 1 ,write their data always in directory 1,
and the indices running on core 2 write their data always in directory_2,...
I have full control on the pde solver, so I can pass whatever arguments to the pde solver in the
system call.
Does that sound reasonable and can this be realized with MultiStart and parallel computing toolbox?
Any starting points or alternatives are greatly appreciated!
Best regards
13 comentarios
Torsten
el 18 de Nov. de 2023
People who work with numerics always say: The proof of the pudding is in the eating.
SA-W
el 18 de Nov. de 2023
I have no experience with parallel computations, but wouldn't it be possible in this case to program "Multistart" on your own by calling "lsqnonlin" in a loop for different initial guesses for the parameters, run this loop in parallel and use the loop index "i" as the worker id (which could then be passed to your objective function) ? I'm not sure, though, whether calls in the loop that depend on the loop index are possible in a parallelized loop.
SA-W
el 18 de Nov. de 2023
Isn't this a question you should ask Mathworks Technical Support ?
And if you do so, please report back - it's an interesting question.
Say I have 1000 start points, this would mean I create a pool with 1000 workers.
I don't think that a loop over 1000 start points will be immediately distributed in completeness on 1000 workers. This would be very restrictive to parallelize loops in general.
SA-W
el 18 de Nov. de 2023
I think to answer this question reliably, one needs to have deeper knowledge about the MATLAB internals. Technical Support should be the right place to ask in my opinion.
But noone hinders you just to test the idea: make a loop over 1000 initial values, supply the loop index to the objective function and try to parallelize this loop. The computer won't take damage ...
SA-W
el 19 de Nov. de 2023
Torsten
el 19 de Nov. de 2023
Did you get an answer from MathWorks ? Or did you prefer not to submit a service request ?
Torsten
el 20 de Nov. de 2023
I did not ask the technical support
Just out of curiosity: Don't you have a valid licence or what's the reason ?
SA-W
el 20 de Nov. de 2023
Torsten
el 20 de Nov. de 2023
I don't think so - at least not for such a technical question. But you are of course free to do what you like.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Eigenvalue Problems en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!