f



parfor loop with nested for loop

Hi all,

I'm new to this group, but googling my problem always points here so I
thought I'd sign up.

I'm running multiple iterations of a time-evolving Monte Carlo
simulation in Matlab.  Since each iteration is initialized randomly at
the first time point, the iterations can safely be run in parallel on
a quad core PC.  I've previously been doing this by simply running 4
simultaneous Matlab sessions on one machine, but I thought I would
save my institution some licenses and automate the process at the same
time.

The problem is that my code essentially has multiple nested for loops
within the main parfor loop:

define a_constant

parfor i=1:num_iterations

for j=1:a_constant
data(j) = myfun()
end

end


Every one of these nested for loops generates an M-Lint warning that
"the input variable 'j' appears not to be initialized before the
parfor loop".  The code works as it should, but why do I receive these
messages and are they impacting the performance of Matlab?

Thanks for any light you can shed on this.
0
5/1/2009 4:04:27 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
1121 Views

Similar Articles

[PageSpeed] 4

Gabriel <gabriel.rosser@gmail.com> writes:

> The problem is that my code essentially has multiple nested for loops
> within the main parfor loop:
>
> define a_constant
>
> parfor i=1:num_iterations
>
> for j=1:a_constant
> data(j) = myfun()
> end
>
> end
>
>
> Every one of these nested for loops generates an M-Lint warning that
> "the input variable 'j' appears not to be initialized before the
> parfor loop".  The code works as it should, but why do I receive these
> messages and are they impacting the performance of Matlab?

These specific messages are caused by a bug in MLINT in R2008a - they are not
issued for R2008b and later releases. They will not affect the performance of
your code.

Cheers,

Edric.
0
eellis (488)
5/5/2009 12:58:50 PM
Reply: