Struggling to distribute a cell array across several parallel workers

1 visualización (últimos 30 días)
I have some code, part of which a structure of the form below.
for a = 1:A
for b = 1:B
for c = 1:C
for d = 1:D
for j = 1:2
cellArray = manipulate(cellArray,a,b,c,d,j,params);
end
end
end
end
end
A,B,C and D are constant.
cellArray is a large cell array, each entry of which is a large, multidimensional matrix.
The function 'manipulate' needs to know the loop parameters, a, b, c, d and j, as well as some other fixed parameters, 'params', and modifies only cellArray, simply by adding numbers to elements of its constituent matrices. The loop parameters, a, b, c, d and j specify which subset of the data is used and which subset is to have numbers added to it, with j having a slightly different status to a, b, c and d in that it partitions the cells into two distinct subsets, one of which is read and the other modified for j=1 and vice versa for j=2.
I've squeezed every last bit of performance that I can out of my code, and now I want to parallelize it. My question is, how can I distribute access to cellArray and the other parameters across parallel workers and run 'manipulate' in parallel? I have a mental picture of cellArray as a large pool of data, with the parallel workers as little robots buzzing around the pool, reading what they need and then going in and adding something to the appropriate bit of the pool. I feel like this ought to be possible...or am I just crazy??
  7 comentarios
John Billingham
John Billingham el 4 de Sept. de 2014
I'm starting to realize that my code, and I think the problem I'm solving, indeed doesn't have an obvious parallel structure. I have considered using linear indexing, and if you think that this will make my code faster I should give it a try.
I've written a MATLAB code to solve two player, postflop, holdem poker. The indices a,b,c, and d are the flop holdings and turn and river cards. The index j is over the two players. The function 'manipulate' does counterfactual regret minimisation on the players' strategies. It really does flicker about across the data structure in a way that isn't obviously parallelizable......although the literature suggests that it is. Looks like I have some more reading to do. Thanks for your help everyone.
John Billingham
John Billingham el 10 de Sept. de 2014
Final update: I've modified the algorithm that I'm using, and now have no problem parallelising it. Thanks again.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Card games en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by