X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/510e081f7d3f45bf4a464ad3080f89d0a1e9b282..51d4edd27c6eb85f2db6df6d531d1538739cfbb3:/src/smpi/smpi_replay.cpp diff --git a/src/smpi/smpi_replay.cpp b/src/smpi/smpi_replay.cpp index b62e3ff56f..1b6dd415b7 100644 --- a/src/smpi/smpi_replay.cpp +++ b/src/smpi/smpi_replay.cpp @@ -1,12 +1,10 @@ -/* Copyright (c) 2009-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include "private.h" -#include -#include +#include "xbt/replay.h" #include #include @@ -169,7 +167,7 @@ static void action_init(const char *const *action) static void action_finalize(const char *const *action) { - /* do nothing */ + /* Nothing to do */ } static void action_comm_size(const char *const *action) @@ -466,9 +464,8 @@ static void action_bcast(const char *const *action) if(action[3]) { root= atoi(action[3]); - if(action[4]) { + if(action[4]) MPI_CURRENT_TYPE=decode_datatype(action[4]); - } } int rank = smpi_process_index(); @@ -499,9 +496,8 @@ static void action_reduce(const char *const *action) if(action[4]) { root= atoi(action[4]); - if(action[5]) { + if(action[5]) MPI_CURRENT_TYPE=decode_datatype(action[5]); - } } int rank = smpi_process_index(); @@ -553,8 +549,7 @@ static void action_allReduce(const char *const *action) { } static void action_allToAll(const char *const *action) { - CHECK_ACTION_PARAMS(action, 2, 2) //two mandatory (send and recv volumes) - //two optional (corresponding datatypes) + CHECK_ACTION_PARAMS(action, 2, 2) //two mandatory (send and recv volumes) and two optional (corresponding datatypes) double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); int send_size = parse_double(action[2]); @@ -565,9 +560,8 @@ static void action_allToAll(const char *const *action) { MPI_CURRENT_TYPE=decode_datatype(action[4]); MPI_CURRENT_TYPE2=decode_datatype(action[5]); } - else{ + else MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE; - } void *send = smpi_get_tmp_sendbuffer(send_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE)); void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE2)); @@ -646,27 +640,27 @@ static void action_gatherv(const char *const *action) { 4) 0 is the send datatype id, see decode_datatype() 5) 0 is the recv datatype id, see decode_datatype() */ - double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); CHECK_ACTION_PARAMS(action, comm_size+1, 2) int send_size = parse_double(action[2]); - int disps[comm_size] = { 0 }; + int disps[comm_size]; int recvcounts[comm_size]; - int i=0,recv_sum=0; + int recv_sum=0; MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE; if(action[4+comm_size] && action[5+comm_size]) { MPI_CURRENT_TYPE=decode_datatype(action[4+comm_size]); MPI_CURRENT_TYPE2=decode_datatype(action[5+comm_size]); - } else { + } else MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE; - } + void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE)); void *recv = nullptr; - for(i=0;itype = TRACING_GATHERV; extra->send_size = send_size; extra->recvcounts= xbt_new(int,comm_size); - for(i=0; i< comm_size; i++)//copy data to avoid bad free + for(int i=0; i< comm_size; i++)//copy data to avoid bad free extra->recvcounts[i] = recvcounts[i]; extra->root = root; extra->num_processes = comm_size; @@ -760,9 +754,9 @@ static void action_allgather(const char *const *action) { if(action[4] && action[5]) { MPI_CURRENT_TYPE = decode_datatype(action[4]); MPI_CURRENT_TYPE2 = decode_datatype(action[5]); - } else { + } else MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE; - } + void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE)); void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2)); @@ -797,21 +791,22 @@ static void action_allgatherv(const char *const *action) { CHECK_ACTION_PARAMS(action, comm_size+1, 2) int sendcount=atoi(action[2]); int recvcounts[comm_size]; - int disps[comm_size] = { 0 }; + int disps[comm_size]; int recv_sum=0; MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE; if(action[3+comm_size] && action[4+comm_size]) { MPI_CURRENT_TYPE = decode_datatype(action[3+comm_size]); MPI_CURRENT_TYPE2 = decode_datatype(action[4+comm_size]); - } else { + } else MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE; - } + void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE)); for(int i=0;i