1 /* Copyright (c) 2019-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
12 /* Test reading and writing zero bytes (set status correctly) */
14 int main( int argc, char *argv[] )
25 MPI_Init( &argc, &argv );
27 comm = MPI_COMM_WORLD;
28 MPI_File_open( comm, (char*)"/scratch/testfile", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh );
29 MPI_Comm_size( comm, &size );
30 MPI_Comm_rank( comm, &rank );
31 buf = (int *)malloc( sizeof(int) );
34 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
37 memset( &status, 0xff, sizeof(MPI_Status) );
38 MPI_File_write_shared( fh, buf, 1, MPI_INT, &status );
39 MPI_Get_count( &status, MPI_INT, &count );
42 fprintf( stderr, "Count not one (%d) on write\n", count );fflush(stderr);
45 /* Write nothing (check status) */
46 memset( &status, 0xff, sizeof(MPI_Status) );
47 MPI_File_write_shared( fh, buf, 0, MPI_INT, &status );
48 MPI_Get_count( &status, MPI_INT, &count );
51 fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr);
55 MPI_File_seek_shared( fh, 0, MPI_SEEK_SET );
58 memset( &status, 0xff, sizeof(MPI_Status) );
59 MPI_File_read_shared( fh, buf, 1, MPI_INT, &status );
60 MPI_Get_count( &status, MPI_INT, &count );
63 fprintf( stderr, "Count not zero (%d) on read shared\n", count );fflush(stderr);
67 MPI_File_close( &fh );