Is it possible to execute 2 scripts in 2 different matlab sessions at the same time, both using parfor?

I want to launch a script in a matlab session and then, while it is running, I want to launch the same script (with one different parameter) in another matlab session, both scripts using parfor. Yes, I would like both to run parallel, so it is 2 parfor in parallel haha!
When I launch the second one, I get this warning:
Warning: Found 1 pre-existing communicating job(s) created by pool that are
running. You can use 'delete(myCluster.Jobs)' to remove all jobs created
with profile local. To create 'myCluster' use 'myCluster =
parcluster('local')'.
Is it a real problem? What happen when the first script finishes and shuts down the parallel pool it has openned? Will it also close the parallel pool of the other session? Do I save time doing this or should I run the 2 executions one after the other?

답변 (1개)

Can you provide more details about your code? How do you create the pool? How many workers are you using?
I am having trouble replicating your warning. I just ran the following code in parallel in two sessions of MATLAB with no problem.
parfor ii=1:100000000
fprintf('%d\n',ii);
end

댓글 수: 3

I won't give more details about the code, it is really complicated. The warning happens during the starting parallel pool and before it displays "connected to X workers".
I create the pool by simply using the function "parpool". I am using all the workers of my computer, so 4. Actually, once I know the code works, I would like to execute it on another computer with 12 workers.
There is no need to run any parfor to produce the warning, parpool is enough to raise it. So, if you want to replicate the warning, just run parpool on a session, and after it is connected to the workers, run parpool on the other session.
I did exactly as you suggested (ran parpool in two different sessions). Still no warning for me. Sorry. Perhaps it has to do with the version you are running? I am running R2016a.
Yes probably, R2014a for me. Thank you anyway!

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

카테고리

도움말 센터File Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

질문:

2016년 10월 5일

댓글:

2016년 10월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by