Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Problems implementing batch/parfor/matlabpool

Subject: Problems implementing batch/parfor/matlabpool

From: PLH

Date: 18 Nov, 2010 13:39:04

Message: 1 of 2

Hello,

I have a script my_func.m (see PS below for more details) that contains a parfor loop, and I'm trying to run it with batch. The script does not contain any parallel processing-related code except parfor, and,

> job1 = batch('my_func');

works as expected (because parfor just becomes the usual for, right?). However, when I try

> job1=batch(my_func',matlabpool,6); % max number of labs is 8

I obtain the following error:

Error in ==> matlabpool at 92
iVerifyJava();

??? Output argument "varargout" (and maybe others) not assigned during call to "C:\Program
Files\MATLAB\R2010a\toolbox\distcomp\matlabpool.m>matlabpool".

If I add the line "matlabpool open 6" before "parfor" and "matlabpool close" after "end" in my script, and run it from the editor window (i.e. not using batch) then it works.

Has anyone got any idea how I get this to work using batch please? Failing that, if someone could explain what the error means, then I'd be grateful. I've no doubt foolishly forgotten to supply some vital piece of the puzzle, so please ask if you need more info!!

Thanks,

PLH.

P.S.
The script my_func.m resembles:

a = 11; b =0.25; % + more scalar declarations up to f
N = 100;
vec = linspace(1,5,N);
mat = zeros(a,N);

parfor k=1:N
    mat(:,k) = my_func2(a,b,c,d,e,f,vec(k)); % output is a (aX1) vector.
end

Subject: Problems implementing batch/parfor/matlabpool

From: Edric M Ellis

Date: 19 Nov, 2010 15:41:57

Message: 2 of 2

"PLH " <paulhalkyard@googlemail.com> writes:

>> job1=batch(my_func',matlabpool,6); % max number of labs is 8

That should be:

job1=batch('my_func', 'matlabpool', 6);

I.e. the string 'matlabpool' is a parameter to the 'batch' command.

Cheers,

Edric.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us