Skip to content

Commit

Permalink
have option mumps_mpi_communicator only if not using MUMPS' fake mpi.h
Browse files Browse the repository at this point in the history
- ref #790
  • Loading branch information
svigerske committed Dec 12, 2024
1 parent 112be59 commit 1760fc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/options.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ Possible values:
\anchor OPT_mumps_mpi_communicator
<strong>mumps_mpi_communicator</strong> (<em>advanced</em>): MPI communicator used for matrix operations
<blockquote>
This sets the MPI communicator. MPI_COMM_WORLD is the default. Any other value should be the return value from MPI_Comm_c2f. The valid range for this integer option is unrestricted and its default value is -987654.
This sets the MPI communicator. MPI_COMM_WORLD is the default. Any other value should be the return value from MPI_Comm_c2f. The valid range for this integer option is unrestricted and its default value is -987654. This option is only available if MUMPS's libseq/mpi.h is not used.
</blockquote>


Expand Down
9 changes: 8 additions & 1 deletion src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,14 @@ void MumpsSolverInterface::RegisterOptions(
"Threshold to consider a pivot at zero in detection of linearly dependent constraints with MUMPS.",
0.0,
"This is CNTL(3) in MUMPS.", true);
#ifndef COIN_USE_MUMPS_MPI_H
roptions->AddIntegerOption(
"mumps_mpi_communicator",
"MPI communicator used for matrix operations",
USE_COMM_WORLD,
"This sets the MPI communicator. MPI_COMM_WORLD is the default. Any other value should be the return value from MPI_Comm_c2f.", true);
"This sets the MPI communicator. MPI_COMM_WORLD is the default. Any other value should be the return value from MPI_Comm_c2f. "
"This option is only available if MUMPS's libseq/mpi.h is not used.", true);
#endif
}

/// give name of MUMPS with version info
Expand Down Expand Up @@ -217,7 +220,11 @@ bool MumpsSolverInterface::InitializeImpl(
MUMPS_STRUC_C* mumps_ = static_cast<MUMPS_STRUC_C*>(mumps_ptr_);

Index mpi_comm;
#ifndef COIN_USE_MUMPS_MPI_H
options.GetIntegerValue("mumps_mpi_communicator", mpi_comm, prefix);
#else
mpi_comm = USE_COMM_WORLD;
#endif
mumps_->comm_fortran = static_cast<int>(mpi_comm);

#ifndef IPOPT_MUMPS_NOMUTEX
Expand Down

0 comments on commit 1760fc9

Please sign in to comment.