Registered Member
|
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. |
Registered Member
|
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?
|
Moderator
|
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. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]