From: Augustin Degomme Date: Thu, 4 Apr 2013 13:47:52 +0000 (+0200) Subject: remove a redundant algorithm X-Git-Tag: v3_9_90~412^2~50 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/916fc8fe27810528e5b8dbac6d6afae6f2ddf262?ds=sidebyside remove a redundant algorithm Fix bug with macos --- diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index 28ca9d7db4..f4190c4fcb 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -119,7 +119,6 @@ set(SMPI_SRC src/smpi/colls/allgather-NTSLR-NB.c src/smpi/colls/allgather-pair.c src/smpi/colls/allgather-rdb.c - src/smpi/colls/allgather-RDB.c src/smpi/colls/allgather-rhv.c src/smpi/colls/allgather-ring.c src/smpi/colls/allgather-SMP-NTS.c diff --git a/src/smpi/colls/allgather-RDB.c b/src/smpi/colls/allgather-RDB.c deleted file mode 100644 index 9a9a925ba9..0000000000 --- a/src/smpi/colls/allgather-RDB.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "colls.h" - -int -smpi_coll_tuned_allgather_RDB(void *sbuf, int send_count, - MPI_Datatype send_type, - void *rbuf, int recv_count, - MPI_Datatype recv_type, - MPI_Comm comm) -{ - // MPI variables - MPI_Status status; - MPI_Aint send_chunk, recv_chunk; - - // local int variables - int i, j, k, dst, rank, num_procs, send_offset, recv_offset, tree_root; - int dst_tree_root, rank_tree_root, last_recv_count, num_procs_completed; - int offset, tmp_mask; - int tag = 1; - int mask = 1; - int success = 0; - int curr_count = recv_count; - - // local string variables - char *send_ptr = (char *) sbuf; - char *recv_ptr = (char *) rbuf; - - // get size of the communicator, followed by rank - MPI_Comm_size(comm, &num_procs); - MPI_Comm_rank(comm, &rank); - - // get size of single element's type for send buffer and recv buffer - MPI_Type_extent(send_type, &send_chunk); - MPI_Type_extent(recv_type, &recv_chunk); - - // multiply size of each element by number of elements to send or recv - send_chunk *= send_count; - recv_chunk *= recv_count; - - // perform a local copy - MPI_Sendrecv(send_ptr, send_count, send_type, rank, tag, - recv_ptr + rank * recv_chunk, recv_count, recv_type, rank, tag, - comm, &status); - - i = 0; - while (mask < num_procs) { - dst = rank ^ mask; - dst_tree_root = dst >> i; - dst_tree_root <<= i; - rank_tree_root = rank >> i; - rank_tree_root <<= i; - send_offset = rank_tree_root * send_chunk; - recv_offset = dst_tree_root * recv_chunk; - - if (dst < num_procs) { - MPI_Sendrecv(recv_ptr + send_offset, curr_count, send_type, dst, - tag, recv_ptr + recv_offset, mask * recv_count, - recv_type, dst, tag, comm, &status); - MPI_Get_count(&status, recv_type, &last_recv_count); - curr_count += last_recv_count; - } - - if (dst_tree_root + mask > num_procs) { - num_procs_completed = num_procs - rank_tree_root - mask; - /* num_procs_completed is the number of processes in this - subtree that have all the data. Send data to others - in a tree fashion. First find root of current tree - that is being divided into two. k is the number of - least-significant bits in this process's rank that - must be zeroed out to find the rank of the root */ - - j = mask; - k = 0; - while (j) { - j >>= 1; - k++; - } - k--; - - offset = recv_chunk * (rank_tree_root + mask); - tmp_mask = mask >> 1; - - while (tmp_mask) { - dst = rank ^ tmp_mask; - - tree_root = rank >> k; - tree_root <<= k; - - /* send only if this proc has data and destination - doesn't have data. at any step, multiple processes - can send if they have the data */ - if ((dst > rank) - && (rank < tree_root + num_procs_completed) - && (dst >= tree_root + num_procs_completed)) { - MPI_Send(recv_ptr + offset, last_recv_count, recv_type, dst, - tag, comm); - - /* last_recv_cnt was set in the previous - receive. that's the amount of data to be - sent now. */ - } - /* recv only if this proc. doesn't have data and sender - has data */ - else if ((dst < rank) - && (dst < tree_root + num_procs_completed) - && (rank >= tree_root + num_procs_completed)) { - MPI_Recv(recv_ptr + offset, - recv_count * num_procs_completed, - recv_type, dst, tag, comm, &status); - // num_procs_completed is also equal to the no. of processes - // whose data we don't have - MPI_Get_count(&status, recv_type, &last_recv_count); - curr_count += last_recv_count; - } - tmp_mask >>= 1; - k--; - } - } - - mask <<= 1; - i++; - } - - return success; -} diff --git a/src/smpi/colls/colls.h b/src/smpi/colls/colls.h index 242430d129..0b34d05830 100644 --- a/src/smpi/colls/colls.h +++ b/src/smpi/colls/colls.h @@ -42,7 +42,6 @@ COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, NTSLR_NB) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, pair) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, rdb) COLL_sep \ -COLL_APPLY(action, COLL_ALLGATHER_SIG, RDB) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, rhv) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, ring) COLL_sep \ COLL_APPLY(action, COLL_ALLGATHER_SIG, SMP_NTS) COLL_sep \