From 5126f51fca3e9cd335f0f01a210636be96b17760 Mon Sep 17 00:00:00 2001 From: James E McClure Date: Fri, 8 Jan 2016 14:09:49 -0500 Subject: [PATCH] Fixed failing unit tests (TestBlobAnalyze,TestSegDist) on NewRiver compute cluster (haswell) --- tests/TestBlobAnalyze.cpp | 12 ++++++++++-- tests/TestSegDist.cpp | 19 ++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/TestBlobAnalyze.cpp b/tests/TestBlobAnalyze.cpp index b09a50ae..e7d477fb 100644 --- a/tests/TestBlobAnalyze.cpp +++ b/tests/TestBlobAnalyze.cpp @@ -236,6 +236,8 @@ int main(int argc, char **argv) Dm.CommInit(comm); // Initialize communications for domains //....................................................................... // Read in sphere pack (initialize the non-wetting phase as inside of spheres) + // + nspheres=4; if (rank==1) printf("nspheres =%i \n",nspheres); //....................................................................... double *cx = new double[nspheres]; @@ -243,8 +245,14 @@ int main(int argc, char **argv) double *cz = new double[nspheres]; double *rad = new double[nspheres]; //....................................................................... - if (rank == 0) printf("Reading the sphere packing \n"); - if (rank == 0) ReadSpherePacking(nspheres,cx,cy,cz,rad); + //if (rank == 0) printf("Reading the sphere packing \n"); + //if (rank == 0) ReadSpherePacking(nspheres,cx,cy,cz,rad); + // Hard coding the list of four spheres + cx[0]=0.25*Lx; cx[1]=0.5*Lx; cx[2]=0.5*Lx; cx[3]=0.75*Lx; + cy[0]=0.5*Ly; cx[1]=0.25*Ly; cx[2]=0.75*Ly; cx[3]=0.5*Ly; + cz[0]=0.25*Lz; cx[1]=0.75*Lz; cx[2]=0.25*Lz; cx[3]=0.25*Lz; + rad[0]=rad[1]=rad[2]=rad[3]=0.1*Lx; + MPI_Barrier(comm); // Broadcast the sphere packing to all processes MPI_Bcast(cx,nspheres,MPI_DOUBLE,0,comm); diff --git a/tests/TestSegDist.cpp b/tests/TestSegDist.cpp index 8bddf691..04614cd1 100644 --- a/tests/TestSegDist.cpp +++ b/tests/TestSegDist.cpp @@ -20,7 +20,7 @@ int main(int argc, char **argv) MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm_rank(comm,&rank); MPI_Comm_size(comm,&nprocs); - + { int i,j,k,n,nn; int iproc,jproc,kproc; int nx,ny,nz; @@ -111,7 +111,8 @@ int main(int argc, char **argv) if (rank==0) printf("Ny = %i \n",(int)Distance.size(1)); if (rank==0) printf("Nz = %i \n",(int)Distance.size(2)); - printf("Initialized! Converting to Signed Distance function \n"); + MPI_Barrier(comm); + if (rank==0) printf("Initialized! Converting to Signed Distance function \n"); SSO(Distance,id,Dm,10); double Error=0.0; @@ -127,16 +128,12 @@ int main(int argc, char **argv) } } Error = sqrt(Error)/(double (Count)); - printf("Mean error %f \n", Error); + if (rank==0) printf("Mean error %f \n", Error); - char LocalRankFilename[40]; - sprintf(LocalRankFilename,"Dist.%05i",rank); - FILE *DIST = fopen(LocalRankFilename,"wb"); - fwrite(Distance.get(),8,Distance.length(),DIST); - fclose(DIST); - - return 0; MPI_Barrier(comm); - MPI_Finalize(); + } + MPI_Finalize(); + return 0; + }