00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "mpioimpl.h"
00009 
00010 #ifdef HAVE_WEAK_SYMBOLS
00011 
00012 #if defined(HAVE_PRAGMA_WEAK)
00013 #pragma weak MPIO_Waitall = PMPIO_Waitall
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPIO_Waitall MPIO_Waitall
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPIO_Waitall as PMPIO_Waitall
00018 
00019 #endif
00020 
00021 
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025 
00026 
00027 
00028 
00029 
00030 
00031 int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] )
00032 {
00033     int notdone, i, flag, err; 
00034     MPIU_THREADPRIV_DECL;
00035 
00036     MPIU_THREAD_CS_ENTER(ALLFUNC,);
00037 
00038     if (count == 1)  {
00039         err = MPIO_Wait(requests, statuses);
00040         goto fn_exit;
00041     }
00042     
00043     
00044     do {
00045     notdone = 0;
00046     for (i=0; i<count; i++) {
00047         if (requests[i] != MPIO_REQUEST_NULL) {
00048         err = MPIO_Test( &requests[i], &flag, &statuses[i] );
00049         if (!flag) notdone = 1;
00050         if (err) goto fn_exit;
00051         }
00052         else {
00053 #ifdef MPICH2
00054         
00055         if (statuses != MPI_STATUSES_IGNORE) {
00056             statuses[i].MPI_SOURCE = MPI_ANY_SOURCE;
00057             statuses[i].MPI_TAG    = MPI_ANY_TAG;
00058             statuses[i].count      = 0;
00059             statuses[i].cancelled  = 0;
00060         }
00061 #else
00062         ;
00063 #endif
00064         }
00065     }
00066     } while (notdone);
00067 
00068     err = MPI_SUCCESS;
00069 fn_exit:
00070 
00071     MPIU_THREAD_CS_EXIT(ALLFUNC,);
00072     return err;
00073 }
00074