Skip to content

Commit

Permalink
Merge pull request #519 from m-a-d-n-e-s-s/evaleev/fix/worldobject-ta…
Browse files Browse the repository at this point in the history
…sk-always-out-of-order

remote task submission (by `WorldObject::task` and `world.gop.broadcast`) is out of order by default
  • Loading branch information
evaleev authored Jan 19, 2024
2 parents 17b72a7 + 39de6cb commit 7dabba1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
11 changes: 10 additions & 1 deletion src/madness/world/safempi.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <madness/world/worldmutex.h>
#include <madness/world/type_traits.h>
#include <iostream>
#include <csignal>
#include <cstring>
#include <memory>
#include <sstream>
Expand Down Expand Up @@ -792,7 +793,15 @@ namespace SafeMPI {
// if SIGABRT has a handler, call std::abort to allow it be caught,
// else call MPI_Abort which does not seem to call abort at all,
// instead sends SIGTERM followed by SIGKILL
MPI_Abort(pimpl->comm, code);
// if have a custom signal handler for SIGABRT (i.e. we are running under a
// debugger) then call abort()
struct sigaction sa;
auto rc = sigaction(SIGABRT, NULL, &sa);
if (rc == 0 && sa.sa_handler != SIG_DFL) {
abort();
} else {
MPI_Abort(pimpl->comm, code);
}
}

void Barrier() const {
Expand Down
4 changes: 2 additions & 2 deletions src/madness/world/test_world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ void test6(World& world) {
world.gop.fence();

#ifdef MADNESS_WORLDOBJECT_FUTURE_TRACE
MADNESS_CHECK(a.trace_status_nfuture_registered() == a.trace_futures() ? nproc : 0);
MADNESS_CHECK(a.trace_status_nfuture_registered() == (a.trace_futures() ? nproc : 0));
MADNESS_CHECK(decltype(a)::trace_status_nfuture_assigned(a.id()) ==
decltype(a)::trace_futures(a.id()) ? nproc : 0);
(decltype(a)::trace_futures(a.id()) ? nproc : 0));
#endif

// stress the large message protocol ... off by default
Expand Down
2 changes: 1 addition & 1 deletion src/madness/world/world_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ namespace madness {
typename taskT::futureT result;
detail::info<memfnT> info(objid, me, memfn, result.remote_ref(world), attr);
world.am.send(dest, & objT::template spawn_remote_task_handler<taskT>,
new_am_arg(info, a1, a2, a3, a4, a5, a6, a7, a8, a9));
new_am_arg(info, a1, a2, a3, a4, a5, a6, a7, a8, a9), RMI::ATTR_UNORDERED);

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/madness/world/world_task_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ namespace madness {
typedef detail::TaskHandlerInfo<typename taskT::futureT::remote_refT, typename taskT::functionT> infoT;
world.am.send(where, & WorldTaskQueue::template remote_task_handler<taskT>,
new_am_arg(infoT(result.remote_ref(world), fn, attr),
a1, a2, a3, a4, a5, a6, a7, a8, a9));
a1, a2, a3, a4, a5, a6, a7, a8, a9), RMI::ATTR_UNORDERED);

return result;
}
Expand Down
8 changes: 4 additions & 4 deletions src/madness/world/worldgop.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ namespace madness {
// Send active message to children
if(child1 != -1) {
AmArg* const args1 = copy_am_arg(*args0);
world_.am.send(child1, handler, args1);
world_.am.send(child1, handler, args1, RMI::ATTR_UNORDERED);
}
world_.am.send(child0, handler, args0);
world_.am.send(child0, handler, args0, RMI::ATTR_UNORDERED);
}
}

Expand Down Expand Up @@ -445,9 +445,9 @@ namespace madness {
// Send active message to children
if(child1 != -1) {
AmArg* const args1 = copy_am_arg(*args0);
world_.am.send(child1, handler, args1);
world_.am.send(child1, handler, args1, RMI::ATTR_UNORDERED);
}
world_.am.send(child0, handler, args0);
world_.am.send(child0, handler, args0, RMI::ATTR_UNORDERED);
}
}

Expand Down

0 comments on commit 7dabba1

Please sign in to comment.