freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Extend/fix some testcases for MPI


From: Richard Guenther
Subject: [PATCH] Extend/fix some testcases for MPI
Date: Wed, 7 Jan 2004 13:55:32 +0100 (CET)

Hi!

This patch fixes some testcases for MPI operation and extends array_test29
to check for individual guard updates (for the optimization patches still
pending).

Ok?

Richard.


2004Jan07  Richard Guenther <address@hidden>

        * src/Array/tests/array_test29: systematically check (partial)
        guard updates.
        src/Field/tests/BasicTest3.cpp: use ReplicatedTag, not
        DistributedTag.
        src/Layout/tests/dynamiclayout_test1.cpp: #define BARRIER, as in
        other tests.
        src/Layout/tests/dynamiclayout_test2.cpp: likewise.
        src/Tulip/tests/ReduceOverContextsTest.cpp: #include Pooma/Pooma.h.


diff -Nru a/r2/src/Array/tests/array_test29.cpp 
b/r2/src/Array/tests/array_test29.cpp
--- a/r2/src/Array/tests/array_test29.cpp       Wed Jan  7 13:47:20 2004
+++ b/r2/src/Array/tests/array_test29.cpp       Wed Jan  7 13:47:20 2004
@@ -33,17 +33,168 @@

 #include "Pooma/Pooma.h"
 #include "Utilities/Tester.h"
-#include "Domain/Loc.h"
-#include "Domain/Interval.h"
-#include "Partition/UniformGridPartition.h"
-#include "Layout/UniformGridLayout.h"
-#include "Engine/BrickEngine.h"
-#include "Engine/CompressibleBrick.h"
-#include "Engine/MultiPatchEngine.h"
-#include "Engine/RemoteEngine.h"
-#include "Array/Array.h"
+#include "Pooma/Arrays.h"
 #include "Tiny/Vector.h"

