00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pvfs.h"
00009
00010 void ADIOI_PVFS_Flush(ADIO_File fd, int *error_code)
00011 {
00012 int err, rank, dummy=0, dummy_in=0;
00013 static char myname[] = "ADIOI_PVFS_FLUSH";
00014
00015
00016
00017
00018
00019
00020
00021 MPI_Comm_rank(fd->comm, &rank);
00022 MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM,
00023 fd->hints->ranklist[0], fd->comm);
00024 if (rank == fd->hints->ranklist[0]) {
00025 err = pvfs_fsync(fd->fd_sys);
00026 }
00027 MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
00028
00029 if (err == -1) {
00030 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00031 myname, __LINE__, MPI_ERR_IO,
00032 "**io",
00033 "**io %s", strerror(errno));
00034 }
00035 else *error_code = MPI_SUCCESS;
00036 }