]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
make it possible to run tests in parallel
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Aug 2012 18:55:55 +0000 (18:55 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 22 Aug 2012 18:55:55 +0000 (18:55 +0000)
git-svn-id: https://svn.dealii.org/trunk@26082 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/no_flux_constraints_02.cc
tests/mpi/no_flux_constraints_03.cc

index 1e5d148b0334c81405952cbb76baa9241a16b78d..c8d993939462909a7baff052adfe08ff508ffdac 100644 (file)
@@ -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());
index c2d20e4c108fbf216c4530cba6771eedda993093..75c1287a1bb68909f180c5256b5afcafb0dc5642 100644 (file)
@@ -91,14 +91,13 @@ void test()
                                                   MappingQ<dim>(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())
          {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.