Re: Shadow error when trying to use ParallelTable
- To: mathgroup at smc.vnet.net
- Subject: [mg107501] Re: Shadow error when trying to use ParallelTable
- From: "Norbert P." <bertapozar at gmail.com>
- Date: Mon, 15 Feb 2010 05:45:54 -0500 (EST)
- References: <hl8l2g$pe8$1@smc.vnet.net>
Hey Todd, it's not really an error message, it's just a warning. And it appears only the first time you use Parallel functions. I don't think it will lead to any problems in your code. It's most likely caused by some omission in the built-in code, somebody forgot to put variable list into a Private section of the Parallel`Preferences` package. I just ignore the message. If you are really worried, don't use the variable named "list" in your code. Your message can be easily reproduced, this is what happens on a fresh kernel: In[1]:= list = 1; In[2]:= ParallelTable[1, {3}] During evaluation of In[2]:= list::shdw: Symbol list appears in multiple contexts {Parallel`Preferences`,Global`}; definitions in context Parallel`Preferences` may shadow or be shadowed by other definitions. >> Out[2]= {1, 1, 1} Actually, someone screwed up big time, these are the names in Parallel`Preferences` that will produce this shadowing warning: In[3]:= Names["Parallel`Preferences`*"] Out[3]= {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} As you can see, many of these are quite common names that people might use in their programs. Best, Norbert On Feb 14, 2: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