parallel computing with scheduler Comsol-Matlab
14 views (last 30 days)
Show older comments
[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 Comments
Edric Ellis
on 24 May 2011
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
Answers (3)
Sarah Wait Zaranek
on 24 May 2011
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 Comments
Sarah Wait Zaranek
on 25 May 2011
I don't know, unfortunately. support@comsol.com might be able to help.
Peng Jia
on 1 Sep 2011
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
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!