1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
11 #include "mpitestconf.h"
17 static char MTEST_Descrip[] = "Test file_set_view";
21 * access style is explicitly described as modifiable. values include
22 * read_once, read_mostly, write_once, write_mostlye, random
26 int main(int argc, char *argv[])
34 MPI_Info infoin, infoout;
38 MTest_Init(&argc, &argv);
39 comm = MPI_COMM_WORLD;
41 MPI_Comm_rank(comm, &rank);
42 MPI_Info_create(&infoin);
43 MPI_Info_set(infoin, (char *) "access_style", (char *) "write_once,random");
44 MPI_File_open(comm, (char *) "/scratch/testfile", MPI_MODE_RDWR | MPI_MODE_CREATE, infoin, &fh);
46 err = MPI_File_write_ordered(fh, buf, 1, MPI_INT, &status);
52 MPI_Info_set(infoin, (char *) "access_style", (char *) "read_once");
53 err = MPI_File_seek_shared(fh, 0, MPI_SEEK_SET);
59 err = MPI_File_set_info(fh, infoin);
64 MPI_Info_free(&infoin);
67 err = MPI_File_read_ordered(fh, buf, 1, MPI_INT, &status);
72 MPI_Get_count(&status, MPI_INT, &count);
75 printf("Expected to read one int, read %d\n", count);
77 /* if (buf[0] != rank) {*/
79 /* printf("Did not read expected value (%d)\n", buf[0]);*/
82 err = MPI_File_get_info(fh, &infoout);
87 MPI_Info_get(infoout, (char *) "access_style", 1024, value, &flag);
88 /* Note that an implementation is allowed to ignore the set_info,
89 * so we'll accept either the original or the updated version */
94 * printf("Access style hint not saved\n");
98 if (strcmp(value, "read_once") != 0 && strcmp(value, "write_once,random") != 0) {
100 printf("value for access_style unexpected; is %s\n", value);
103 MPI_Info_free(&infoout);
104 err = MPI_File_close(&fh);
107 MTestPrintError(err);
110 MPI_Comm_rank(comm, &rank);
112 err = MPI_File_delete((char *) "/scratch/testfile", MPI_INFO_NULL);
115 MTestPrintError(err);
119 MTest_Finalize(errs);