This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Performance compared to Matlab

Tags: None
(comma "," separated)
Wande
Registered Member
Posts
1
Karma
0

Performance compared to Matlab

Fri Aug 07, 2015 12:53 am
I have used Eigen for some time and I like it. Today I compared the performance to Matlab for a matrix matrix multiplication, and was very disappointed. I have a (float) matrix of size 2250 x 42 000 and would like to calculate matrix * matrix.transpose(), to get the covariance matrix of size 2250 x 2250. In Matlab this takes about 2 seconds, but with Eigen it takes about a minute (several cores are being used). Is this normal?

I use CentOS 6.6 and an Intel 5820K CPU with 6 cores. I have 32 GB of DDR4 memory. My program was compiled with OpenMP flag.
jaschau_
Registered Member
Posts
2
Karma
0

Re: Performance compared to Matlab

Fri Aug 07, 2015 10:53 pm
Have you compiled with the NDEBUG flag? If not, doing so should strongly increase the performance. The degree of compiler optimization can also play an important role. Which compiler do you use? And does the performance depend on whether you work with float or double?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Performance compared to Matlab

Sun Aug 09, 2015 8:24 pm
Make sure you compiled with optimizations (at least -O2 and -DNDEBUG). Also, make sure to run with OMP_NUM_THREADS=6 if 6 is the number of *physical* cores. By default openmp uses as many threads as hyperthreaded virtual cores, which kills the performance of highly optimized code.

For instance, here it takes 4.7s on a single core (no openmp) using -mavx -mfma and the devel branch, and 1.46s when using 4 cores.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]