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( sizeof(int) );
29 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
32 memset( &status, 0xff, sizeof(MPI_Status) );
33 MPI_File_write_shared( fh, buf, 1, MPI_INT, &status );
34 MPI_Get_count( &status, MPI_INT, &count );
37 fprintf( stderr, "Count not one (%d) on write\n", count );fflush(stderr);
40 /* Write nothing (check status) */
41 memset( &status, 0xff, sizeof(MPI_Status) );
42 MPI_File_write_shared( fh, buf, 0, MPI_INT, &status );
43 MPI_Get_count( &status, MPI_INT, &count );
46 fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr);
50 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
53 memset( &status, 0xff, sizeof(MPI_Status) );
54 MPI_File_read_shared( fh, buf, 1, MPI_INT, &status );
55 MPI_Get_count( &status, MPI_INT, &count );
58 fprintf( stderr, "Count not zero (%d) on read shared\n", count );fflush(stderr);
62 MPI_File_close( &fh );