root/ompi/mpiext/pcollreq/c/bcast_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIX_Bcast_init

   1 /*
   2  * Copyright (c) 2012      Oak Rigde National Laboratory. All rights reserved.
   3  * Copyright (c) 2015-2018 Research Organization for Information Science
   4  *                         and Technology (RIST). All rights reserved.
   5  * Copyright (c) 2017-2018 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 #include "ompi_config.h"
  15 #include <stdio.h>
  16 
  17 #include "ompi/mpi/c/bindings.h"
  18 #include "ompi/runtime/params.h"
  19 #include "ompi/communicator/communicator.h"
  20 #include "ompi/errhandler/errhandler.h"
  21 #include "ompi/datatype/ompi_datatype.h"
  22 #include "ompi/memchecker.h"
  23 #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
  24 #include "ompi/runtime/ompi_spc.h"
  25 
  26 #if OMPI_BUILD_MPI_PROFILING
  27 #if OPAL_HAVE_WEAK_SYMBOLS
  28 #pragma weak MPIX_Bcast_init = PMPIX_Bcast_init
  29 #endif
  30 #define MPIX_Bcast_init PMPIX_Bcast_init
  31 #endif
  32 
  33 static const char FUNC_NAME[] = "MPIX_Bcast_init";
  34 
  35 
  36 int MPIX_Bcast_init(void *buffer, int count, MPI_Datatype datatype,
  37                     int root, MPI_Comm comm, MPI_Info info, MPI_Request *request)
  38 {
  39     int err;
  40 
  41     SPC_RECORD(OMPI_SPC_BCAST_INIT, 1);
  42 
  43     MEMCHECKER(
  44         memchecker_datatype(datatype);
  45         memchecker_call(&opal_memchecker_base_isdefined, buffer, count, datatype);
  46         memchecker_comm(comm);
  47     );
  48 
  49     if (MPI_PARAM_CHECK) {
  50       err = MPI_SUCCESS;
  51       OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  52       if (ompi_comm_invalid(comm)) {
  53           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  54                                      FUNC_NAME);
  55       }
  56 
  57       /* Errors for all ranks */
  58 
  59       OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  60       OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  61       if (MPI_IN_PLACE == buffer) {
  62           return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
  63       }
  64 
  65       /* Errors for intracommunicators */
  66 
  67       if (OMPI_COMM_IS_INTRA(comm)) {
  68         if ((root >= ompi_comm_size(comm)) || (root < 0)) {
  69           return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
  70         }
  71       }
  72 
  73       /* Errors for intercommunicators */
  74 
  75       else {
  76         if (! ((root >= 0 && root < ompi_comm_remote_size(comm)) ||
  77                MPI_ROOT == root || MPI_PROC_NULL == root)) {
  78             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
  79         }
  80       }
  81     }
  82 
  83     OPAL_CR_ENTER_LIBRARY();
  84 
  85     /* Invoke the coll component to perform the back-end operation */
  86 
  87     err = comm->c_coll->coll_bcast_init(buffer, count, datatype, root, comm,
  88                                         info, request,
  89                                         comm->c_coll->coll_bcast_init_module);
  90     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
  91 }

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