Filter löschen
Filter löschen

Which Parallel Computing method to use for my software

1 Ansicht (letzte 30 Tage)
hellow,
I wrote software in a serial way that performs the same sequence of actions a very large number of times until a solution is found.
Now I am interested in entering for the first time into the field of Parallel Computing to improve the runtime of the code, I read the tutorials in the documentation and could not figure out which method is best for me.
My algorithm works as follows: (RRT* algorithm )
In general, the method takes a random line from a matrix containing all of the data, executes operations on it, and generates a number of other lines from it.
Then, for each new row, a check is conducted to see if a similar row already exists in the matrix; if so, the row in the matrix is updated; if not, a new row is added to the matrix.
Following this sequence of procedures, a fresh random row from the matrix is chosen and the operations are carried out on it.
This is my algorithm's pseudo code:
% Data = matrix of data.
while(1)
row = Data(randi(n),:);
NewRows = MyFunction(row);
for NewRow in NewRows
if NewRow exists in Data
update spacific row in Data;
else
add NewRow to data;
end
end
end
I considered assigning a row from the matrix to each worker with the MyFnction(), the new rows that worker generates are passed to a client, who feeds them into the matrix as described.
Because break is used within MyFunction, I realized that spmd is not appropriate.
How should I go about doing what I've described? Or are there better ways to decrease running time?
I have Parallal computing toolbox...

Akzeptierte Antwort

Benjamin Thompson
Benjamin Thompson am 9 Mär. 2022
The random feature and the writing back into a common data matrix are the biggest problems here. If there are enough columns in the matrix you might be able to break it up into submatrices one time, then in your loop choose the random number and pass that to the parallel workers working on each submatrix in parfor, or GPU. But due to the overhead in starting a parallel worker pool or a GPU operation, you would need to have some wide matrices--i.e. lots of columns-- in order for the overhead to get offset by performance gains.
  3 Kommentare
Benjamin Thompson
Benjamin Thompson am 9 Mär. 2022
Go ahead and try it. If you have specific problems coding it up please post the code with specific questions.
shlomo odem
shlomo odem am 9 Mär. 2022
thank you, i will...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Parallel Computing Fundamentals finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by