필터 지우기
필터 지우기

Parallel Processing An Array/Array Appending

조회 수: 4 (최근 30일)
Matthew Mellor
Matthew Mellor 2016년 7월 29일
편집: James Tursa 2016년 7월 29일
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 :)

답변 (1개)

James Tursa
James Tursa 2016년 7월 29일
편집: James Tursa 2016년 7월 29일
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{:}];

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by