From 5e58d47b984b34f2527da3b538dde1f275ee2d3a Mon Sep 17 00:00:00 2001 From: Leon Arber Date: Thu, 8 Dec 2005 14:14:28 -0500 Subject: [svn-r11772] Purpose: Feature Description: Added posix compliance tests. Solution: These tests do increasingly complicated sets of writes followed by reads. POSIX standards say that any read that can be proven to occur after a write must include the data in that write. These tests attempt to verify whether the underlying filesystem and i/o layer provide such guarantees. Platforms tested: copper, colonelk, red storm Misc. update: --- testpar/t_posix_compliant.c | 847 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 847 insertions(+) create mode 100644 testpar/t_posix_compliant.c diff --git a/testpar/t_posix_compliant.c b/testpar/t_posix_compliant.c new file mode 100644 index 0000000..d077680 --- /dev/null +++ b/testpar/t_posix_compliant.c @@ -0,0 +1,847 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* A series of tests for posix compliance + * + * These tests do increasingly complicated sets of writes followed by reads. + * POSIX standards say that any read that can be proven to occur after a write + * must include the data in that write. These tests attempt to verify whether the + * underlying filesystem and i/o layer provide such guarantees. + * + * There are two sets of tests, one which uses POSIX i/o (fread, fwrite) and one which + * uses MPI I/O (MPI_File_read, MPI_File_write). Each set has multiple sub-tests, which + * test varying patters of writes and reads. + * + * Leon Arber + * larber@ncsa.uiuc.edu +*/ + +#include +#include +#include +#include +#include + + +char* testfile = NULL; +int err_flag = 0; +int max_err_print = 5; + +#define CHECK_SUCCESS(res) \ +{ \ + char err_got[MPI_MAX_ERROR_STRING]; \ + int err_len; \ + if(res != MPI_SUCCESS) \ + { \ + MPI_Error_string(res, err_got, &err_len); \ + fprintf(stderr, "Line %d, Error: %s\n", __LINE__, err_got); \ + MPI_Abort(MPI_COMM_WORLD, -2); \ + } \ +} + +#define PRINT_RESULT() \ +{ \ + int err_result; \ + MPI_Reduce(&err_flag, &err_result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD); \ + if( (rank == 0) && (err_result == 0) ) \ + printf("PASSED\n"); \ + fflush(stdout); \ + fflush(stderr); \ + err_flag = 0; \ +} + +void vrfy_elements(int* a, int* b, int size, int rank); +int find_writesize(int rank, int numprocs, int write_size); + + +/* All writes are to non-overlapping locations in the file + * Then, each task reads another tasks' data + * */ + +int allwrite_allread_blocks(int numprocs, int rank, int write_size) +{ + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i; + MPI_Info hints_to_test = MPI_INFO_NULL; + MPI_Offset offset = rank*write_size*sizeof(int); + MPI_Status Status; + int* writebuf = (int*)malloc(write_size*sizeof(int)); + int* readbuf = (int*)malloc (write_size*sizeof(int)); + + for(i=0; i