7 /* Test reading and writing zero bytes (set status correctly) */
9 int main( int argc, char *argv[] )
21 MPI_Init( &argc, &argv );
23 comm = MPI_COMM_WORLD;
24 MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh );
25 MPI_Comm_size( comm, &size );
26 MPI_Comm_rank( comm, &rank );
27 buf = (int *)malloc( 10+size * sizeof(int) );
30 /* Write nothing (check status) */
31 memset( &status, 0xff, sizeof(MPI_Status) );
32 MPI_File_write( fh, buf, 0, MPI_INT, &status );
33 MPI_Get_count( &status, MPI_INT, &count );
36 fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr);
40 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
41 for (i=0; i<size; i++) buf[i] = -1;
42 MPI_File_read_ordered( fh, buf, 10, MPI_INT, &status );
45 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
47 memset( &status, 0xff, sizeof(MPI_Status) );
48 MPI_File_read_shared( fh, buf, 1, MPI_INT, &status );
49 MPI_Get_count( &status, MPI_INT, &count );
52 fprintf( stderr, "Count not zero (%d) on read shared\n", count );fflush(stderr);
56 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
58 memset( &status, 0xff, sizeof(MPI_Status) );
59 MPI_File_write_shared( fh, buf, 1, MPI_INT, &status );
62 fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr);
66 MPI_File_close( &fh );