From: degomme Date: Fri, 27 May 2016 22:54:29 +0000 (+0200) Subject: int -> bool for replay control X-Git-Tag: v3_14~1130^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8f8b678e269538ddacde5cfc56a1f26b7daa4b91 int -> bool for replay control --- diff --git a/src/smpi/private.h b/src/smpi/private.h index 2c1965d99a..fd70eba61a 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -177,8 +177,8 @@ XBT_PRIVATE void smpi_process_simulated_start(void); XBT_PRIVATE double smpi_process_simulated_elapsed(void); XBT_PRIVATE void smpi_process_set_sampling(int s); XBT_PRIVATE int smpi_process_get_sampling(void); -XBT_PRIVATE void smpi_process_set_replaying(int s); -XBT_PRIVATE int smpi_process_get_replaying(void); +XBT_PRIVATE void smpi_process_set_replaying(bool s); +XBT_PRIVATE bool smpi_process_get_replaying(void); XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*); XBT_PRIVATE void smpi_deployment_cleanup_instances(void); diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index eef72d0038..ffc2d3c69e 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -371,10 +371,10 @@ void smpi_comm_init_smp(MPI_Comm comm){ // If we are in replay - perform an ugly hack // tell SimGrid we are not in replay for a while, because we need the buffers to be copied for the following calls - int replaying = 0; //cache data to set it back again after + bool replaying = false; //cache data to set it back again after if(smpi_process_get_replaying()){ - replaying=1; - smpi_process_set_replaying(0); + replaying=true; + smpi_process_set_replaying(false); } if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables @@ -536,8 +536,8 @@ void smpi_comm_init_smp(MPI_Comm comm){ } xbt_free(leader_list); - if(replaying==1) - smpi_process_set_replaying(1); + if(replaying) + smpi_process_set_replaying(true); } int smpi_comm_attr_delete(MPI_Comm comm, int keyval){ diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 13b9b3b0bb..e2bc34462d 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -46,7 +46,7 @@ typedef struct s_smpi_process_data { char state; int sampling; /* inside an SMPI_SAMPLE_ block? */ char* instance_id; - int replaying; /* is the process replaying a trace */ + bool replaying; /* is the process replaying a trace */ xbt_bar_t finalization_barrier; int return_value; smpi_trace_call_location_t* trace_call_loc; @@ -110,7 +110,7 @@ void smpi_process_init(int *argc, char ***argv) if(temp_bar != NULL) data->finalization_barrier = temp_bar; data->index = index; data->instance_id = instance_id; - data->replaying = 0; + data->replaying = false; //xbt_free(simcall_process_get_data(proc)); simdata_process_t simdata = static_cast(simcall_process_get_data(proc)); @@ -185,17 +185,17 @@ void smpi_process_mark_as_initialized(void) process_data[index_to_process_data[index]]->state = SMPI_INITIALIZED; } -void smpi_process_set_replaying(int value){ +void smpi_process_set_replaying(bool value){ int index = smpi_process_index(); if ((index != MPI_UNDEFINED) && (process_data[index_to_process_data[index]]->state != SMPI_FINALIZED)) process_data[index_to_process_data[index]]->replaying = value; } -int smpi_process_get_replaying(){ +bool smpi_process_get_replaying(){ int index = smpi_process_index(); if (index != MPI_UNDEFINED) return process_data[index_to_process_data[index]]->replaying; - else return _xbt_replay_is_active(); + else return (_xbt_replay_is_active() != 0); } int smpi_global_size(void) diff --git a/src/smpi/smpi_replay.cpp b/src/smpi/smpi_replay.cpp index ee16669182..7975f1c1aa 100644 --- a/src/smpi/smpi_replay.cpp +++ b/src/smpi/smpi_replay.cpp @@ -979,7 +979,7 @@ void smpi_replay_run(int *argc, char***argv){ /* First initializes everything */ smpi_process_init(argc, argv); smpi_process_mark_as_initialized(); - smpi_process_set_replaying(1); + smpi_process_set_replaying(true); int rank = smpi_process_index(); TRACE_smpi_init(rank);