From: Arnaud Giersch Date: Mon, 4 Feb 2019 09:58:41 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/master' X-Git-Tag: v3_22~394 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/33486e78305d65ff8eb5f4bd2b3b52decfad242e?hp=56c037333549457d57bb74eb135b3b3127b54fad Merge remote-tracking branch 'origin/master' --- diff --git a/.codacy.yml b/.codacy.yml index d7f3564698..fa5ea26553 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -3,17 +3,17 @@ engines: coverage: enabled: true exclude_paths: - - teshsuite/** + - 'teshsuite/**' exclude_paths: - - src/include/catch.hpp - - teshsuite/smpi/mpich3-test/** - - teshsuite/smpi/isp/** - - **/*_dtd.c - - **/*_dtd.h - - **/*yy.c - - src/xbt/automaton/parserPromela.tab.* - - src/smpi/colls/**/* - - examples/smpi/NAS/* - - src/xbt/RngStream.c - - include/xbt/RngStream.h - \ No newline at end of file + - '**/*_dtd.c' + - '**/*_dtd.h' + - '**/*yy.c' + - 'docs/**.py' + - 'examples/smpi/NAS/*' + - 'include/xbt/RngStream.h' + - 'src/include/catch.hpp' + - 'src/smpi/colls/**/*' + - 'src/xbt/RngStream.c' + - 'src/xbt/automaton/parserPromela.tab.*' + - 'teshsuite/smpi/isp/**' + - 'teshsuite/smpi/mpich3-test/**' diff --git a/docs/Build.sh b/docs/Build.sh index c7bfa41158..b9b55f2c60 100755 --- a/docs/Build.sh +++ b/docs/Build.sh @@ -32,16 +32,16 @@ PYTHONPATH=../lib sphinx-build -M html source build ${SPHINXOPTS} set +x -cat source/img/graphical-toc.svg \ - | perl -pe 's/(xlink:href="http)/target="_top" $1/' \ +< source/img/graphical-toc.svg \ + perl -pe 's/(xlink:href="http)/target="_top" $1/' \ | perl -pe 's/(xlink:href=".*?.html)/target="_top" $1/' \ > build/html/graphical-toc.svg echo "List of missing references:" -for f in `(grep '' build/xml/msg_8h.xml; \ - grep '' build/xml/namespacesimgrid_1_1s4u.xml; \ - grep ']*>//g'|sort` +for f in $( (grep '' build/xml/msg_8h.xml; \ + grep '' build/xml/namespacesimgrid_1_1s4u.xml; \ + grep ']*>//g' | sort ) do if grep $f source/*rst | grep -q '.. doxygen[^::]*:: '"$f"'$' || @@ -54,4 +54,4 @@ do echo "$f" fi fi -done \ No newline at end of file +done diff --git a/docs/source/tuto_s4u/master-workers-lab3.cpp b/docs/source/tuto_s4u/master-workers-lab3.cpp index f31f381c69..6d657826fd 100644 --- a/docs/source/tuto_s4u/master-workers-lab3.cpp +++ b/docs/source/tuto_s4u/master-workers-lab3.cpp @@ -21,10 +21,9 @@ static void worker() const std::string mailbox_name = std::string("worker-") + std::to_string(simgrid::s4u::this_actor::get_pid()); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name); - double compute_cost; while (true) { // Master forcefully kills the workers by the end of the simulation double* msg = static_cast(mailbox->get()); - compute_cost = *msg; + double compute_cost = *msg; delete msg; simgrid::s4u::this_actor::execute(compute_cost); diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 2bcc793eee..0576607a7e 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -86,20 +86,15 @@ double Engine::get_clock() */ void Engine::load_platform(std::string platf) { - double start = 0; - double end = 0; - if (XBT_LOG_ISENABLED(s4u_engine, xbt_log_priority_debug)) - start = xbt_os_time(); + double start = xbt_os_time(); try { parse_platform_file(platf); } catch (xbt_ex& e) { xbt_die("Error while loading %s: %s", platf.c_str(), e.what()); } - if (XBT_LOG_ISENABLED(s4u_engine, xbt_log_priority_debug)) { - end = xbt_os_time(); - XBT_DEBUG("PARSE TIME: %g", (end - start)); - } + double end = xbt_os_time(); + XBT_DEBUG("PARSE TIME: %g", (end - start)); } void Engine::register_function(std::string name, int (*code)(int, char**)) diff --git a/src/smpi/colls/coll_tuned_topo.cpp b/src/smpi/colls/coll_tuned_topo.cpp index c9527705db..27f20da01b 100644 --- a/src/smpi/colls/coll_tuned_topo.cpp +++ b/src/smpi/colls/coll_tuned_topo.cpp @@ -26,14 +26,16 @@ */ static int pown( int fanout, int num ) { - int j, p = 1; + int p = 1; if( num < 0 ) return 0; if (1==num) return fanout; if (2==fanout) { return p<tree_root = root; tree->tree_prev = -1; tree->tree_nextsize = 0; - for( i = 0; i < fanout; i++ ) { - tree->tree_next[i] = -1; + for (int i = 0; i < fanout; i++) { + tree->tree_next[i] = -1; } /* return if we have less than 2 processes */ @@ -148,8 +149,8 @@ ompi_coll_tuned_topo_build_tree( int fanout, delta = pown( fanout, level ); /* find my children */ - for( i = 0; i < fanout; i++ ) { - schild = shiftedrank + delta * (i+1); + for (int i = 0; i < fanout; i++) { + int schild = shiftedrank + delta * (i+1); if( schild < size ) { tree->tree_next[i] = (schild+root)%size; tree->tree_nextsize = tree->tree_nextsize + 1; @@ -191,8 +192,8 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm ) { int rank, size; - int myrank, rightsize, delta; - int parent, lchild, rchild; + int myrank, delta; + int parent; ompi_coll_tree_t* tree; /* @@ -233,11 +234,11 @@ ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm ) while ( 1 ) { /* Compute the size of the right subtree */ - rightsize = size >> 1; + int rightsize = size >> 1; /* Determine the left and right child of this parent */ - lchild = -1; - rchild = -1; + int lchild = -1; + int rchild = -1; if (size - 1 > 0) { lchild = parent - 1; if (lchild > 0) { @@ -410,7 +411,6 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int int rank, vrank; int size; int mask = 1; - int remote; ompi_coll_tree_t *bmtree; int i; @@ -442,7 +442,7 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int } while (mask < size) { - remote = vrank ^ mask; + int remote = vrank ^ mask; if (remote < vrank) { bmtree->tree_prev = (remote + root) % size; break; @@ -451,6 +451,7 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int childs++; if (childs == MAXTREEFANOUT) { XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, childs); + delete bmtree; return NULL; } } @@ -471,7 +472,7 @@ ompi_coll_tuned_topo_build_chain( int fanout, int rank, size; int srank; /* shifted rank */ int i,maxchainlen; - int mark,head,len; + int mark; ompi_coll_tree_t *chain; XBT_DEBUG("coll:tuned:topo:build_chain fo %d rt %d", fanout, root); @@ -561,6 +562,8 @@ ompi_coll_tuned_topo_build_chain( int fanout, */ if( srank != 0 ) { int column; + int head; + int len; if( srank-1 < (mark * maxchainlen) ) { column = (srank-1)/maxchainlen; head = 1+column*maxchainlen; @@ -596,7 +599,7 @@ ompi_coll_tuned_topo_build_chain( int fanout, if( rank == root ) { chain->tree_prev = -1; chain->tree_next[0] = (root+1)%size; - for( i = 1; i < fanout; i++ ) { + for (int i = 1; i < fanout; i++) { chain->tree_next[i] = chain->tree_next[i-1] + maxchainlen; if( i > mark ) { chain->tree_next[i]--; @@ -616,15 +619,13 @@ ompi_coll_tuned_topo_build_chain( int fanout, int ompi_coll_tuned_topo_dump_tree (ompi_coll_tree_t* tree, int rank) { - int i; - XBT_DEBUG("coll:tuned:topo:topo_dump_tree %1d tree root %d" " fanout %d BM %1d nextsize %d prev %d", rank, tree->tree_root, tree->tree_bmtree, tree->tree_fanout, tree->tree_nextsize, tree->tree_prev); if( tree->tree_nextsize ) { - for( i = 0; i < tree->tree_nextsize; i++ ) - XBT_DEBUG("[%1d] %d", i, tree->tree_next[i]); + for (int i = 0; i < tree->tree_nextsize; i++) + XBT_DEBUG("[%1d] %d", i, tree->tree_next[i]); } return (0); } diff --git a/src/smpi/colls/smpi_default_selector.cpp b/src/smpi/colls/smpi_default_selector.cpp index 3b8252a938..7b6899e25e 100644 --- a/src/smpi/colls/smpi_default_selector.cpp +++ b/src/smpi/colls/smpi_default_selector.cpp @@ -25,7 +25,7 @@ int Coll_barrier_default::barrier(MPI_Comm comm) int Coll_gather_default::gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) { - int system_tag = COLL_TAG_GATHER; + const int system_tag = COLL_TAG_GATHER; MPI_Aint lb = 0; MPI_Aint recvext = 0; @@ -74,9 +74,8 @@ int Coll_reduce_scatter_default::reduce_scatter(void *sendbuf, void *recvbuf, in count += recvcounts[i]; } void *tmpbuf = static_cast(smpi_get_tmp_sendbuffer(count*datatype->get_extent())); - int ret = MPI_SUCCESS; - ret = Coll_reduce_default::reduce(sendbuf, tmpbuf, count, datatype, op, 0, comm); + int ret = Coll_reduce_default::reduce(sendbuf, tmpbuf, count, datatype, op, 0, comm); if(ret==MPI_SUCCESS) ret = Colls::scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf, recvcounts[rank], datatype, 0, comm); xbt_free(displs); @@ -88,7 +87,7 @@ int Coll_reduce_scatter_default::reduce_scatter(void *sendbuf, void *recvbuf, in int Coll_allgather_default::allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,int recvcount, MPI_Datatype recvtype, MPI_Comm comm) { - int system_tag = COLL_TAG_ALLGATHER; + const int system_tag = COLL_TAG_ALLGATHER; MPI_Aint lb = 0; MPI_Aint recvext = 0; MPI_Request *requests; @@ -125,7 +124,7 @@ int Coll_allgather_default::allgather(void *sendbuf, int sendcount, MPI_Datatype int Coll_allgatherv_default::allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm) { - int system_tag = COLL_TAG_ALLGATHERV; + const int system_tag = COLL_TAG_ALLGATHERV; MPI_Aint lb = 0; MPI_Aint recvext = 0; @@ -161,7 +160,7 @@ int Coll_allgatherv_default::allgatherv(void *sendbuf, int sendcount, MPI_Dataty int Coll_scatter_default::scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) { - int system_tag = COLL_TAG_SCATTER; + const int system_tag = COLL_TAG_SCATTER; MPI_Aint lb = 0; MPI_Aint sendext = 0; MPI_Request *requests; @@ -204,7 +203,7 @@ int Coll_scatter_default::scatter(void *sendbuf, int sendcount, MPI_Datatype sen int Coll_reduce_default::reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) { - int system_tag = COLL_TAG_REDUCE; + const int system_tag = COLL_TAG_REDUCE; MPI_Aint lb = 0; MPI_Aint dataext = 0; @@ -292,9 +291,7 @@ int Coll_alltoall_default::alltoall( void *sbuf, int scount, MPI_Datatype sdtype int Coll_alltoallv_default::alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm) { - int system_tag = 889; - int i; - int count; + const int system_tag = 889; MPI_Aint lb = 0; MPI_Aint sendext = 0; MPI_Aint recvext = 0; @@ -312,9 +309,9 @@ int Coll_alltoallv_default::alltoallv(void *sendbuf, int *sendcounts, int *sendd if (err == MPI_SUCCESS && size > 1) { /* Initiate all send/recv to/from others. */ requests = xbt_new(MPI_Request, 2 * (size - 1)); - count = 0; + int count = 0; /* Create all receives that will be posted first */ - for (i = 0; i < size; ++i) { + for (int i = 0; i < size; ++i) { if (i != rank && recvcounts[i] != 0) { requests[count] = Request::irecv_init(static_cast(recvbuf) + recvdisps[i] * recvext, recvcounts[i], recvtype, i, system_tag, comm); @@ -324,7 +321,7 @@ int Coll_alltoallv_default::alltoallv(void *sendbuf, int *sendcounts, int *sendd } } /* Now create all sends */ - for (i = 0; i < size; ++i) { + for (int i = 0; i < size; ++i) { if (i != rank && sendcounts[i] != 0) { requests[count] = Request::isend_init(static_cast(sendbuf) + senddisps[i] * sendext, sendcounts[i], sendtype, i, system_tag, comm); @@ -337,7 +334,7 @@ int Coll_alltoallv_default::alltoallv(void *sendbuf, int *sendcounts, int *sendd Request::startall(count, requests); XBT_DEBUG("<%d> wait for %d requests", rank, count); Request::waitall(count, requests, MPI_STATUS_IGNORE); - for(i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { if(requests[i]!=MPI_REQUEST_NULL) Request::unref(&requests[i]); } diff --git a/src/smpi/colls/smpi_mvapich2_selector.cpp b/src/smpi/colls/smpi_mvapich2_selector.cpp index baa9d961fe..f3c697bf71 100644 --- a/src/smpi/colls/smpi_mvapich2_selector.cpp +++ b/src/smpi/colls/smpi_mvapich2_selector.cpp @@ -96,7 +96,6 @@ int Coll_allgather_mvapich2::allgather(void *sendbuf, int sendcount, MPI_Datatyp int conf_index = 0; int range_threshold = 0; int is_two_level = 0; - int local_size = -1; MPI_Comm shmem_comm; //MPI_Comm *shmem_commptr=NULL; /* Get the size of the communicator */ @@ -111,11 +110,10 @@ int Coll_allgather_mvapich2::allgather(void *sendbuf, int sendcount, MPI_Datatyp comm->init_smp(); } - int i; if (comm->is_uniform()){ shmem_comm = comm->get_intra_comm(); - local_size = shmem_comm->size(); - i = 0; + int local_size = shmem_comm->size(); + int i = 0; if (mv2_allgather_table_ppn_conf[0] == -1) { // Indicating user defined tuning conf_index = 0; @@ -203,11 +201,9 @@ int Coll_gather_mvapich2::gather(void *sendbuf, int range_threshold = 0; int range_intra_threshold = 0; long nbytes = 0; - int comm_size = 0; int recvtype_size, sendtype_size; - int rank = -1; - comm_size = comm->size(); - rank = comm->rank(); + int comm_size = comm->size(); + int rank = comm->rank(); if (rank == root) { recvtype_size=recvtype->size(); @@ -351,8 +347,6 @@ int Coll_allreduce_mvapich2::allreduce(void *sendbuf, MPI_Aint sendtype_size = 0; long nbytes = 0; - int range = 0, range_threshold = 0, range_threshold_intra = 0; - int is_two_level = 0; int is_commutative = 0; MPI_Aint true_lb, true_extent; @@ -364,6 +358,9 @@ int Coll_allreduce_mvapich2::allreduce(void *sendbuf, //is_commutative = op->is_commutative(); { + int range = 0, range_threshold = 0, range_threshold_intra = 0; + int is_two_level = 0; + /* Search for the corresponding system size inside the tuning table */ while ((range < (mv2_size_allreduce_tuning_table - 1)) && (comm_size > mv2_allreduce_thresholds_table[range].numproc)) { @@ -792,8 +789,6 @@ int Coll_reduce_scatter_mvapich2::reduce_scatter(void *sendbuf, void *recvbuf, i int mpi_errno = MPI_SUCCESS; int i = 0, comm_size = comm->size(), total_count = 0, type_size = 0, nbytes = 0; - int range = 0; - int range_threshold = 0; int is_commutative = 0; int* disps = new int[comm_size]; @@ -810,6 +805,8 @@ int Coll_reduce_scatter_mvapich2::reduce_scatter(void *sendbuf, void *recvbuf, i nbytes = total_count * type_size; if (is_commutative) { + int range = 0; + int range_threshold = 0; /* Search for the corresponding system size inside the tuning table */ while ((range < (mv2_size_red_scat_tuning_table - 1)) && @@ -872,11 +869,8 @@ int Coll_scatter_mvapich2::scatter(void *sendbuf, int mpi_errno = MPI_SUCCESS; // int mpi_errno_ret = MPI_SUCCESS; int rank, nbytes, comm_size; - int recvtype_size, sendtype_size; int partial_sub_ok = 0; int conf_index = 0; - int local_size = -1; - int i; MPI_Comm shmem_comm; // MPID_Comm *shmem_commptr=NULL; if(mv2_scatter_thresholds_table==NULL) @@ -891,19 +885,19 @@ int Coll_scatter_mvapich2::scatter(void *sendbuf, rank = comm->rank(); if (rank == root) { - sendtype_size=sendtype->size(); - nbytes = sendcnt * sendtype_size; + int sendtype_size = sendtype->size(); + nbytes = sendcnt * sendtype_size; } else { - recvtype_size=recvtype->size(); - nbytes = recvcnt * recvtype_size; + int recvtype_size = recvtype->size(); + nbytes = recvcnt * recvtype_size; } // check if safe to use partial subscription mode if (comm->is_uniform()) { shmem_comm = comm->get_intra_comm(); - local_size = shmem_comm->size(); - i = 0; + int local_size = shmem_comm->size(); + int i = 0; if (mv2_scatter_table_ppn_conf[0] == -1) { // Indicating user defined tuning conf_index = 0; diff --git a/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp b/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp index 417bb1b58b..e6dfc43462 100644 --- a/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp +++ b/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp @@ -369,10 +369,9 @@ static void init_mv2_allgather_tables_stampede() if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL) simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2; - mv2_allgather_tuning_table** table_ptrs = NULL; mv2_allgather_num_ppn_conf = 3; mv2_allgather_thresholds_table = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf]; - table_ptrs = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf]; + mv2_allgather_tuning_table** table_ptrs = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf]; mv2_size_allgather_tuning_table = new int[mv2_allgather_num_ppn_conf]; mv2_allgather_table_ppn_conf = new int[mv2_allgather_num_ppn_conf]; mv2_allgather_table_ppn_conf[0] = 1; @@ -1516,10 +1515,9 @@ static void init_mv2_scatter_tables_stampede() simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2; int agg_table_sum = 0; - mv2_scatter_tuning_table** table_ptrs = NULL; mv2_scatter_num_ppn_conf = 3; mv2_scatter_thresholds_table = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf]; - table_ptrs = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf]; + mv2_scatter_tuning_table** table_ptrs = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf]; mv2_size_scatter_tuning_table = new int[mv2_scatter_num_ppn_conf]; mv2_scatter_table_ppn_conf = new int[mv2_scatter_num_ppn_conf]; mv2_scatter_table_ppn_conf[0] = 1;