Package: src:coinor-ipopt
Version: 3.11.9-2.1
Severity: normal

I had some problems with IPopt using the sequential version of MUMPS
recently: as MUMPS provides dummy `MPI_*` functions, my program ended
up using some of them or MUMPS used some of the real MPI functions.
As mentioned in IPopt's README this doesn't work well:

+---
| Note: MUMPS uses interally a fake implementation of MPI. If you are
| using Ipopt within an MPIprogram together with MUMPS, the code will not
| run.  You will have to modify the MUMPS sources so that the MPI symbols
| inside the MUMPS code are renamed.
+---[ 
https://projects.coin-or.org/Ipopt/browser/stable/3.12/Ipopt/doc/documentation.pdf?format=raw
 ]

I guess I was a bit lucky that is didn't happen before.

The attached patch builds IPopt against the MPI-parallel version of
MUMPS, but uses only one process (MPI_COMM_SELF).  That has worked
better for me without needing invasive changes to the MUMPS source
code.

Ansgar
diff -Nru coinor-ipopt-3.11.9/debian/control coinor-ipopt-3.11.9/debian/control
--- coinor-ipopt-3.11.9/debian/control  2015-08-30 14:44:13.000000000 +0200
+++ coinor-ipopt-3.11.9/debian/control  2019-03-15 14:01:05.000000000 +0100
@@ -3,8 +3,9 @@
 Priority: extra
 Maintainer: Greg Horn <gregmainl...@gmail.com>
 Build-Depends: debhelper (>= 5), autotools-dev, gfortran, libblas-dev,
- libmumps-seq-dev (>= 4.9.2.dfsg-4),
- liblapack-dev, doxygen-latex, ghostscript, chrpath, cdbs
+ libmumps-dev (>= 4.9.2.dfsg-4),
+ liblapack-dev, doxygen-latex, ghostscript, chrpath, cdbs,
+ mpi-default-dev, mpi-default-bin
 Build-Conflicts: pkg-config
 Standards-Version: 3.9.5
 Homepage: https://projects.coin-or.org/Ipopt
@@ -34,7 +35,7 @@
 Package: coinor-libipopt-dev
 Section: libdevel
 Architecture: any
-Depends: coinor-libipopt1v5 (= ${binary:Version}), libmumps-seq-dev, 
${shlibs:Depends}, ${misc:Depends}
+Depends: coinor-libipopt1v5 (= ${binary:Version}), libmumps-dev, 
${shlibs:Depends}, ${misc:Depends}
 Description: Interior-Point Optimizer - header files
  Ipopt is an open-source solver for large-scale nonlinear continuous
  optimization. It can be used from modeling environments, such as AMPL,
diff -Nru coinor-ipopt-3.11.9/debian/patches/parallel-mumps.patch 
coinor-ipopt-3.11.9/debian/patches/parallel-mumps.patch
--- coinor-ipopt-3.11.9/debian/patches/parallel-mumps.patch     1970-01-01 
01:00:00.000000000 +0100
+++ coinor-ipopt-3.11.9/debian/patches/parallel-mumps.patch     2019-03-15 
14:01:05.000000000 +0100
@@ -0,0 +1,40 @@
+--- 
coinor-ipopt-3.11.9.orig/Ipopt/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp
++++ 
coinor-ipopt-3.11.9/Ipopt/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp
+@@ -12,7 +12,7 @@
+ 
+ // The following line is a fix for otherwise twice-defined global variable
+ // (This would have to be taken out for a parallel MUMPS version!)
+-#define MPI_COMM_WORLD IPOPT_MPI_COMM_WORLD
++//#define MPI_COMM_WORLD IPOPT_MPI_COMM_WORLD
+ // The first header to include is the one for MPI.  
+ #include "mpi.h"
+ 
+@@ -46,8 +46,6 @@ namespace Ipopt
+   static const Index dbg_verbosity = 0;
+ #endif
+ 
+-#define USE_COMM_WORLD -987654
+-
+   int MumpsSolverInterface::instancecount_mpi = 0;
+ 
+   MumpsSolverInterface::MumpsSolverInterface()
+@@ -71,8 +69,9 @@ namespace Ipopt
+     else if( instancecount_mpi > 0 )
+        ++instancecount_mpi;
+ #endif
++    MPI_Comm comm = MPI_COMM_SELF;
+     int myid;
+-    MPI_Comm_rank(MPI_COMM_WORLD, &myid);
++    MPI_Comm_rank(comm, &myid);
+ #endif
+     mumps_->n = 0;
+     mumps_->nz = 0;
+@@ -82,7 +81,7 @@ namespace Ipopt
+     mumps_->job = -1;//initialize mumps
+     mumps_->par = 1;//working host for sequential version
+     mumps_->sym = 2;//general symetric matrix
+-    mumps_->comm_fortran = USE_COMM_WORLD;
++    mumps_->comm_fortran = MPI_Comm_c2f(comm);
+     dmumps_c(mumps_);
+     mumps_->icntl[1] = 0;
+     mumps_->icntl[2] = 0;//QUIETLY!
diff -Nru coinor-ipopt-3.11.9/debian/patches/series 
coinor-ipopt-3.11.9/debian/patches/series
--- coinor-ipopt-3.11.9/debian/patches/series   2014-10-01 14:42:17.000000000 
+0200
+++ coinor-ipopt-3.11.9/debian/patches/series   2019-03-15 14:01:05.000000000 
+0100
@@ -2,3 +2,4 @@
 add_missing_cstddef.patch
 doxygen.patch
 
+parallel-mumps.patch
diff -Nru coinor-ipopt-3.11.9/debian/rules coinor-ipopt-3.11.9/debian/rules
--- coinor-ipopt-3.11.9/debian/rules    2015-08-30 14:47:04.000000000 +0200
+++ coinor-ipopt-3.11.9/debian/rules    2019-03-15 14:01:05.000000000 +0100
@@ -3,11 +3,15 @@
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/autotools.mk
 
-CPPFLAGS += -I/usr/include/mumps_seq -DHAVE_CSTDDEF
-LDFLAGS += -llapack -lblas -ldmumps_seq -ldl
+export OMPI_MCA_plm_rsh_agent=/bin/false
+export OMPI_MCA_rmaps_base_oversubscribe=1
+
+CPPFLAGS += -DHAVE_CSTDDEF
+LDFLAGS += -llapack -lblas -ldmumps -ldl
 DEB_CONFIGURE_EXTRA_FLAGS += --enable-static \
                                                         
--with-mumps-incdir=/usr/include \
-                                                        
--with-mumps-lib='-ldmumps_seq'
+                                                        
--with-mumps-lib='-ldmumps' \
+                                                        CC=mpicc CXX=mpicxx
 DEB_MAKE_CHECK_TARGET = test
 
 binary-install/coinor-libipopt1v5:: 
debian/stamp-binary-install-coinor-libipopt1

Reply via email to