+
+void checks1(Pooma::Tester& tester)
+{
+  Interval<2> I(9, 9);
+  Loc<2> blocks(3, 3);
+  UniformGridPartition<2> partition(blocks, GuardLayers<2>(1));
+  UniformGridLayout<2> layout(I, partition, DistributedTag());
+  DomainLayout<2> layout2(I, GuardLayers<2>(1));
+
+  Array<2, int, MultiPatch<UniformTag,Remote<Brick> > >
+    am(layout), bm(layout);
+  Array<2, int, Brick>
+    al(layout2), bl(layout2);
+
+  am = 2;
+  al = 2;
+  am(I) = 1;
+  al(I) = 1;
+  bm = am;
+  bl = al;
+
+  bm(I) += am(I-Loc<2>(1, 0));
+  bl(I) += al(I-Loc<2>(1, 0));
+  tester.check("left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  am(I) += bm(I-Loc<2>(0, 1));
+  al(I) += bl(I-Loc<2>(0, 1));
+  tester.check("upper guards", all(am(I) == al(I)));
+  if (!tester.ok()) {
+    tester.out() << al << am << std::endl;
+    return;
+  }
+  bm(I) += am(I-Loc<2>(-1, 0));
+  bl(I) += al(I-Loc<2>(-1, 0));
+  tester.check("right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  am(I) += bm(I-Loc<2>(0, -1));
+  al(I) += bl(I-Loc<2>(0, -1));
+  tester.check("lower guards", all(am(I) == al(I)));
+  if (!tester.ok()) {
+    tester.out() << al << am << std::endl;
+    return;
+  }
+
+  bm(I) += am(I-Loc<2>(1, 1));
+  bl(I) += al(I-Loc<2>(1, 1));
+  tester.check("upper left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  am(I) += bm(I-Loc<2>(1, -1));
+  al(I) += bl(I-Loc<2>(1, -1));
+  tester.check("lower left guards", all(am(I) == al(I)));
+  if (!tester.ok()) {
+    tester.out() << al << am << std::endl;
+    return;
+  }
+  bm(I) += am(I-Loc<2>(-1, 1));
+  bl(I) += al(I-Loc<2>(-1, 1));
+  tester.check("upper right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  am(I) += bm(I-Loc<2>(-1, -1));
+  al(I) += bl(I-Loc<2>(-1, -1));
+  tester.check("lower right guards", all(am(I) == al(I)));
+  if (!tester.ok()) {
+    tester.out() << al << am << std::endl;
+    return;
+  }
+}
+
+void checks2(Pooma::Tester& tester)
+{
+  Interval<2> I(9, 9);
+  Loc<2> blocks(3, 3);
+  UniformGridPartition<2> partition(blocks, GuardLayers<2>(1));
+  UniformGridLayout<2> layout(I, partition, DistributedTag());
+  DomainLayout<2> layout2(I, GuardLayers<2>(1));
+
+  Array<2, int, MultiPatch<UniformTag,Remote<Brick> > >
+    am(layout), bm(layout);
+  Array<2, int, Brick>
+    al(layout2), bl(layout2);
+
+  am = 2;
+  al = 2;
+  am(I) = 1;
+  al(I) = 1;
+  bm = am;
+  bl = al;
+
+  bm(I) = am(I-Loc<2>(1, 0));
+  bl(I) = al(I-Loc<2>(1, 0));
+  tester.check("left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(0, 1));
+  bl(I) = al(I-Loc<2>(0, 1));
+  tester.check("left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(-1, 0));
+  bl(I) = al(I-Loc<2>(-1, 0));
+  tester.check("right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(0, -1));
+  bl(I) = al(I-Loc<2>(0, -1));
+  tester.check("right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+
+  bm(I) = am(I-Loc<2>(1, 1));
+  bl(I) = al(I-Loc<2>(1, 1));
+  tester.check("upper left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(1, -1));
+  bl(I) = al(I-Loc<2>(1, -1));
+  tester.check("upper left guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(-1, 1));
+  bl(I) = al(I-Loc<2>(-1, 1));
+  tester.check("upper right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+  bm(I) = am(I-Loc<2>(-1, -1));
+  bl(I) = al(I-Loc<2>(-1, -1));
+  tester.check("upper right guards", all(bm(I) == bl(I)));
+  if (!tester.ok()) {
+    tester.out() << bl << bm << std::endl;
+    return;
+  }
+}
+
 int main(int argc, char *argv[])
 {
   Pooma::initialize(argc, argv);
@@ -72,6 +223,16 @@
   a1(I) = (a2(I-1)+a2(I+1))/2;
   tester.check("Average", all(a1(I) == 1));

+  Interval<1> J(1,7);
+  a1 = 0;
+  a2 = 1;
+  a1(J) = (a2(J-1)+a2(J+1))/2;
+  tester.check("Average", all(a1(J) == 1));
+
+  checks1(tester);
+  if (tester.ok())
+    checks2(tester);
+
   int ret = tester.results("array_test29");
   Pooma::finalize();
   return ret;
diff -Nru a/r2/src/Field/tests/BasicTest3.cpp 
b/r2/src/Field/tests/BasicTest3.cpp
--- a/r2/src/Field/tests/BasicTest3.cpp Wed Jan  7 13:47:20 2004
+++ b/r2/src/Field/tests/BasicTest3.cpp Wed Jan  7 13:47:20 2004
@@ -127,7 +127,7 @@
   // MultiPatch<Brick>
   tester.out() << "MultiPatch<Brick>...\n";
   {
-    GridLayout<2> layout1(Interval<2>(I, J), Loc<2>(1, 1), GuardLayers<2>(1), 
DistributedTag());
+    GridLayout<2> layout1(Interval<2>(I, J), Loc<2>(1, 1), GuardLayers<2>(1), 
ReplicatedTag());
     Field<MeshTraits<2>::Mesh_t, int, MultiPatch<GridTag, Brick> >
       f(vert, layout1, origin, spacings);
     check(tester, f);
diff -Nru a/r2/src/Layout/tests/dynamiclayout_test1.cpp 
b/r2/src/Layout/tests/dynamiclayout_test1.cpp
--- a/r2/src/Layout/tests/dynamiclayout_test1.cpp       Wed Jan  7 13:47:20 2004
+++ b/r2/src/Layout/tests/dynamiclayout_test1.cpp       Wed Jan  7 13:47:20 2004
@@ -40,7 +40,7 @@
 #include "Layout/DynamicLayout.h"
 #include "Partition/GridPartition.h"

-//#define BARRIER
+#define BARRIER

 #ifndef BARRIER
 #if POOMA_CHEETAH
diff -Nru a/r2/src/Layout/tests/dynamiclayout_test2.cpp 
b/r2/src/Layout/tests/dynamiclayout_test2.cpp
--- a/r2/src/Layout/tests/dynamiclayout_test2.cpp       Wed Jan  7 13:47:20 2004
+++ b/r2/src/Layout/tests/dynamiclayout_test2.cpp       Wed Jan  7 13:47:20 2004
@@ -44,7 +44,7 @@
         #include <sstream>
 #endif

-//#define BARRIER
+#define BARRIER

 #ifndef BARRIER
 #if POOMA_CHEETAH
diff -Nru a/r2/src/Tulip/tests/ReduceOverContextsTest.cpp 
b/r2/src/Tulip/tests/ReduceOverContextsTest.cpp
--- a/r2/src/Tulip/tests/ReduceOverContextsTest.cpp     Wed Jan  7 13:47:20 2004
+++ b/r2/src/Tulip/tests/ReduceOverContextsTest.cpp     Wed Jan  7 13:47:20 2004
@@ -32,7 +32,7 @@

 // Include files

-#include "PETE/PETE.h" // seems like overkill...
+#include "Pooma/Pooma.h"
 #include "Tulip/ReduceOverContexts.h"
 #include "Tulip/RemoteProxy.h"
 #include "Utilities/Tester.h"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]