coin-or/Ipopt

How to limit ipopt only use single thread?

ZedongPeng opened this issue · 6 comments

According to the documentation, MUMPS inside IPOPT can use the multi-threading environment.

  • Is there a way to limit MUMPS to use only one thread?
  • Btw, I saw there is an option called wsmp_num_threads. Is this the correct option to set?
  • I am using IPOPT through through Pyomo. Is it possible to set the thread option through Pyomo?

Many thanks.

Ipopt/doc/faq.dox

Lines 40 to 44 in 11739c5

## Is Ipopt thread-safe?
%Ipopt itself is thread-safe. Please check the used third-party components, i.e., linear algebra and linear solvers, for thread-safety, too.
For example, MUMPS is not thread-safe.
Since %Ipopt 3.14.0, however, calls into MUMPS are protected by a mutex in the %Ipopt/MUMPS interface, so that it should be possible to use %Ipopt with MUMPS in a multi-threading environment as well.

I think, by default, Mumps uses only one thread. To enable parallelization (in the non-MPI version of Mumps), you would need to have Mumps build with OpenMP enabled and set the OMP_NUM_THREADS environment variable, see also Section 3.12 of the MUMPS documentation. There is currently no Ipopt option to set the number of threads for OpenMP in Mumps.

wsmp_num_threads is for setting the number of threads in WSMP, a different linear solver.

The FAQ entry you refer to is about running multiple Ipopt instances (and thus, possibly, multiple MUMPS instances) within the same process in parallel.

Actually, I am doing some benchmarks with IPOPT. To make the benchmarks fair, I want to limit each benchmark to only one thread and run the benchmarks in parallel. In my impression, ipopt will only use one thread without any special options specified. However, when I used IPOPT recently, it automatically used multi-threads for some models. Is that possible? Or maybe my observation is wrong?

Many thanks for the response.

My bad. The multi-thread computation comes from Cplex.
Thanks a lot for your help.

Hi. Just a quick question. I saw the following command will use multiple threads. I am curious who might use multiple threads in the command. Ipopt, pyomo or AMPL?
Many thanks. @svigerske
image

From the command, it is Ipopt (or some of the subroutines called by Ipopt) that uses multiple cores.

Further, the Ipopt binary is part of MindtPy. So check with them what they included into this binary and under which situations it would use multiple threads.

Closing as could not reproduce.