Registered Member
|
Hi, I am using Eigen for my project. I want to exploit my hardware (8 cores) so I have enabled multithreading as explained in the reference link http://eigen.tuxfamily.org/dox/TopicMultiThreading.html. So I compile with:
g++ -fopenmp -o example example.cpp and run with OMP_NUM_THREADS=8 ./example.cpp but the performance is still the same. When checking the system monitor, in run time it is only used one core as in the normal case. What is the correct form of using multithreading in Eigen?? Thanks in advance Max |
Moderator
|
As explained in the doc:
|
Registered Member
|
Thanks for the reply. But I have some doubts. When running eigen, it seems to use only one core, even when compiling with -fopenmp and running with OMP_NUM_THREADS ./example. Is it possible to make Eigen use all my cores for the computation (matrix-matrix and matrix-product multiplications). If so, could you please give me an example how to compile?
thanks in advance |
Registered Member
|
What is the code for your example.cpp? Not all operations are supported with OpenMP. Also, if your calculations are too small they might not show up on your resource manager.
|
Moderator
|
Try the following:
This should really use all your cores! |
Registered Member
|
Hey! it really worked. Thanks so much. I have a question. When using MPI for Eigen, should i compile with any options in order to have any different core as a process when running "mpirun -np "??? Please I would be grateful any advice using Eigen with mpi.
|
Registered Member
|
I can start you off with the basics of Open MPI, but I am not familiar with Eigen's specific interface.
To begin, search Google on "how to compile an MPI program" - it's well documented. Here is a trivial way to use MPI for adding vectors, just to get you started.
|
Registered Member
|
I am using Eigen for CFD coding. I am utilizing Eigen's BiCGSTAB solver to solve the pressure Poisson equation, during the solution of Navier-Stokes equations.
I noticed that while BiCGSTAB solver alone (without preconditioner) utilizes multithreading effectively, when I use a preconditioner such as IncompleteLUT, multithreading no longer works! I understand that it may not work for the step: solver.compute(A); But it does not even work for this step: x = solver.solve(b); This is a problem because while I need only have to execute solver.compute(A) one time initially, solver.solve(b) has to be executed for every timestep. Due to this limitation, I have tested and found that the multithreaded BiCGSTAB without preconditioner is almost twice as fast as the sequential BiCGSTAB with IncompleteLUT preconditioner. Am I missing something or is it a limitation of Eigen's BiCGSTAB solver? |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]