Path: news.mathworks.com!not-for-mail
From: Edric M Ellis <eellis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Confusing spmd error
Date: Wed, 09 Jan 2013 09:04:28 +0000
Organization: The Mathworks, Ltd.
Lines: 55
Message-ID: <ytw6236zq03.fsf@uk-eellis0l.dhcp.mathworks.com>
References: <kcipbr$s1v$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: uk-eellis0l.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: newscl01ah.mathworks.com 1357722268 24445 172.16.27.246 (9 Jan 2013 09:04:28 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jan 2013 09:04:28 +0000 (UTC)
X-Face: $Ahg}Iylezql"r1WV1Me5&)ng"a4v%D>==KMs-elCfj"o}$bh-VOt7lVXgLWsC?9mZ`mINT
 G6PDvca;nrgs$lfcr0l1ew'N]>nXKl}m|Zpg>,6*gLp~-N0N2*+b.iwv=u>@R$L4SEG&NYUU;lSR@u
 IHphdAy
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock: sha1:siM1Se7Caxe4NGweYgz1i1O95vI=
Xref: news.mathworks.com comp.soft-sys.matlab:786239

"Chuck37 " <chuck3737@yahooremovethis.com> writes:

> I have a function that is giving me an error when called within spmd
> but I can't repeat it outside.  e.g:
>
> x = <something>;
> spmd
> if labindex == 1
>  y = <something>
>  z = function(x,y);
> end
> end
>
> Gives me an error inside the function, but when I try to debug like this:
>
> z = function(x,y{1})
>
> It runs through just fine.  This makes debugging very difficult.
> Anyone have any idea of what would cause it not to run exactly the
> same way in each case?
>
> The error is nothing parallel related by the way, it's actually a
> singular matrix warning.

Hmm, that's very strange. Do you still get the warning if you simply do

x = <something>;
y = <something>;
z = function(x,y);

How about if you do 

matlabpool open 1
spmd
  x = <something>;
  y = <something>;
  z = function(x,y);
end

matlabpool close
spmd
  x = <something>;
  y = <something>;
  z = function(x,y);
end

One other thing that has an outside chance of making a difference is
that matlabpool workers are run in single computational thread mode,
which means some algorithms will work slightly differently. You could
try launching your desktop matlab with the "-singleCompThread" switch to
see if that makes any difference.

Cheers,

Edric.