Speed performance of MEX file using Matlab Coder for parfor operation on arrays

1 view (last 30 days)
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

Answers (0)

Categories

Find more on MATLAB Algorithm Acceleration in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!