Parallel Processing An Array/Array Appending
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
James Tursa
le 29 Juil 2016
Modifié(e) : James Tursa
le 29 Juil 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 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Parallel Server dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!