joinSuccess = join(knownId);
}
- if (joinSuccess) {
- double currentClock = Msg.getClock();
- while (currentClock < (initTime + deadline) && currentClock < Common.MAX_SIMULATION_TIME) {
- if (commReceive == null) {
- commReceive = Task.irecv(this.mailbox);
- }
- try {
- if (!commReceive.test()) {
- if (currentClock >= nextStabilizeDate) {
- stabilize();
- nextStabilizeDate = Msg.getClock() + Common.PERIODIC_STABILIZE_DELAY;
- } else if (currentClock >= nextFixFingersDate) {
- fixFingers();
- nextFixFingersDate = Msg.getClock() + Common.PERIODIC_FIX_FINGERS_DELAY;
- } else if (currentClock >= nextCheckPredecessorDate) {
- this.checkPredecessor();
- nextCheckPredecessorDate = Msg.getClock() + Common.PERIODIC_CHECK_PREDECESSOR_DELAY;
- } else if (currentClock >= nextLookupDate) {
- this.randomLookup();
- nextLookupDate = Msg.getClock() + Common.PERIODIC_LOOKUP_DELAY;
- } else {
- waitFor(5);
- }
- currentClock = Msg.getClock();
+
+ if (!joinSuccess) {
+ Msg.info("I couldn't join the ring");
+ return;
+ }
+
+ double currentClock = Msg.getClock();
+ while (currentClock < (initTime + deadline) && currentClock < Common.MAX_SIMULATION_TIME) {
+ if (commReceive == null) {
+ commReceive = Task.irecv(this.mailbox);
+ }
+ try {
+ if (!commReceive.test()) {
+ if (currentClock >= nextStabilizeDate) {
+ stabilize();
+ nextStabilizeDate = Msg.getClock() + Common.PERIODIC_STABILIZE_DELAY;
+ } else if (currentClock >= nextFixFingersDate) {
+ fixFingers();
+ nextFixFingersDate = Msg.getClock() + Common.PERIODIC_FIX_FINGERS_DELAY;
+ } else if (currentClock >= nextCheckPredecessorDate) {
+ this.checkPredecessor();
+ nextCheckPredecessorDate = Msg.getClock() + Common.PERIODIC_CHECK_PREDECESSOR_DELAY;
+ } else if (currentClock >= nextLookupDate) {
+ this.randomLookup();
+ nextLookupDate = Msg.getClock() + Common.PERIODIC_LOOKUP_DELAY;
} else {
- handleTask(commReceive.getTask());
- currentClock = Msg.getClock();
- commReceive = null;
+ waitFor(5);
}
- }
- catch (Exception e) {
+ currentClock = Msg.getClock();
+ } else {
+ handleTask(commReceive.getTask());
currentClock = Msg.getClock();
commReceive = null;
}
}
- leave();
- if (commReceive != null) {
+ catch (Exception e) {
+ currentClock = Msg.getClock();
commReceive = null;
}
- } else {
- Msg.info("I couldn't join the ring");
+ }
+ leave();
+ if (commReceive != null) {
+ commReceive = null;
}
}
procname_(xbt_procname()),
pid_(xbt_getpid())
{}
- WithContextException(Backtrace bt) :
- backtrace_(std::move(bt)),
- procname_(xbt_procname()),
- pid_(xbt_getpid())
+ explicit WithContextException(Backtrace bt) : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid())
{}
- WithContextException(ThrowPoint throwpoint, Backtrace bt) :
- backtrace_(std::move(bt)),
- procname_(xbt_procname()),
- pid_(xbt_getpid()),
- throwpoint_(throwpoint)
+ explicit WithContextException(ThrowPoint throwpoint, Backtrace bt)
+ : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()), throwpoint_(throwpoint)
{}
virtual ~WithContextException();
Backtrace const& backtrace() const
WithContext(E exception, WithContextException context) :
E(std::move(exception)),
WithContextException(std::move(context)) {}
- ~WithContext() override {}
+ ~WithContext() override = default;
};
/** Throw a C++ exception with some context
*target_disp, simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
}
-void mpi_compare_and_swap_( int *origin_addr, int* compare_addr, int* result_addr,
- int* datatype, int* target_rank, MPI_Aint* target_disp, int* win, int* ierr){
+void mpi_compare_and_swap_(int* origin_addr, int* compare_addr, int* result_addr, int* datatype, int* target_rank,
+ MPI_Aint* target_disp, int* win, int* ierr)
+{
*ierr = MPI_Compare_and_swap( static_cast<void *>(origin_addr),static_cast<void *>(compare_addr),
static_cast<void *>(result_addr), simgrid::smpi::Datatype::f2c(*datatype),*target_rank,
*target_disp, simgrid::smpi::Win::f2c(*win));
void mpi_get_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr,
int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count,
int* target_datatype, int* op, int* win, int* ierr){
- *ierr = MPI_Get_accumulate( static_cast<void *>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
- static_cast<void *>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
- *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
+ *ierr =
+ MPI_Get_accumulate(static_cast<void*>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
+ static_cast<void*>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
+ *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
+ simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
}
void mpi_rget_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr,
int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count,
int* target_datatype, int* op, int* win, int* request, int* ierr){
MPI_Request req;
- *ierr = MPI_Rget_accumulate( static_cast<void *>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
- static_cast<void *>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
- *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win), &req);
+ *ierr = MPI_Rget_accumulate(static_cast<void*>(origin_addr), *origin_count,
+ simgrid::smpi::Datatype::f2c(*origin_datatype), static_cast<void*>(result_addr),
+ *result_count, simgrid::smpi::Datatype::f2c(*result_datatype), *target_rank, *target_disp,
+ *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
+ simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win), &req);
if(*ierr == MPI_SUCCESS) {
*request = req->add_f();
}
//following are automatically generated, and have to be checked
void mpi_finalized_ (int * flag, int* ierr){
-
*ierr = MPI_Finalized(flag);
}
}
void mpi_query_thread_ (int *provided, int* ierr){
-
*ierr = MPI_Query_thread(provided);
}