Skip to content

Commit

Permalink
remove/move lock_guard; move icntl[2,3] setting behind mumps_c again
Browse files Browse the repository at this point in the history
... and simplify
  • Loading branch information
svigerske committed Nov 27, 2024
1 parent 4677885 commit 33a2fed
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ MumpsSolverInterface::MumpsSolverInterface()
mumps_->par = 1; //working host for sequential version
mumps_->sym = 2; //general symmetric matrix

#ifndef IPOPT_MUMPS_NOMUTEX
const std::lock_guard<std::mutex> lock(mumps_call_mutex);
#endif

mumps_->icntl[2] = 0; // global info stream
mumps_->icntl[3] = 0; // print level
mumps_ptr_ = (void*) mumps_;
}

Expand Down Expand Up @@ -222,14 +216,14 @@ bool MumpsSolverInterface::InitializeImpl(

MUMPS_STRUC_C* mumps_ = static_cast<MUMPS_STRUC_C*>(mumps_ptr_);

#ifndef IPOPT_MUMPS_NOMUTEX
const std::lock_guard<std::mutex> lock(mumps_call_mutex);
#endif

Index mpi_comm;
options.GetIntegerValue("mumps_mpi_communicator", mpi_comm, prefix);
mumps_->comm_fortran = static_cast<int>(mpi_comm);

#ifndef IPOPT_MUMPS_NOMUTEX
const std::lock_guard<std::mutex> lock(mumps_call_mutex);
#endif

mumps_c(mumps_);

// Reset all private data
Expand All @@ -249,11 +243,8 @@ bool MumpsSolverInterface::InitializeImpl(
"MumpsSolverInterface called with warm_start_same_structure, but the problem is solved for the first time.");
}

if( print_level > 0 )
{
mumps_->icntl[2] = 6; // global info stream
mumps_->icntl[3] = print_level; // print level
}
mumps_->icntl[2] = print_level > 0 ? 6 : 0; // global info stream
mumps_->icntl[3] = print_level; // print level

return true;
}
Expand Down

0 comments on commit 33a2fed

Please sign in to comment.