1 /* Asynchronous parts of the basic collective algorithms, meant to be used both for the naive default implementation, but also for non blocking collectives */
3 /* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "colls_private.hpp"
9 #include "src/smpi/include/smpi_actor.hpp"
15 int Colls::Ibarrier(MPI_Comm comm, MPI_Request* request)
18 int size = comm->size();
19 int rank = comm->rank();
20 MPI_Request* requests;
21 (*request) = new Request( nullptr, 0, MPI_BYTE,
22 rank,rank, COLL_TAG_BARRIER, comm, MPI_REQ_NON_PERSISTENT);
25 requests = new MPI_Request[2];
26 requests[0] = Request::isend (nullptr, 0, MPI_BYTE, 0,
29 requests[1] = Request::irecv (nullptr, 0, MPI_BYTE, 0,
32 (*request)->set_nbc_requests(requests, 2);
35 requests = new MPI_Request[(size-1)*2];
36 for (i = 1; i < 2*size-1; i+=2) {
37 requests[i-1] = Request::irecv(nullptr, 0, MPI_BYTE, MPI_ANY_SOURCE,
38 COLL_TAG_BARRIER, comm
40 requests[i] = Request::isend(nullptr, 0, MPI_BYTE, (i+1)/2,
45 (*request)->set_nbc_requests(requests, 2*(size-1));