Registered Member
|
Hello,
I tried to use Eigen3 in the following form: I have one big matrix m1, and a std::vector v, which contains some big matrices m2. now I want: #pragma omp for for (int i=0; i<v.size(); i++) v[i] *= m1 here I should win 4x times in time on a 4 CPU machine, which is not the case. Did I something wrong? So is there a possibility to switch off Eigen3's omp support? Kind Regards, Andreas |
Registered Member
|
Which compiler are you using?
Did you enable the compiler's OMP switch? How much faster is it? Just 3x faster or not faster at all? |
Registered Member
|
I'am using g++ -fopenmp ...
It's not significant faster at all. matrices m1, m2; vector<matrices> v; m1 *= m2; -> 2x times faster with omp compared without omp for (int i=0, i < v.size(); i++); v[i] *= m2; -> 2x times faster with omp compared without omp on a 4-CPU machine. but the later one should be 4x times faster, or not? I think that Eigens omp support overules somehow my own for loop, so that it would be interesting how to switch off Eigens omp support maybe with an preprocessor directive, but keeping the omp for loop. Kind Regards, Andreas |
Registered Member
|
AFAIK, matrix vector products are not paralleized in eigen, so it cannot be eigen's fault that you have such a small speedup in both scenarios.
How big are the matrices and vectors? |
Registered Member
|
No, the vector contains the matrices.
something like std::vector< Eigen::MatrixXf > v The matrices are 330x330. v has a typical size of 5000 |
Registered Member
|
So if you remove your own omp #pragma line and enable eigen's omp support, you should get full speed up. Why do you want to implement paralellization twice?
|
Registered Member
|
1.) Because Eigen does not use all availible CPUs (only 2 of 4).
2.) I have these iteration over this big vector (that contains a lot matrices), and so I hoped to get a better performance (4 of 4). |
Moderator
|
you configure Eigen's multithreading at runtime:
Eigen::internal::setNbThreads(1); or at compile time: -DEIGEN_DONT_PARALLELIZE |
Registered Member
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora