MATLAB Answers

mtimesx issue , Execution time

1 view (last 30 days)
Jayant chouragade
Jayant chouragade on 28 Sep 2020
Edited: James Tursa on 29 Sep 2020
Hi,
I am trying run below code with mtimesx as below
tic
mtimesx('SPEEDOMP','OMP_SET_NUM_THREADS(4)');
C=mtimesx(A,B);
mtimesx
to
c
where, A= 1x3x79x 50000 complex 4D matrix, B=3x2x79 complex matrix, C= 1x2x79x50000 4D complex matrix.
I find that mtimesx is using SPEED mode instead of SPEEDOMP mode and execution time is about 0.3-0.4 ms .
I would like to know :
  1. Why SPEEDOMP mode is not used.
  2. Can the execution time be improved by SPEEDOMP mode.
  3. Is there any other arlternative to improve the execution time.
I am using following setup
Matlab '9.6.0.1072779 (R2019a)'
Windows 7, 64 bit.
memory 8 GB,
Intel i7-4800MQ , 4Core, 8 Theread
Looking forward .

  2 Comments

Jayant chouragade
Jayant chouragade on 29 Sep 2020
OK , so I mtimesx suggest that to make SPEEDOMP mode to work , mtimesx should be compliled by OPENMP compiler. i.e MSVC or Intel Intel Parallel Studio XE . Free MinGW64 Compiler will complie mtimesx but does not support OPENMP.
I have installed MSVC 2019 . But still strugling to get it setup for matlab as matlab is not detecting the complier when using
mex -setup CPP -v ;
Below link discussed without conclusion.
But even I acheive and get OPENMP complier will I get speed improvement by using SPEEDOMP over SPEED mode ?
best.
James Tursa
James Tursa on 29 Sep 2020
MTIMESX has not been updated in many years. In particular, it has not been updated for the R2018a+ interleaved complex memory model, and it has not been updated for various compilers OpenMP flags.
Getting it to compile with the OpenMP flags is probably just a matter of writing a short script. But even if this were done, the code would not operate as intended for the R2018a+ interleaved complex memory model. Instead, it would use copy-in and copy-out methods for complex variables, which would totally defeat the purpose. Simply compiling with the -R2018a option will not work.
Given that R2020b has a new PAGEMTIMES function that duplicates the functionality of MTIMESX, I doubt I will ever spend the time to update MTIMESX just to support versions R2018a-R2020a. It would take a lot of effort to get the interleaved complex functionality working just for these versions.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!