Parallel Processing An Array/Array Appending
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm attempting to store data in internal memory (an array) until I'm ready to export the data to an excel document. However, my current implementation slows down my program after a while as I'm consistently 'growing' the array by adding another array to the end of it.
This is my current implementation:
memoryArray = [memoryArray, arrayToAdd] (x6)
I'm wondering if it would be easy to implement parallel programming to do something like this:
%Psuedo Code
serial code...
serial code tell parallel process workers to start the following:
memoryArray1 = [memoryArray1, arrayToAdd1] %memoryArray is a global variable
memoryArray2 = [memoryArray2, arrayToAdd2]
memoryArray3 = [memoryArray3, arrayToAdd3]
memoryArray4 = [memoryArray4, arrayToAdd4]
memoryArray5 = [memoryArray5, arrayToAdd5]
memoryArray6 = [memoryArray6, arrayToAdd6]
serial code continues without waiting for results..
Is this possible to do? Perhaps my array manipulations are highly inefficient? I'm wondering if it might be as simple as using an spmd block... I apologize for the poorly written question. Thanks :)
0 comentarios
Respuestas (1)
James Tursa
el 29 de Jul. de 2016
Editada: James Tursa
el 29 de Jul. de 2016
Can you save up all of the arrayToAdd stuff in a cell array and then cat all the results at once at the end to minimize the data copying? E.g., something like this:
arrayToAdd{1} = stuff;
arrayToAdd{2} = stuff;
arrayToAdd{3} = stuff;
arrayToAdd{4} = stuff;
arrayToAdd{5} = stuff;
arrayToAdd{6} = stuff;
:
memoryArray = [memoryArray, arrayToAdd{:}];
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Parallel Server 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!