global optimization in parallel in combination with external pde solver

조회 수: 6 (최근 30일)
SA-W
SA-W 2023년 11월 18일
편집: Jasvin 2024년 1월 22일
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
SA-W
SA-W 2023년 11월 20일
Just out of curiosity: Don't you have a valid licence or what's the reason ?
I have one. But, to be honest, I found it more realistic to get an answer here than from the technical support.
Torsten
Torsten 2023년 11월 20일
I don't think so - at least not for such a technical question. But you are of course free to do what you like.

댓글을 달려면 로그인하십시오.

채택된 답변

Jasvin
Jasvin 2024년 1월 22일
편집: Jasvin 2024년 1월 22일
So as per the current discussion, it looks like your key requirement is to figure out how Parallel solving works with "MultiStart" and I believe the below documentation page describes exactly that:
Also to add to the point about "getCurrentTask", you can through all the properties available to you on this page: https://www.mathworks.com/help/parallel-computing/parallel.task.html
Among these properties, the "Worker" property seemed to be of most relevance, the "ID" property is associated with each task and "Worker" property would fetch you the worker that's running this task.
These are the properties you can fetch from a "Worker" object:
You can use this data (worker name and task ID) and pass it to your objective function to generate a unique directory that data should be read from/written to.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by