root/ompi/mpi/c/testall.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Testall

   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      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_Testall = PMPI_Testall
  38 #endif
  39 #define MPI_Testall PMPI_Testall
  40 #endif
  41 
  42 static const char FUNC_NAME[] = "MPI_Testall";
  43 
  44 
  45 int MPI_Testall(int count, MPI_Request requests[], int *flag,
  46                 MPI_Status statuses[])
  47 {
  48     SPC_RECORD(OMPI_SPC_TESTALL, 1);
  49 
  50     MEMCHECKER(
  51         int j;
  52         for (j = 0; j < count; j++){
  53             memchecker_request(&requests[j]);
  54         }
  55     );
  56 
  57     if ( MPI_PARAM_CHECK ) {
  58         int i, rc = MPI_SUCCESS;
  59         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  60         if( (NULL == requests) && (0 != count) ) {
  61             rc = MPI_ERR_REQUEST;
  62         } else {
  63             for (i = 0; i < count; i++) {
  64                 if (NULL == requests[i]) {
  65                     rc = MPI_ERR_REQUEST;
  66                     break;
  67                 }
  68             }
  69         }
  70         if ((NULL == flag) || (count < 0)) {
  71             rc = MPI_ERR_ARG;
  72         }
  73         OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
  74     }
  75 
  76     if (OPAL_UNLIKELY(0 == count)) {
  77         *flag = true;
  78         return MPI_SUCCESS;
  79     }
  80 
  81     OPAL_CR_ENTER_LIBRARY();
  82 
  83     if (OMPI_SUCCESS == ompi_request_test_all(count, requests, flag,
  84                                               statuses)) {
  85         OPAL_CR_EXIT_LIBRARY();
  86         return MPI_SUCCESS;
  87     }
  88 
  89     if (MPI_SUCCESS !=
  90         ompi_errhandler_request_invoke(count, requests, FUNC_NAME)) {
  91         OPAL_CR_EXIT_LIBRARY();
  92         return MPI_ERR_IN_STATUS;
  93     }
  94 
  95     OPAL_CR_EXIT_LIBRARY();
  96     return MPI_SUCCESS;
  97 }

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