#include #include #include #include #include #include "H5Part.h" /* A simple regression test that shows how you use this API to write and read multi-timestep files of particle data. */ #ifdef PARALLEL_IO int main(int argc,char *argv[]){ int N = 10; int sz=0; double *x,*y,*z; h5_int64_t *id; h5_file_t *file; int i,t,nt,nds; int nprocs,myproc; unsigned int np = 0; MPI_Comm comm=MPI_COMM_WORLD; MPI_Init(&argc,&argv); MPI_Comm_size(comm,&nprocs); MPI_Comm_rank(comm,&myproc); /* parallel file creation */ file=H5PartOpenFileParallel("parttest.h5",H5PART_WRITE,comm); if(!file) { perror("File open failed: exiting!"); exit(0); } for(t=0;t<5;t++){ MPI_Barrier(comm); sz = myproc*N; // proc[0] sz = 10, (next step N=10), sz=10 // proc[1] sz = 20, (next step N=20), sz=40 fprintf(stderr,"proc[%u] sz=%u\n",myproc,(unsigned)sz); x =(double*)malloc(1+sz*sizeof(double)); y =(double*)malloc(1+sz*sizeof(double)); z =(double*)malloc(1+sz*sizeof(double)); id=(h5_int64_t*)malloc(1+sz*sizeof(h5_int64_t)); for(i=0;i