Which Parallel Computing method to use for my software
2 次查看(过去 30 天)
显示 更早的评论
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...
0 个评论
采纳的回答
Benjamin Thompson
2022-3-9
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 个评论
Benjamin Thompson
2022-3-9
Go ahead and try it. If you have specific problems coding it up please post the code with specific questions.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!