root/ompi/mpiext/pcollreq/c/scan_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIX_Scan_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) 2006      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  15  *                         reserved.
  16  * Copyright (c) 2015-2018 Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 #include "ompi_config.h"
  25 #include <stdio.h>
  26 
  27 #include "ompi/mpi/c/bindings.h"
  28 #include "ompi/runtime/params.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/errhandler/errhandler.h"
  31 #include "ompi/datatype/ompi_datatype.h"
  32 #include "ompi/op/op.h"
  33 #include "ompi/memchecker.h"
  34 #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
  35 #include "ompi/runtime/ompi_spc.h"
  36 
  37 #if OMPI_BUILD_MPI_PROFILING
  38 #if OPAL_HAVE_WEAK_SYMBOLS
  39 #pragma weak MPIX_Scan_init = PMPIX_Scan_init
  40 #endif
  41 #define MPIX_Scan_init PMPIX_Scan_init
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPIX_Scan_init";
  45 
  46 
  47 int MPIX_Scan_init(const void *sendbuf, void *recvbuf, int count,
  48                    MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
  49                    MPI_Info info, MPI_Request *request)
  50 {
  51     int err;
  52 
  53     SPC_RECORD(OMPI_SPC_SCAN_INIT, 1);
  54 
  55     MEMCHECKER(
  56         memchecker_datatype(datatype);
  57         memchecker_comm(comm);
  58         if (MPI_IN_PLACE != sendbuf) {
  59             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  60         } else {
  61             memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
  62         }
  63     );
  64 
  65     if (MPI_PARAM_CHECK) {
  66         char *msg;
  67         err = MPI_SUCCESS;
  68         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  69         if (ompi_comm_invalid(comm)) {
  70             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  71                                           FUNC_NAME);
  72         }
  73 
  74         /* No intercommunicators allowed! (MPI does not define
  75            MPI_SCAN on intercommunicators) */
  76 
  77         else if (OMPI_COMM_IS_INTER(comm)) {
  78           err = MPI_ERR_COMM;
  79         }
  80 
  81         /* Unrooted operation; checks for all ranks */
  82 
  83         else if (MPI_OP_NULL == op || NULL == op) {
  84           err = MPI_ERR_OP;
  85         } else if (MPI_IN_PLACE == recvbuf) {
  86           err = MPI_ERR_ARG;
  87         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  88             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
  89             free(msg);
  90             return ret;
  91         } else {
  92           OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  93         }
  94         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  95     }
  96 
  97     OPAL_CR_ENTER_LIBRARY();
  98 
  99     /* Call the coll component to actually perform the allgather */
 100 
 101     OBJ_RETAIN(op);
 102     err = comm->c_coll->coll_scan_init(sendbuf, recvbuf, count,
 103                                        datatype, op, comm,
 104                                        info, request,
 105                                        comm->c_coll->coll_scan_init_module);
 106     OBJ_RELEASE(op);
 107     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 108 }

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