Skip to main content
added 1 characters in body
Source Link
Mr.Wizard
  • 275.2k
  • 34
  • 606
  • 1.5k

I usually work around this by first generating all argument combinations, then using ParallelMap:

ParallelMap[f, Tuples[{Range[0,59], Range[1,10]}]] 

You'll need to define your function so that it takes the form f[{x,y}], not f[x,y].

Often it is more practical to use the form

ParallelTable[{arg, f[arg]}, {arg, Tuples[{Range[0,59], Range[1,10]}]}]

ParallelTable[{arg, f[arg]}, {arg, Tuples[{Range[0,59], Range[1,10]}]}] 

as this will save both the result and the arguments in the output.

Note that this method gives you a flat 1D list, not a 2D one like a Table with two iterators would. If you do need a 2D table, use Partition or ArrayReshape (v9) on the result.

I usually work around this by first generating all argument combinations, then using ParallelMap:

ParallelMap[f, Tuples[{Range[0,59], Range[1,10]}]] 

You'll need to define your function so that it takes the form f[{x,y}], not f[x,y].

Often it is more practical to use the form

ParallelTable[{arg, f[arg]}, {arg, Tuples[{Range[0,59], Range[1,10]}]}]

as this will save both the result and the arguments in the output.

Note that this method gives you a flat 1D list, not a 2D one like a Table with two iterators would. If you do need a 2D table, use Partition or ArrayReshape (v9) on the result.

I usually work around this by first generating all argument combinations, then using ParallelMap:

ParallelMap[f, Tuples[{Range[0,59], Range[1,10]}]] 

You'll need to define your function so that it takes the form f[{x,y}], not f[x,y].

Often it is more practical to use the form

ParallelTable[{arg, f[arg]}, {arg, Tuples[{Range[0,59], Range[1,10]}]}] 

as this will save both the result and the arguments in the output.

Note that this method gives you a flat 1D list, not a 2D one like a Table with two iterators would. If you do need a 2D table, use Partition or ArrayReshape (v9) on the result.

Source Link
Szabolcs
  • 238.9k
  • 32
  • 653
  • 1.3k

I usually work around this by first generating all argument combinations, then using ParallelMap:

ParallelMap[f, Tuples[{Range[0,59], Range[1,10]}]] 

You'll need to define your function so that it takes the form f[{x,y}], not f[x,y].

Often it is more practical to use the form

ParallelTable[{arg, f[arg]}, {arg, Tuples[{Range[0,59], Range[1,10]}]}]

as this will save both the result and the arguments in the output.

Note that this method gives you a flat 1D list, not a 2D one like a Table with two iterators would. If you do need a 2D table, use Partition or ArrayReshape (v9) on the result.