7 /* Test reading and writing zero bytes (set status correctly) */
9 int main( int argc, char *argv[] )
20 MPI_Init( &argc, &argv );
22 comm = MPI_COMM_WORLD;
23 MPI_File_open( comm, (char*)"/scratch/testfile", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh );
24 MPI_Comm_size( comm, &size );
25 MPI_Comm_rank( comm, &rank );
26 buf = (int *)malloc( 10* sizeof(int) );
30 MPI_File_write_ordered( fh, buf, 10, MPI_INT, &status );
31 MPI_Get_count( &status, MPI_INT, &count );
34 fprintf( stderr, "Wrong count (%d) on write-ordered\n", count );fflush(stderr);
37 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
38 for (int i = 0; i < size; i++)
40 MPI_File_read_ordered( fh, buf, 10, MPI_INT, &status );
43 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
46 MPI_File_close( &fh );