root/ompi/mpiext/pcollreq/c/alltoall_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIX_Alltoall_init

   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-2018 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/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
  36 #include "ompi/runtime/ompi_spc.h"
  37 
  38 #if OMPI_BUILD_MPI_PROFILING
  39 #if OPAL_HAVE_WEAK_SYMBOLS
  40 #pragma weak MPIX_Alltoall_init = PMPIX_Alltoall_init
  41 #endif
  42 #define MPIX_Alltoall_init PMPIX_Alltoall_init
  43 #endif
  44 
  45 static const char FUNC_NAME[] = "MPIX_Alltoall_init";
  46 
  47 
  48 int MPIX_Alltoall_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
  49                        void *recvbuf, int recvcount, MPI_Datatype recvtype,
  50                        MPI_Comm comm, MPI_Info info, MPI_Request *request)
  51 {
  52     size_t sendtype_size, recvtype_size;
  53     int err;
  54 
  55     SPC_RECORD(OMPI_SPC_ALLTOALL_INIT, 1);
  56 
  57     MEMCHECKER(
  58         memchecker_comm(comm);
  59         if (MPI_IN_PLACE != sendbuf) {
  60             memchecker_datatype(sendtype);
  61             memchecker_call(&opal_memchecker_base_isdefined, (void *)sendbuf, sendcount, sendtype);
  62         }
  63         memchecker_datatype(recvtype);
  64         memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
  65     );
  66 
  67     if (MPI_PARAM_CHECK) {
  68 
  69         /* Unrooted operation -- same checks for all ranks on both
  70            intracommunicators and intercommunicators */
  71 
  72         err = MPI_SUCCESS;
  73         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  74         if (ompi_comm_invalid(comm)) {
  75             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  76                                           FUNC_NAME);
  77         } else if ((MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
  78                    MPI_IN_PLACE == recvbuf) {
  79             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
  80                                           FUNC_NAME);
  81         } else {
  82             if (MPI_IN_PLACE != sendbuf) {
  83                 OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
  84                 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  85             }
  86             OMPI_CHECK_DATATYPE_FOR_RECV(err, recvtype, recvcount);
  87             OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  88         }
  89 
  90         if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
  91             ompi_datatype_type_size(sendtype, &sendtype_size);
  92             ompi_datatype_type_size(recvtype, &recvtype_size);
  93             if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
  94                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
  95             }
  96         }
  97     }
  98 
  99     OPAL_CR_ENTER_LIBRARY();
 100 
 101     /* Invoke the coll component to perform the back-end operation */
 102     err = comm->c_coll->coll_alltoall_init(sendbuf, sendcount, sendtype,
 103                                            recvbuf, recvcount, recvtype, comm, info,
 104                                            request, comm->c_coll->coll_alltoall_init_module);
 105     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 106 }

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