Azzera filtri
Azzera filtri

Parallel Processing An Array/Array Appending

4 visualizzazioni (ultimi 30 giorni)
Matthew Mellor
Matthew Mellor il 29 Lug 2016
Modificato: James Tursa il 29 Lug 2016
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 :)

Risposte (1)

James Tursa
James Tursa il 29 Lug 2016
Modificato: James Tursa il 29 Lug 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{:}];

Categorie

Scopri di più su MATLAB Parallel Server in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by