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: [mg107502] Re: Shadow error when trying to use ParallelTable
  • From: Emily Reiss <shirahsong at gmail.com>
  • Date: Mon, 15 Feb 2010 05:46:05 -0500 (EST)
  • References: <hl8l2g$pe8$1@smc.vnet.net>

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 Everyone,
>
>    I am trying to accelerate some code using ParallelTable, but when 
I do , I get the following error message:
>
> list::shdw: Symbol list appears in multiple contexts {Parallel`Preferences`,Global`}; definitions in context Parallel`Preferences` may shadow or be 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 that the code does work without error, if I comment out the DistributeDefinitions 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 success.  I have also tried localizing all variables inside the module, and I still get the shadow error regardless.
>
> Do you see anything obviously wrong?
>
> What strategies do you use to figure out shadow problems in your own code?  The reason I ask, is because I have tried to further isolate this problem 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: When can Mathematica have a decent Find dialogue?
  • Next by Date: Re: Re: Normality test
  • Previous by thread: Shadow error when trying to use ParallelTable
  • Next by thread: Re: Shadow error when trying to use ParallelTable