1 #include <mpi.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <unistd.h> 5 #include "phIO.h" 6 7 int main(int argc, char* argv[]) { 8 MPI_Init(&argc,&argv); 9 int rank; 10 MPI_Comm_rank(MPI_COMM_WORLD, &rank); 11 if( argc != 2 ) { 12 fprintf(stderr, "Usage: %s <numSyncFiles>\n",argv[0]); 13 MPI_Finalize(); 14 return 1; 15 } 16 const char* iotype = "binary"; 17 int numberOfNodes[2] = {0,0}; 18 int nfiles[2] = {atoi(argv[1]), 1}; 19 const char* dir[2] = {"4-procs_case-SyncIO-2", "4-procs_case-Posix"}; 20 const char* filename[2] = {"geombc-dat.", "geombc.dat."}; 21 phio_fp file; 22 int one = 1; 23 for(int i=0; i<2; i++) { 24 chdir(dir[i]); 25 MPI_Barrier(MPI_COMM_WORLD); 26 phio_openfile_read(filename[i], &(nfiles[i]), &file); 27 phio_readheader(file, "number of nodes", &(numberOfNodes[i]), 28 &one, "integer", iotype); 29 phio_closefile_read(file); 30 chdir(".."); 31 MPI_Barrier(MPI_COMM_WORLD); 32 } 33 int match = (numberOfNodes[0] == numberOfNodes[1]); 34 if(!rank && match) 35 fprintf(stderr, "number of nodes match!\n"); 36 if(!rank && !match) 37 fprintf(stderr, "number of nodes don't match... :(\n"); 38 MPI_Finalize(); 39 return !match; 40 } 41