setNbThreads() mandatory for OMP parallelization?
Summary
The documentation on multithreading(https://eigen.tuxfamily.org/dox/TopicMultiThreading.html) reads:
You can control the number of threads that will be used using either the OpenMP API or Eigen's API using the following priority:
OMP_NUM_THREADS=n ./my_program
omp_set_num_threads(n);
Eigen::setNbThreads(n);
Unless setNbThreads has been called, Eigen uses the number of threads specified by OpenMP. You can restore this behavior by calling setNbThreads(0);. You can query the number of threads that will be used with:
n = Eigen::nbThreads( );
However, I encountered that setNbThreads is now mandatory in Eigen 3.4.X for the OMP parallelizatzion to work, independent on what is set by OMP_NUM_THREADS (I tested it with different linear solvers like CG and BiCGSTAB). Is this a bug or a feature? Should the documentation be updated?
Environment
- Operating System : Linux
- Architecture : x64
- Eigen Version : 3.4.X
- Compiler Version : Gcc13.0
- Compile Flags : -O3 -march=native
Anything else that might help
-
Have a plan to fix this issue.
Edited by Joerg Buchwald