root/ompi/mpi/c/waitsome.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Waitsome

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2018 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2006-2012 Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2012      Oracle and/or its affiliates.  All rights reserved.
  14  * Copyright (c) 2012      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/request/request.h"
  32 #include "ompi/memchecker.h"
  33 #include "ompi/runtime/ompi_spc.h"
  34 
  35 #if OMPI_BUILD_MPI_PROFILING
  36 #if OPAL_HAVE_WEAK_SYMBOLS
  37 #pragma weak MPI_Waitsome = PMPI_Waitsome
  38 #endif
  39 #define MPI_Waitsome PMPI_Waitsome
  40 #endif
  41 
  42 static const char FUNC_NAME[] = "MPI_Waitsome";
  43 
  44 
  45 int MPI_Waitsome(int incount, MPI_Request requests[],
  46                  int *outcount, int indices[],
  47                  MPI_Status statuses[])
  48 {
  49     SPC_RECORD(OMPI_SPC_WAITSOME, 1);
  50 
  51     MEMCHECKER(
  52         int j;
  53         for (j = 0; j < incount; j++){
  54             memchecker_request(&requests[j]);
  55         }
  56     );
  57 
  58     if ( MPI_PARAM_CHECK ) {
  59         int indx, rc = MPI_SUCCESS;
  60         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  61         if ((NULL == requests) && (0 != incount)) {
  62             rc = MPI_ERR_REQUEST;
  63         } else {
  64             for (indx = 0; indx < incount; ++indx) {
  65                 if (NULL == requests[indx]) {
  66                     rc = MPI_ERR_REQUEST;
  67                     break;
  68                 }
  69             }
  70         }
  71         if (((NULL == outcount || NULL == indices) && incount > 0) ||
  72             incount < 0) {
  73             rc = MPI_ERR_ARG;
  74         }
  75         OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
  76     }
  77 
  78     if (OPAL_UNLIKELY(0 == incount)) {
  79         *outcount = MPI_UNDEFINED;
  80         return MPI_SUCCESS;
  81     }
  82 
  83     OPAL_CR_ENTER_LIBRARY();
  84 
  85     if (OMPI_SUCCESS == ompi_request_wait_some( incount, requests,
  86                                                 outcount, indices, statuses )) {
  87         OPAL_CR_EXIT_LIBRARY();
  88         return MPI_SUCCESS;
  89     }
  90 
  91     if (MPI_SUCCESS !=
  92         ompi_errhandler_request_invoke(incount, requests, FUNC_NAME)) {
  93         OPAL_CR_EXIT_LIBRARY();
  94         return MPI_ERR_IN_STATUS;
  95     }
  96 
  97     OPAL_CR_EXIT_LIBRARY();
  98     return MPI_SUCCESS;
  99 }

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