From 3e2350edc9aedfe0bf3ea28101001c37680bdf42 Mon Sep 17 00:00:00 2001 From: "chuck.yount" Date: Fri, 29 Mar 2019 15:37:59 -0700 Subject: [PATCH] Add 2D subdomain test. --- src/kernel/Makefile | 3 ++- src/stencils/SimpleTestStencils.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/kernel/Makefile b/src/kernel/Makefile index 76e2bbb8..da7b628f 100644 --- a/src/kernel/Makefile +++ b/src/kernel/Makefile @@ -383,7 +383,7 @@ endif # Add options for PMEM. ifeq ($(pmem),1) YK_CXXFLAGS += -I/opt/intel/memkind/include - YK_LIBS += -L/opt/intel/memkind/lib -lmemkind + YK_LIBS += -L/opt/intel/memkind/lib -lmemkind MACROS += USE_PMEM endif @@ -844,6 +844,7 @@ stencil-tests: $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_misc_2d fold=x=2,y=2 EXTRA_YC_FLAGS=-interleave-misc $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_step_cond_1d fold=x=4 $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_subdomain_1d fold=x=4 + $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_subdomain_2d fold=x=2,y=2 $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_subdomain_3d fold=x=2,y=2 $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_scratch_1d fold=x=4 $(MAKE) clean; $(MAKE) $(STENCIL_TEST_ARGS) stencil=test_scratch_3d fold=x=2,z=2 diff --git a/src/stencils/SimpleTestStencils.cpp b/src/stencils/SimpleTestStencils.cpp index 928b080d..2ecf7938 100644 --- a/src/stencils/SimpleTestStencils.cpp +++ b/src/stencils/SimpleTestStencils.cpp @@ -499,6 +499,34 @@ class TestSubdomainStencil1 : public TestBase { REGISTER_STENCIL(TestSubdomainStencil1); +class TestSubdomainStencil2 : public TestBase { + +protected: + + // Vars. + MAKE_GRID(A, t, x, y); // time-varying grid. + +public: + + TestSubdomainStencil2(StencilList& stencils, int radius=2) : + TestBase("test_subdomain_2d", stencils, radius) { } + + // Define equation to apply to all points in 'A' grid. + virtual void define() { + + // Sub-domain is rectangle interior. + Condition sd0 = + (x >= first_index(x) + 5) && (x <= last_index(x) - 3) && + (y >= first_index(y) + 4) && (y <= last_index(y) - 6); + + // Set A w/different stencils depending on condition. + A(t+1, x, y) EQUALS def_2d(A, t, x, 0, 2, y, 1, 0) IF sd0; + A(t+1, x, y) EQUALS def_2d(A, t, x, 1, 0, y, 0, 2) IF !sd0; + } +}; + +REGISTER_STENCIL(TestSubdomainStencil2); + class TestSubdomainStencil3 : public TestBase { protected: