From: Martin Quinson Date: Wed, 19 Jul 2017 17:32:34 +0000 (+0200) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3_17~363 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/817094bccfaafe29059ed2ff71c573699d5909bd?hp=1c413ffb9aa79a5a693433a5631595fe15581537 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- diff --git a/contrib/benchmarking_code_block/inject.h b/contrib/benchmarking_code_block/inject.h index c171b0925c..a79ac2863d 100644 --- a/contrib/benchmarking_code_block/inject.h +++ b/contrib/benchmarking_code_block/inject.h @@ -88,7 +88,7 @@ static inline void xbt_inject_init(char *inputfile) xbt_dict_set(mydict, key, data, NULL); } - fclose(fInput); + fclose(fpInput); } /* Initializing xbt dictionary for StarPU version, reading xbt_hist_t entries line by line */ @@ -113,6 +113,7 @@ static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre if (fgets(line, MAX_LINE_INJ, fpInput) == NULL) { printf("Error input file is empty!"); // Skipping first row + fclose(fpInput); return; } @@ -139,7 +140,7 @@ static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre xbt_dict_set(mydict, key, data, NULL); } - fclose(fInput); + fclose(fpInput); } /* Injecting time */ diff --git a/examples/java/dht/chord/Node.java b/examples/java/dht/chord/Node.java index f29ead5690..2ef023c1d2 100644 --- a/examples/java/dht/chord/Node.java +++ b/examples/java/dht/chord/Node.java @@ -64,47 +64,49 @@ public class Node extends Process { 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; } } diff --git a/examples/java/io/file/Node.java b/examples/java/io/file/Node.java index 82ce689487..706c3b9705 100644 --- a/examples/java/io/file/Node.java +++ b/examples/java/io/file/Node.java @@ -39,11 +39,10 @@ public class Node extends Process { } public void main(String[] args) throws MsgException { - String mount; + String mount = "/home"; String fileName; switch (rank) { case 4: - mount = "/home"; fileName = mount + file1; break; case 0: @@ -51,16 +50,14 @@ public class Node extends Process { fileName = mount + file2; break; case 2: - mount = "/home"; fileName = mount + file3; break; case 1: - mount = "/home"; fileName = mount + file4; break; default: - mount = "/home"; fileName = mount + file1; + break; } Msg.info("Open file " + fileName); diff --git a/include/xbt/Extendable.hpp b/include/xbt/Extendable.hpp index f158d50d80..5cf36a9525 100644 --- a/include/xbt/Extendable.hpp +++ b/include/xbt/Extendable.hpp @@ -24,7 +24,7 @@ class Extension { friend class Extendable; constexpr Extension(std::size_t id) : id_(id) {} public: - constexpr Extension() : id_(INVALID_ID) {} + explicit constexpr Extension() : id_(INVALID_ID) {} std::size_t id() const { return id_; } bool valid() { return id_ != INVALID_ID; } }; diff --git a/include/xbt/exception.hpp b/include/xbt/exception.hpp index 6e801981d2..7c826cd697 100644 --- a/include/xbt/exception.hpp +++ b/include/xbt/exception.hpp @@ -72,16 +72,10 @@ public: 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 @@ -116,7 +110,7 @@ public: 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 diff --git a/src/smpi/bindings/smpi_f77.cpp b/src/smpi/bindings/smpi_f77.cpp index ad40a6b49e..c8f0680729 100644 --- a/src/smpi/bindings/smpi_f77.cpp +++ b/src/smpi/bindings/smpi_f77.cpp @@ -399,8 +399,9 @@ void mpi_fetch_and_op_( int *origin_addr, int* result_addr, int* datatype, int* *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(origin_addr),static_cast(compare_addr), static_cast(result_addr), simgrid::smpi::Datatype::f2c(*datatype),*target_rank, *target_disp, simgrid::smpi::Win::f2c(*win)); @@ -409,20 +410,22 @@ void mpi_compare_and_swap_( int *origin_addr, int* compare_addr, int* result_add 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(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype), - static_cast(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(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype), + static_cast(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(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype), - static_cast(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(origin_addr), *origin_count, + simgrid::smpi::Datatype::f2c(*origin_datatype), static_cast(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(); } @@ -430,7 +433,6 @@ void mpi_rget_accumulate_(int *origin_addr, int* origin_count, int* origin_datat //following are automatically generated, and have to be checked void mpi_finalized_ (int * flag, int* ierr){ - *ierr = MPI_Finalized(flag); } @@ -441,7 +443,6 @@ void mpi_init_thread_ (int* required, int *provided, int* ierr){ } void mpi_query_thread_ (int *provided, int* ierr){ - *ierr = MPI_Query_thread(provided); }