From 4541d58a9c8cbb321c9d5dbe292801592c33127c Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 13 Feb 2008 15:09:05 +0000 Subject: [PATCH] added --- .gitattributes | 1 + test/h5u/H5PartAndreasTest.cc | 119 ++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100755 test/h5u/H5PartAndreasTest.cc diff --git a/.gitattributes b/.gitattributes index 5b748d1..1f9af1a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -77,6 +77,7 @@ test/h5b/H5BlockTestAttributes.c -text test/h5b/H5BlockTestAttributesF.f90 -text test/h5u/Bench.c -text test/h5u/H5ParallelTest.cc -text +test/h5u/H5PartAndreasTest.cc -text test/h5u/H5PartTest.cc -text test/h5u/H5PartTestParallel.cc -text test/h5u/H5test.cc -text diff --git a/test/h5u/H5PartAndreasTest.cc b/test/h5u/H5PartAndreasTest.cc new file mode 100755 index 0000000..d0ba2c9 --- /dev/null +++ b/test/h5u/H5PartAndreasTest.cc @@ -0,0 +1,119 @@ +#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; + h5part_int64_t *id; + H5PartFile *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=(h5part_int64_t*)malloc(1+sz*sizeof(h5part_int64_t)); + + for(i=0;i