7 /* Test reading and writing zero bytes (set status correctly) */
9 int main( int argc, char *argv[] )
12 int size, rank, i, *buf, count;
17 MPI_Init( &argc, &argv );
19 comm = MPI_COMM_WORLD;
20 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 );
21 MPI_Comm_size( comm, &size );
22 MPI_Comm_rank( comm, &rank );
23 buf = (int *)malloc( size * sizeof(int) );
27 MPI_File_write_at( fh, sizeof(int)*rank, buf, 1, MPI_INT, &status );
28 MPI_Get_count( &status, MPI_INT, &count );
31 fprintf( stderr, "Wrong count (%d) on write_at\n", count );fflush(stderr);
34 /* Read nothing (check status) */
35 memset( &status, 0xff, sizeof(MPI_Status) );
36 MPI_File_read_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status );
37 MPI_Get_count( &status, MPI_INT, &count );
40 fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr);
43 /* Write nothing (check status) */
44 memset( &status, 0xff, sizeof(MPI_Status) );
45 MPI_File_write_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status );
48 fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr);
53 for (i=0; i<size; i++) buf[i] = -1;
54 MPI_File_read_at( fh, sizeof(int)*rank, buf, 1, MPI_INT, &status );
55 // if (buf[0] != rank) {
57 // fprintf( stderr, "%d: buf = %d\n", rank, buf[0] );fflush(stderr);
61 MPI_File_close( &fh );