X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2703e1ee2a79e9fc7c86ebb122caa515ecf24d14..cd9affe6152d6bbec19a72ea6fe26ab9407b51b7:/src/smpi/colls/allgather-pair.c diff --git a/src/smpi/colls/allgather-pair.c b/src/smpi/colls/allgather-pair.c index a113ea9541..46cde2dea5 100644 --- a/src/smpi/colls/allgather-pair.c +++ b/src/smpi/colls/allgather-pair.c @@ -1,4 +1,10 @@ -#include "colls.h" +/* Copyright (c) 2013-2014. 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 "colls_private.h" /***************************************************************************** @@ -67,24 +73,28 @@ smpi_coll_tuned_allgather_pair(void *send_buff, int send_count, MPI_Aint extent; int i, src, dst, rank, num_procs; - int tag = 1; + int tag = COLL_TAG_ALLGATHER; MPI_Status status; char *send_ptr = (char *) send_buff; char *recv_ptr = (char *) recv_buff; - MPI_Comm_rank(comm, &rank); - MPI_Comm_size(comm, &num_procs); - MPI_Type_extent(send_type, &extent); + rank = smpi_comm_rank(comm); + num_procs = smpi_comm_size(comm); + + if((num_procs&(num_procs-1))) + THROWF(arg_error,0, "allgather pair algorithm can't be used with non power of two number of processes ! "); + + extent = smpi_datatype_get_extent(send_type); // local send/recv - MPI_Sendrecv(send_ptr, send_count, send_type, rank, tag, + smpi_mpi_sendrecv(send_ptr, send_count, send_type, rank, tag, recv_ptr + rank * recv_count * extent, recv_count, recv_type, rank, tag, comm, &status); for (i = 1; i < num_procs; i++) { src = dst = rank ^ i; - MPI_Sendrecv(send_ptr, send_count, send_type, dst, tag, + smpi_mpi_sendrecv(send_ptr, send_count, send_type, dst, tag, recv_ptr + src * recv_count * extent, recv_count, recv_type, src, tag, comm, &status); }