00001
00002
00003
00004
00005
00006
00007 #include "adio.h"
00008
00009
00010
00011
00012 void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
00013
00014 void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
00015 {
00016 ADIO_Status status;
00017 MPI_Comm dupcommself;
00018
00019 #ifdef ROMIO_NFS
00020 if (fd->file_system == ADIO_NFS) {
00021 ADIOI_NFS_Set_shared_fp(fd, offset, error_code);
00022 return;
00023 }
00024 #endif
00025
00026 #ifdef ROMIO_BGL
00027
00028 if (fd->file_system == ADIO_BGL) {
00029 ADIOI_BGL_Set_shared_fp(fd, offset, error_code);
00030 return;
00031 }
00032 #endif
00033
00034 if (fd->shared_fp_fd == ADIO_FILE_NULL) {
00035 MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
00036 fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
00037 fd->shared_fp_fname,
00038 fd->file_system,
00039 fd->fns,
00040 ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
00041 0, MPI_BYTE, MPI_BYTE,
00042 MPI_INFO_NULL,
00043 ADIO_PERM_NULL, error_code);
00044 }
00045
00046 if (*error_code != MPI_SUCCESS) return;
00047
00048 ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00049 ADIO_WriteContig(fd->shared_fp_fd, &offset, sizeof(ADIO_Offset),
00050 MPI_BYTE, ADIO_EXPLICIT_OFFSET, 0, &status, error_code);
00051 ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00052 }
00053