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 MPI_File_sync = PMPI_File_sync
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_File_sync MPI_File_sync
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_File_sync as PMPI_File_sync
00018
00019 #endif
00020
00021
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 int MPI_File_sync(MPI_File mpi_fh)
00036 {
00037 int error_code;
00038 ADIO_File fh;
00039 static char myname[] = "MPI_FILE_SYNC";
00040 #ifdef MPI_hpux
00041 int fl_xmpi;
00042
00043 HPMP_IO_START(fl_xmpi, BLKMPIFILESYNC, TRDTBLOCK, fh,
00044 MPI_DATATYPE_NULL, -1);
00045 #endif
00046 MPIU_THREAD_CS_ENTER(ALLFUNC,);
00047
00048 fh = MPIO_File_resolve(mpi_fh);
00049
00050 if ((fh <= (MPI_File) 0) || ((fh)->cookie != ADIOI_FILE_COOKIE))
00051 {
00052 error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00053 myname, __LINE__, MPI_ERR_ARG,
00054 "**iobadfh", 0);
00055 error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);
00056 goto fn_exit;
00057 }
00058
00059
00060 ADIOI_TEST_DEFERRED(fh, "MPI_File_sync", &error_code);
00061
00062 ADIO_Flush(fh, &error_code);
00063
00064 if (error_code != MPI_SUCCESS)
00065 error_code = MPIO_Err_return_file(fh, error_code);
00066
00067
00068 #ifdef MPI_hpux
00069 HPMP_IO_END(fl_xmpi, fh, MPI_DATATYPE_NULL, -1);
00070 #endif
00071
00072 fn_exit:
00073 MPIU_THREAD_CS_EXIT(ALLFUNC,);
00074 return error_code;
00075 }