root/ompi/mpi/c/ibcast.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Ibcast

   1 /*
   2  * Copyright (c) 2012      Oak Rigde National Laboratory. All rights reserved.
   3  * Copyright (c) 2015      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/runtime/ompi_spc.h"
  24 
  25 #if OMPI_BUILD_MPI_PROFILING
  26 #if OPAL_HAVE_WEAK_SYMBOLS
  27 #pragma weak MPI_Ibcast = PMPI_Ibcast
  28 #endif
  29 #define MPI_Ibcast PMPI_Ibcast
  30 #endif
  31 
  32 static const char FUNC_NAME[] = "MPI_Ibcast";
  33 
  34 
  35 int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype,
  36               int root, MPI_Comm comm,  MPI_Request *request)
  37 {
  38     int err;
  39 
  40     SPC_RECORD(OMPI_SPC_IBCAST, 1);
  41 
  42     MEMCHECKER(
  43         memchecker_datatype(datatype);
  44         memchecker_call(&opal_memchecker_base_isdefined, buffer, count, datatype);
  45         memchecker_comm(comm);
  46     );
  47 
  48     if (MPI_PARAM_CHECK) {
  49       err = MPI_SUCCESS;
  50       OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  51       if (ompi_comm_invalid(comm)) {
  52           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  53                                      FUNC_NAME);
  54       }
  55 
  56       /* Errors for all ranks */
  57 
  58       OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  59       OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  60       if (MPI_IN_PLACE == buffer) {
  61           return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
  62       }
  63 
  64       /* Errors for intracommunicators */
  65 
  66       if (OMPI_COMM_IS_INTRA(comm)) {
  67         if ((root >= ompi_comm_size(comm)) || (root < 0)) {
  68           return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
  69         }
  70       }
  71 
  72       /* Errors for intercommunicators */
  73 
  74       else {
  75         if (! ((root >= 0 && root < ompi_comm_remote_size(comm)) ||
  76                MPI_ROOT == root || MPI_PROC_NULL == root)) {
  77             return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
  78         }
  79       }
  80     }
  81 
  82     OPAL_CR_ENTER_LIBRARY();
  83 
  84     /* Invoke the coll component to perform the back-end operation */
  85 
  86     err = comm->c_coll->coll_ibcast(buffer, count, datatype, root, comm,
  87                                   request,
  88                                   comm->c_coll->coll_ibcast_module);
  89     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
  90 }

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