Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: easy way to switch between Table and ParallelTable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122930] Re: easy way to switch between Table and ParallelTable
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Thu, 17 Nov 2011 06:03:36 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <ja00o2$60r$1@smc.vnet.net>

On Wed, 16 Nov 2011 09:45:38 -0000, ValeX <rjovale at gmail.com> wrote:

> hi guys, is there an easy way to switch between Table and
> ParallelTable other than manually delete the letters "Parallel" from
> ParallelTable?
>
> i ask this because i have a code which is partially parallelized
> through the use of ParallelTable.
> Sometimes, however, i need to run that code within another master
> ParallelTable and it would run faster if my code runs single thread,
> that is, only using Tables.
>

Subkernels can't initiate parallel computations using ParallelTable, so I  
think the premise of your question is flawed to begin with.

However, if you are doing something unusual such that this would not be  
the case, why not replace explicit calls to both Table and ParallelTable  
with your own definition? For example,

myTable := If[System`Parallel`$SubKernel, Table, ParallelTable]



  • Prev by Date: Error in FullSimplify
  • Next by Date: Re: Solve for parameters of a truncated normal distribution
  • Previous by thread: easy way to switch between Table and ParallelTable
  • Next by thread: Need to design digital filter