root/ompi/mca/io/romio321/romio/mpi-io/iotestsome.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIO_Testsome

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2003 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPIO_Testsome = PMPIO_Testsome
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPIO_Testsome MPIO_Testsome
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPIO_Testsome as PMPIO_Testsome
  18 /* end of weak pragmas */
  19 #endif
  20 
  21 /* Include mapping from MPI->PMPI */
  22 #define MPIO_BUILD_PROFILING
  23 #include "mpioprof.h"
  24 #endif
  25 
  26 /*
  27   This is a temporary function until we switch to using MPI-2's generalized
  28   requests.
  29 */
  30 
  31 int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount,
  32                   int indices[], MPI_Status *statuses)
  33 {
  34     int i, err; 
  35     int flag;
  36     MPID_THREADPRIV_DECL;
  37 
  38     ROMIO_THREAD_CS_ENTER();
  39 
  40     if (count == 1) {
  41         err = MPIO_Test( requests, &flag, statuses );
  42         if (!err) {
  43             if (flag) {
  44                 indices[0] = 0;
  45                 *outcount = 1;
  46             }
  47             else {
  48                 *outcount = 0;
  49             }
  50         }
  51         goto fn_exit;
  52     }
  53 
  54     /* Check for no active requests */
  55     for (i=0; i<count; i++) {
  56         if (requests[i] != MPIO_REQUEST_NULL) {
  57             break;
  58         }
  59     }
  60     if (i == count) {
  61         *outcount = MPI_UNDEFINED;
  62         err = MPI_SUCCESS;
  63         goto fn_exit;
  64     }
  65 
  66     err = MPI_SUCCESS;
  67     *outcount = 0;
  68     for (i=0; i<count; i++) {
  69       if (requests[i] != MPIO_REQUEST_NULL) {
  70         err = MPIO_Test( &requests[i], &flag, statuses );
  71         if (flag) {
  72           if (!err) {
  73               indices[0] = i;
  74               indices++;
  75               statuses++;
  76               *outcount = *outcount + 1;
  77           }
  78         }
  79       }
  80     }
  81 
  82 fn_exit:
  83 
  84     ROMIO_THREAD_CS_EXIT();
  85     return err;
  86 }

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