Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug in the counstrained source term under MPI #33

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion FEM/rf_pcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
/*--------------------- MPI Parallel -------------------*/
#if defined(USE_MPI) || defined(USE_MPI_PARPROC) || defined(USE_MPI_REGSOIL)
#include <mpi.h>
#if defined (USE_MPI)
#include "SplitMPI_Communicator.h"
#endif
#endif
/*--------------------- MPI Parallel -------------------*/

Expand Down Expand Up @@ -8049,8 +8052,21 @@ double CRFProcess::evaluteSwitchBC(CBoundaryCondition const & bc, CBoundaryCondi

for (std::size_t temp_i(0); temp_i < m_st->getNumberOfConstrainedSTs(); temp_i++)
{
if (st_vector[cnodev->getSTVectorGroup()]->isCompleteConstrainST(temp_i)
int st_conditionst = (st_vector[cnodev->getSTVectorGroup()]->isCompleteConstrainST(temp_i)
&& st_vector[cnodev->getSTVectorGroup()]->getCompleteConstrainedSTStateOff(temp_i))
? 1 : 0;

#if defined(USE_MPI) || defined (USE_PETSC)
int int_buff = 0;
#ifdef USE_PETSC
MPI_Comm comm = MPI_COMM_WORLD;
#else
MPI_Comm comm = comm_DDC;
#endif
MPI_Allreduce(&st_conditionst, &int_buff, 1, MPI_INT, MPI_SUM, comm);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WaltherM collective communication function can’t be called here because that not call partitions satisfy the condition of (line 8044)

            if (st_node.size() > 0 && (long) st_node.size() > i)

The means some compute cores skip the if-condition, while the other move inside the if-condition to call MPI_Allreduce, which leads to a dead lock here.

Due to this reason, I have to close this PR and want to discuss the issue with you later.

st_conditionst = int_buff;
#endif
if (st_conditionst > 0)
{
continue_bool = true;
break;
Expand Down