root/ompi/mpi/c/ialltoall.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Ialltoall

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2018 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2012      Oak Ridge National Laboratory. All rights reserved.
  15  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  16  *                         reserved.
  17  * Copyright (c) 2014-2016 Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 
  26 #include "ompi_config.h"
  27 #include <stdio.h>
  28 
  29 #include "ompi/mpi/c/bindings.h"
  30 #include "ompi/runtime/params.h"
  31 #include "ompi/communicator/communicator.h"
  32 #include "ompi/errhandler/errhandler.h"
  33 #include "ompi/datatype/ompi_datatype.h"
  34 #include "ompi/memchecker.h"
  35 #include "ompi/runtime/ompi_spc.h"
  36 
  37 #if OMPI_BUILD_MPI_PROFILING
  38 #if OPAL_HAVE_WEAK_SYMBOLS
  39 #pragma weak MPI_Ialltoall = PMPI_Ialltoall
  40 #endif
  41 #define MPI_Ialltoall PMPI_Ialltoall
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPI_Ialltoall";
  45 
  46 
  47 int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
  48                   void *recvbuf, int recvcount, MPI_Datatype recvtype,
  49                   MPI_Comm comm,  MPI_Request *request)
  50 {
  51     size_t sendtype_size, recvtype_size;
  52     int err;
  53 
  54     SPC_RECORD(OMPI_SPC_IALLTOALL, 1);
  55 
  56     MEMCHECKER(
  57         memchecker_comm(comm);
  58         if (MPI_IN_PLACE != sendbuf) {
  59             memchecker_datatype(sendtype);
  60             memchecker_call(&opal_memchecker_base_isdefined, (void *)sendbuf, sendcount, sendtype);
  61         }
  62         memchecker_datatype(recvtype);
  63         memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
  64     );
  65 
  66     if (MPI_PARAM_CHECK) {
  67 
  68         /* Unrooted operation -- same checks for all ranks on both
  69            intracommunicators and intercommunicators */
  70 
  71         err = MPI_SUCCESS;
  72         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  73         if (ompi_comm_invalid(comm)) {
  74             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  75                                           FUNC_NAME);
  76         } else if ((MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
  77                    MPI_IN_PLACE == recvbuf) {
  78             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  79                                           FUNC_NAME);
  80         } else {
  81             if (MPI_IN_PLACE != sendbuf) {
  82                 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
  83                 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  84             }
  85             OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcount);
  86             OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  87         }
  88 
  89         if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
  90             ompi_datatype_type_size(sendtype, &sendtype_size);
  91             ompi_datatype_type_size(recvtype, &recvtype_size);
  92             if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
  93                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
  94             }
  95         }
  96     }
  97 
  98     OPAL_CR_ENTER_LIBRARY();
  99 
 100     /* Invoke the coll component to perform the back-end operation */
 101     err = comm->c_coll->coll_ialltoall(sendbuf, sendcount, sendtype,
 102                                       recvbuf, recvcount, recvtype, comm,
 103                                       request, comm->c_coll->coll_ialltoall_module);
 104     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 105 }

/* [<][>][^][v][top][bottom][index][help] */