For some reason, I'd like to use ParallelTable
with a variable number of iterators.
Table[a[1], {a[1], 0, 10}]
works fine:
Output:
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
ParallelTable[a[1], {a[1], 0, 10}]
returns an error:
Output: ParallelTable::nopar1: ParallelTable[ci[1],{ci[1],0,10}] cannot be parallelized; proceeding with sequential evaluation. >>
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
I am also interested in workarounds to use ParallelTable
and a variable number of indices (typically: ParallelTable[f[Table[a[i],{i,1,n}]],Table[a[j],{j,1,n}]]
where f
is a function of a list with variable size).
ParallelTable[a[1], {a[1], 0, 10}]
not working with variable likea[1]
, sinceParallelTable[f[i], {i, 0, 10}]
does work. `ParallelTable[f[Table[a[i],{i,1,n}]],Table[a[j],{j,1,n}]] does not make sense. $\endgroup$Table
but not withParallelTable
.With[{iter = Sequence @@ Table[{a[j],-1, n}, {j, 1, n}]}, Table[f[Table[a[i], {i, 1, n}]], iter]]
if you prefer... $\endgroup$Table
version of what you what? $\endgroup$With[{iter = Sequence @@ Table[{gag[j], -1, 1}, {j, 1, 3}]}, Table[f[Table[gag[i], {i, 1, 3}]], iter]]!
. How can I make it work withParallelTable
instead ofTable
? $\endgroup$ParallelTable[a[1], {a[1], 0, 10}]
not work? $\endgroup$