Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6464 > unrolled thread

easy way to switch between Table and ParallelTable

Started byValeX <rjovale@gmail.com>
First post2011-11-16 09:45 +0000
Last post2011-11-17 11:04 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  easy way to switch between Table and ParallelTable ValeX <rjovale@gmail.com> - 2011-11-16 09:45 +0000
    Re: easy way to switch between Table and ParallelTable "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-17 11:04 +0000

#6464 — easy way to switch between Table and ParallelTable

FromValeX <rjovale@gmail.com>
Date2011-11-16 09:45 +0000
Subjecteasy way to switch between Table and ParallelTable
Message-ID<ja00o2$60r$1@smc.vnet.net>
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.

[toc] | [next] | [standalone]


#6485

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-11-17 11:04 +0000
Message-ID<ja2pnv$m84$1@smc.vnet.net>
In reply to#6464
On Wed, 16 Nov 2011 09:45:38 -0000, ValeX <rjovale@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]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web