parallel computing with scheduler Comsol-Matlab

12 次查看(过去 30 天)
[EDIT: 20110524 02:40 CDT - reformat, clarify - WDR]
I've made a function JSC.m which I am able to call like this:
JSC('TE',1001,500E-9,70E-9,30E-9)
- and it works fine, I get the output I want.
Now this is pretty time consuming which is why I want to evaluate it in parallel for different inputs using the cluster available to me. So I've made this code:
sched = findResource('scheduler','type','local');
job1 = createJob(sched);
createTask(job1, @JSC, 1, {{'TE',1001,500E-9,70E-9,30E-9} {'TE',1001,500E-9,70E-9,40E-9} {'TE',1001,500E-9,70E-9,50E-9} {'TE',1001,500E-9,70E-9,60E-9}});
submit(job1);
waitForState(job1,'finished');
results = getAllOutputArguments(job1)
But it just returns results = Empty cell array: 4-by-0 Now this job scheduling works fine for rand.m for example:
sched = findResource('scheduler','type','local');
job1 = createJob(sched);
createTask(job1, @rand, 1, {{3,3} {3,3} {3,3} {3,3}});
submit(job1);
waitForState(job1,'finished');
results = getAllOutputArguments(job1);
results{1:4}
returns 4 3-by-3 matrices.
The only difference between rand.m and my JSC.m as I see it, is that it is linked with Comsol, so there is some Comsol code inside it. But why is it able to evaluate it with a normal function call, but not when I use a cluster?
I can post the code for JSC.m if necessary.
  4 个评论
Edric Ellis
Edric Ellis 2011-5-24
Using the "local" scheduler, the workers are running the same installation of MATLAB as your desktop copy. Do have to perform any initialisation to get Comsol to work? You may need to replicate that on the workers. You could add initialisation to "jobStartup" - see http://www.mathworks.com/help/toolbox/distcomp/jobstartup.html
Erik
Erik 2011-5-24
I have a desktop shortcut called "Comsol Matlab" which launches Matlab connected via Livelink to Comsol. So maybe in "jobStartup" I can add a line that starts up the Livelink to Comsol?

请先登录,再进行评论。

回答(3 个)

Sarah Wait Zaranek
Sarah Wait Zaranek 2011-5-24
COMSOL helped me with a similar issue about a year ago. Their answer is below. I would encourage you to contact them. They were very helpful.
"There is a command available for the livelink for MATLAB that allow the user to connect MATLAB with a COSMOL server. The command name is MPHSTART and it is available with the hotfix patch available for version 4.0a : http://www.comsol.com/support/updates/comsol40ap/
Note that if the user is using MATLAB in Distributed Computing Server and call COMSOL function on different node of the server, a COMSOL server will need to be started on each node."
  2 个评论
Erik
Erik 2011-5-24
Thank you for your answer, I forgot to mention, I'm using Comsol 3.5a so mphstart doesn't work. I don't know if there's a similar command that works in 3.5a.
Sarah Wait Zaranek
Sarah Wait Zaranek 2011-5-25
I don't know, unfortunately. support@comsol.com might be able to help.

请先登录,再进行评论。


Peng Jia
Peng Jia 2011-9-1
Hi Erik,
I'm pulling my hair off my head now because of the same issue as yours. Have you solved this headache? I'm using 3.5a too and can not do dist. cmp. with Matlab. If you have already solved this problem please let me know. And could you share your JSC.m? I'm a stanger to COMSOL, so I'd like to learn from you guys. Thanks.
Best.
Peng
  1 个评论
Erik
Erik 2011-9-1
I didn't find a solution. I ended up just splitting up my simulation in small bits and starting a job for each of them.
Apparently, when the cluster spawns new workers for a parallel problem, they are not linked with Comsol so Comsol commands won't work.
It might just be a problem with the cluster at my university.

请先登录,再进行评论。


Erik
Erik 2011-9-1
I didn't find a solution. I ended up just splitting up my simulation in small bits and starting a job for each of them. Apparently, when the cluster spawns new workers for a parallel problem, they are not linked with Comsol so Comsol commands won't work. It might just be a problem with the cluster at my university.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by