From 569f08536548a7b7d054dd3910846086bea8f2ca Mon Sep 17 00:00:00 2001 From: heister Date: Wed, 22 Aug 2012 18:55:55 +0000 Subject: [PATCH] make it possible to run tests in parallel git-svn-id: https://svn.dealii.org/trunk@26082 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/no_flux_constraints_02.cc | 4 ++-- tests/mpi/no_flux_constraints_03.cc | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/mpi/no_flux_constraints_02.cc b/tests/mpi/no_flux_constraints_02.cc index 1e5d148b03..c8d9939394 100644 --- a/tests/mpi/no_flux_constraints_02.cc +++ b/tests/mpi/no_flux_constraints_02.cc @@ -128,7 +128,7 @@ void test() MPI_Barrier(MPI_COMM_WORLD); { //write the constraintmatrix to a file on each cpu - std::string fname = base+"cm_" + Utilities::int_to_string(myid) + ".dot"; + std::string fname = base+"cm_" + Utilities::int_to_string(numprocs) + "_" + Utilities::int_to_string(myid) + ".dot"; std::ofstream file(fname.c_str()); constraints.print(file); } @@ -138,7 +138,7 @@ void test() { //sort and merge the constraint matrices on proc 0, generate a checksum //and output that into the deallog - system((std::string("cat ") + base+"cm_?.dot|sort -n|uniq >" + base+"cm").c_str()); + system((std::string("cat ") + base+"cm_" +Utilities::int_to_string(numprocs)+ "_?.dot|sort -n|uniq >" + base+"cm").c_str()); system((std::string("md5sum ") + base + "cm >" + base + "cm.check").c_str()); { std::ifstream file((base+"cm.check").c_str()); diff --git a/tests/mpi/no_flux_constraints_03.cc b/tests/mpi/no_flux_constraints_03.cc index c2d20e4c10..75c1287a1b 100644 --- a/tests/mpi/no_flux_constraints_03.cc +++ b/tests/mpi/no_flux_constraints_03.cc @@ -91,14 +91,13 @@ void test() MappingQ(degree)); constraints.close(); - if (myid==0) - system("rm -rf no_flux_constraints_03/cm_?.dot"); + std::string base = output_file_for_mpi("no_flux_constraints_03"); MPI_Barrier(MPI_COMM_WORLD); { //write the constraintmatrix to a file on each cpu - char fname[] = "no_flux_constraints_03/cm_0.dot"; - fname[26]+=myid; + std::string fname = base+"cm_" + Utilities::int_to_string(numprocs) + "_" + Utilities::int_to_string(myid) + ".dot"; + std::ofstream file(fname.c_str()); std::ofstream file(fname); constraints.print(file); } @@ -108,10 +107,9 @@ void test() { //sort and merge the constraint matrices on proc 0, generate a checksum //and output that into the deallog - system("cat no_flux_constraints_03/cm_?.dot|sort -n|uniq >no_flux_constraints_03/cm"); - system("md5sum no_flux_constraints_03/cm >no_flux_constraints_03/cm.check"); + system((std::string("cat ") + base+"cm_" +Utilities::int_to_string(numprocs)+ "_?.dot|sort -n|uniq|md5sum >" + base+Utilities::int_to_string(numprocs)+"cm.check").c_str()); { - std::ifstream file("no_flux_constraints_03/cm.check"); + std::ifstream file((base+Utilities::int_to_string(numprocs)+"cm.check").c_str()); std::string str; while (!file.eof()) { -- 2.39.5