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

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

DEFINITIONS

This source file includes following definitions.
  1. MPIO_Testall

   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_Testall = PMPIO_Testall
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPIO_Testall MPIO_Testall
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPIO_Testall as PMPIO_Testall
  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_Testall(int count, MPIO_Request requests[], int *flag,
  32                  MPI_Status statuses[])
  33 {
  34     int done, i, err; 
  35     MPID_THREADPRIV_DECL;
  36 
  37     ROMIO_THREAD_CS_ENTER();
  38     if (count == 1)  {
  39             err = MPIO_Test( requests, flag, statuses );
  40             goto fn_exit;
  41     }
  42 
  43     /* This is actually very difficult to do.  We can't use MPIO_Test, 
  44        since we must change the requests only if *ALL* requests are complete
  45     */
  46     /* FIXME: THIS IS NOT CORRECT (see above).  But most applications won't 
  47      care */
  48     done = 1;
  49     for (i=0; i<count; i++) {
  50       if (requests[i] != MPIO_REQUEST_NULL) {
  51         err = MPIO_Test( &requests[i], flag, &statuses[i] );
  52         if (!*flag) done = 0;
  53         if (err) goto fn_exit;
  54       }
  55       else {
  56 #ifdef MPICH
  57           /* need to set empty status */
  58           if (statuses != MPI_STATUSES_IGNORE) {
  59               statuses[i].MPI_SOURCE = MPI_ANY_SOURCE;
  60               statuses[i].MPI_TAG    = MPI_ANY_TAG;
  61               MPIR_STATUS_SET_COUNT(statuses[i], 0);
  62               MPIR_STATUS_SET_CANCEL_BIT(statuses[i], 0);
  63           }
  64 #else
  65           ;
  66 #endif
  67       }
  68     }
  69     
  70     *flag = done;
  71 
  72     err = MPI_SUCCESS;
  73 fn_exit:
  74     ROMIO_THREAD_CS_EXIT();
  75     return err;
  76 }
  77 

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