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


Groups > comp.soft-sys.math.mathematica > #6485

Re: easy way to switch between Table and ParallelTable

From "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: easy way to switch between Table and ParallelTable
Date 2011-11-17 11:04 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ja2pnv$m84$1@smc.vnet.net> (permalink)
References <ja00o2$60r$1@smc.vnet.net>

Show all headers | View raw


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]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web