Skip to content

Commit

Permalink
fix mpi::all_reduce in reinit_fms_impl.hpp with boost >= 1.69, relate…
Browse files Browse the repository at this point in the history
…d to #1296 (@tmetivet)

we need to ask to boost mpi developers why these changes are required
  • Loading branch information
vincentchabannes committed Nov 27, 2019
1 parent 108a52b commit 96198a7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions feelpp/feel/feells/reinit_fms_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ reduceClosePoints(heap_type& theHeap, element_type& status )
}


template <typename HeapEntryType, typename TheSizeType>
struct MinNewEntryForAllReduce
{
typedef std::pair<HeapEntryType,TheSizeType> cont_type;
cont_type operator()( cont_type const& a, cont_type const& b ) const
{
return std::abs(a.first.first) < std::abs(b.first.first) ? a : b;
}
};


template<typename FunctionSpaceType, typename periodicity_type>
typename ReinitializerFMS<FunctionSpaceType, periodicity_type>::element_type
Expand Down Expand Up @@ -436,14 +446,14 @@ ReinitializerFMS<FunctionSpaceType, periodicity_type>::operator()
checkHeap( "before reduce close points" );
reduceClosePoints( theHeap, status );
checkHeap( "after reduce close points" );

#if 0 // Not work from boost >= 1.69, see #1296
typedef std::pair<heap_entry_type, size_type> pair_heap_dofid_type;
std::function<pair_heap_dofid_type( pair_heap_dofid_type const&, pair_heap_dofid_type const& )>
minNewEntry = []( pair_heap_dofid_type const& a,
pair_heap_dofid_type const& b)
{ // return the entry having the minimum abs(phi) value
return std::abs(a.first.first) < std::abs(b.first.first) ? a : b; };

#endif

const int nbTotalIterFM = M_functionspace->dof()->nDof() - nbTotalDone - M_nbDofTag1;

Expand All @@ -461,7 +471,7 @@ ReinitializerFMS<FunctionSpaceType, periodicity_type>::operator()
// the real new accepted value is the min of all the phi computed in the heaps
newAccepted = mpi::all_reduce(Environment::worldComm().globalComm(),
newAccepted,
minNewEntry);
MinNewEntryForAllReduce<heap_entry_type, size_type>() /*minNewEntry*/);

size_type newIdOnCluster = newAccepted.second;

Expand Down

0 comments on commit 96198a7

Please sign in to comment.