root/ompi/mpi/c/iscan.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Iscan

   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      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/runtime/ompi_spc.h"
  35 
  36 #if OMPI_BUILD_MPI_PROFILING
  37 #if OPAL_HAVE_WEAK_SYMBOLS
  38 #pragma weak MPI_Iscan = PMPI_Iscan
  39 #endif
  40 #define MPI_Iscan PMPI_Iscan
  41 #endif
  42 
  43 static const char FUNC_NAME[] = "MPI_Iscan";
  44 
  45 
  46 int MPI_Iscan(const void *sendbuf, void *recvbuf, int count,
  47               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)
  48 {
  49     int err;
  50 
  51     SPC_RECORD(OMPI_SPC_ISCAN, 1);
  52 
  53     MEMCHECKER(
  54         memchecker_datatype(datatype);
  55         memchecker_comm(comm);
  56         if (MPI_IN_PLACE != sendbuf) {
  57             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  58         } else {
  59             memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
  60         }
  61     );
  62 
  63     if (MPI_PARAM_CHECK) {
  64         char *msg;
  65         err = MPI_SUCCESS;
  66         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  67         if (ompi_comm_invalid(comm)) {
  68             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  69                                           FUNC_NAME);
  70         }
  71 
  72         /* No intercommunicators allowed! (MPI does not define
  73            MPI_SCAN on intercommunicators) */
  74 
  75         else if (OMPI_COMM_IS_INTER(comm)) {
  76           err = MPI_ERR_COMM;
  77         }
  78 
  79         /* Unrooted operation; checks for all ranks */
  80 
  81         else if (MPI_OP_NULL == op || NULL == op) {
  82           err = MPI_ERR_OP;
  83         } else if (MPI_IN_PLACE == recvbuf) {
  84           err = MPI_ERR_ARG;
  85         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  86             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
  87             free(msg);
  88             return ret;
  89         } else {
  90           OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  91         }
  92         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  93     }
  94 
  95     OPAL_CR_ENTER_LIBRARY();
  96 
  97     /* Call the coll component to actually perform the allgather */
  98 
  99     OBJ_RETAIN(op);
 100     err = comm->c_coll->coll_iscan(sendbuf, recvbuf, count,
 101                                   datatype, op, comm,
 102                                   request,
 103                                   comm->c_coll->coll_iscan_module);
 104     OBJ_RELEASE(op);
 105     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 106 }

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