root/ompi/mpiext/pcollreq/c/neighbor_allgather_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIX_Neighbor_allgather_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-2017 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 Rigde National Laboratory. All rights reserved.
  15  * Copyright (c) 2013      Los Alamos National Security, LLC. All rights
  16  *                         reserved.
  17  * Copyright (c) 2015-2018 Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * Copyright (c) 2017      IBM Corporation.  All rights reserved.
  20  * $COPYRIGHT$
  21  *
  22  * Additional copyrights may follow
  23  *
  24  * $HEADER$
  25  */
  26 
  27 #include "ompi_config.h"
  28 #include <stdio.h>
  29 
  30 #include "ompi/mpi/c/bindings.h"
  31 #include "ompi/runtime/params.h"
  32 #include "ompi/communicator/communicator.h"
  33 #include "ompi/errhandler/errhandler.h"
  34 #include "ompi/datatype/ompi_datatype.h"
  35 #include "ompi/memchecker.h"
  36 #include "ompi/mca/topo/topo.h"
  37 #include "ompi/mca/topo/base/base.h"
  38 #include "ompi/runtime/ompi_spc.h"
  39 #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
  40 
  41 #if OMPI_BUILD_MPI_PROFILING
  42 #if OPAL_HAVE_WEAK_SYMBOLS
  43 #pragma weak MPIX_Neighbor_allgather_init = PMPIX_Neighbor_allgather_init
  44 #endif
  45 #define MPIX_Neighbor_allgather_init PMPIX_Neighbor_allgather_init
  46 #endif
  47 
  48 static const char FUNC_NAME[] = "MPIX_Neighbor_allgather_init";
  49 
  50 
  51 int MPIX_Neighbor_allgather_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
  52                             void *recvbuf, int recvcount, MPI_Datatype recvtype,
  53                             MPI_Comm comm, MPI_Info info, MPI_Request *request)
  54 {
  55     int err;
  56 
  57     SPC_RECORD(OMPI_SPC_NEIGHBOR_ALLGATHER_INIT, 1);
  58 
  59     MEMCHECKER(
  60         int rank;
  61         ptrdiff_t ext;
  62 
  63         rank = ompi_comm_rank(comm);
  64         ompi_datatype_type_extent(recvtype, &ext);
  65 
  66         memchecker_datatype(recvtype);
  67         memchecker_comm(comm);
  68         /* check whether the actual send buffer is defined. */
  69         if (MPI_IN_PLACE != sendbuf) {
  70             memchecker_datatype(sendtype);
  71             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, sendcount, sendtype);
  72         }
  73         /* check whether the receive buffer is addressable. */
  74         memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, recvcount, recvtype);
  75     );
  76 
  77     if (MPI_PARAM_CHECK) {
  78 
  79         /* Unrooted operation -- same checks for all ranks on both
  80            intracommunicators and intercommunicators */
  81 
  82         err = MPI_SUCCESS;
  83         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  84         if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
  85           OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
  86         } else if (! OMPI_COMM_IS_TOPO(comm)) {
  87           OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME);
  88         } else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) {
  89           err = MPI_ERR_TYPE;
  90         } else if (recvcount < 0) {
  91           err = MPI_ERR_COUNT;
  92         } else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
  93           return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
  94         } else {
  95             OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
  96         }
  97         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  98 
  99         if( OMPI_COMM_IS_CART(comm) ) {
 100             const mca_topo_base_comm_cart_2_2_0_t *cart = comm->c_topo->mtc.cart;
 101             if( 0 > cart->ndims ) {
 102                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
 103             }
 104         }
 105         else if( OMPI_COMM_IS_GRAPH(comm) ) {
 106             int degree;
 107             mca_topo_base_graph_neighbors_count(comm, ompi_comm_rank(comm), &degree);
 108             if( 0 > degree ) {
 109                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
 110             }
 111         }
 112         else if( OMPI_COMM_IS_DIST_GRAPH(comm) ) {
 113             const mca_topo_base_comm_dist_graph_2_2_0_t *dist_graph = comm->c_topo->mtc.dist_graph;
 114             int indegree  = dist_graph->indegree;
 115             int outdegree = dist_graph->outdegree;
 116             if( indegree <  0 || outdegree <  0 ) {
 117                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
 118             }
 119         }
 120     }
 121 
 122     OPAL_CR_ENTER_LIBRARY();
 123 
 124     /* Invoke the coll component to perform the back-end operation */
 125     err = comm->c_coll->coll_neighbor_allgather_init(sendbuf, sendcount, sendtype, recvbuf,
 126                                                      recvcount, recvtype, comm, info, request,
 127                                                      comm->c_coll->coll_neighbor_allgather_init_module);
 128 
 129     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 130 }

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