MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Shadow error when trying to use ParallelTable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107539] Re: Shadow error when trying to use ParallelTable
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Tue, 16 Feb 2010 03:53:43 -0500 (EST)
  • References: <hl8l2g$pe8$1@smc.vnet.net> <hlb8l8$rev$1@smc.vnet.net>

Of course this message was from me, not  my alter-ego Emily.   I
suppose it's probably good to check who is logged in when using a
different computer in the house!

--david

On Feb 15, 5:46 am, Emily Reiss <> wrote:
> It does indeed seem that there is a variable called "list" in
> parallel`Preferences`:
>
> In[34]:= Names["Parallel`Preferences`*"]
>
> Out[34]= {"Parallel`Preferences`add", \
> "Parallel`Preferences`addPreference", "Parallel`Preferences`clear", \
> "Parallel`Preferences`debugPreference", \
> "Parallel`Preferences`debugQ", "Parallel`Preferences`exists", \
> "Parallel`Preferences`get", \
> "Parallel`Preferences`InitializePreferences", \
> "Parallel`Preferences`list", "Parallel`Preferences`load", \
> "Parallel`Preferences`Preferences", "Parallel`Preferences`prefs", \
> "Parallel`Preferences`Scope", "Parallel`Preferences`set", \
> "Parallel`Preferences`tr"}
>
> It surely seems to me that whoever did the design review at WRI of the
> code in the Parallel`Preferences` context was not paying enough
> attention to the rules.  First of all, the exposed variables should
> conform to the "CamelCase" convention.  Second, any variables that are
> not needed in an exposed context should be in the *`Private` context.
> What I suspect though is the the developer of the
> Parallel`Preferences` code did not expect that Needs would ever be
> called on the context.
>
> But, to get back to your problem, if at any point in your code you use
> a variable called list, then perhaps simple renaming of it would
> remove the shadowing messages...
>
> --David
>
> On Feb 14, 5:59 am, Todd Allen <genesplice... at yahoo.com> wrote:> Hi Every=
one,
>
> >    I am trying to accelerate some code using ParallelTable, but whe=
n
>
> I do , I get the following error message:
>
>
>
>
>
> > list::shdw: Symbol list appears in multiple contexts {Parallel`Preferen=
ces`,Global`}; definitions in context Parallel`Preferences` may shadow or b=
e shadowed by other definitions. >>
>
> > ----------------------
>
> > The basic outline of my code, which itself is INSIDE a module is:
>
> > DistributeDefinitions[degenes, subraw, addonpos];
>
> > finaldegenes =
> >   Partition[
> >    Flatten[ParallelTable[
> >      Append[degenes[[i]],
> >       Flatten[Select[subraw, #1[[1]] == degenes[[i, 1]] &]][[
> >        addonpos]]], {i, 1, Length[degenes]},
> >      Method -> "CoarsestGrained"]], (Length[degenes[[1]]] +
> >      Length[addonpos])];
>
> > -------------------
>
> > All the variables are themselves in the Global context and I can say th=
at the code does work without error, if I comment out the DistributeDefinit=
ions statement, and revert to a Table command rather than ParallelTable.
>
> > I have tried to fix this problem by referring to the variables by their=
 full context name, such as: Parallel`Preferences`degenes  without succes=
s.  I have also tried localizing all variables inside the module, and I s=
till get the shadow error regardless.
>
> > Do you see anything obviously wrong?
>
> > What strategies do you use to figure out shadow problems in your own co=
de?  The reason I ask, is because I have tried to further isolate this pr=
oblem to see if the variable contexts are changing....but it is not obvious=
 to me they are.
>
> > This is a frustrating one.  Thank you for any thoughts you might have=
!
>
> > Todd



  • Prev by Date: Re: PolarPlot in dB
  • Next by Date: Re: Shadow error when trying to use ParallelTable
  • Previous by thread: Re: Shadow error when trying to use ParallelTable
  • Next by thread: Re: Shadow error when trying to use ParallelTable