Speed performance of MEX file using Matlab Coder for parfor operation on arrays
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am reaching the limits of optimizing running time (also RAM) of my Matlab script. I did use several techniques for optimizing the code, including parfor, vectorization, use sped-up functions, such as FilterM (https://www.mathworks.com/matlabcentral/fileexchange/32261-filterm), preallocate arrays, reuse temporary variable name. The next step I plan to do is converting to MEX function. My Matlab pseudo-code is pretty much doing as below. Do you think I am going to gain benefit of converting to MEX function? Are there any other recommendations for speeding up for my case?
As a side question, should we keep our array operations to the dimensions of 1D and 2D if possible or 3D and 4D result in similar performance (speed, RAM) and how much benefit between two cases? Let say a 4D array of size 10*10*10*10 vs. a 2D array of 100*100 or 1000*10?
Thanks,
parfor index1 = 1:no_loop1
for index2=1:no_loop2
%call functions such as FilterM
%call array operations such as multiplication, division,
% squeeze, sum, cumsum, repmat, cat on 2D, 3D, and 4D arrays
end
end
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!