Skip to content

Commit

Permalink
UnitTests: add missing fences to fix UVM issue on Kepler
Browse files Browse the repository at this point in the history
fixes kokkos#51
  • Loading branch information
crtrott committed Sep 20, 2017
1 parent cd5d9fb commit 7654277
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions unit_test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/unit_test/blas/*.hpp)
TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/unit_test/sparse/*.hpp)
TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/unit_test/graph/*.hpp)
TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/unit_test/common/*.hpp)
TEST_HEADERS += $(wildcard $(KOKKOSKERNELS_SRC_PATH)/unit_test/batched/*.hpp)



Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_SerialGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ namespace Test {
Kokkos::fill_random(b0, random, value_type(1.0));
Kokkos::fill_random(c0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);
Kokkos::deep_copy(c1, c0);
Expand All @@ -90,6 +92,8 @@ namespace Test {
Functor_TestBatchedSerialGemm<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1, beta, c1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror c0_host = Kokkos::create_mirror_view(c0);
typename ViewType::HostMirror c1_host = Kokkos::create_mirror_view(c1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_SerialGemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace Test {
Kokkos::fill_random(b0, random, value_type(1.0));
Kokkos::fill_random(c0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);
Kokkos::deep_copy(c1, c0);
Expand All @@ -88,6 +90,8 @@ namespace Test {
Functor_TestBatchedSerialGemv<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1, beta, c1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror c0_host = Kokkos::create_mirror_view(c0);
typename ViewType::HostMirror c1_host = Kokkos::create_mirror_view(c1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_SerialLU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ namespace Test {
Kokkos::Random_XorShift64_Pool<typename DeviceType::execution_space> random(13718);
Kokkos::fill_random(a0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);

Functor_TestBatchedSerialLU<DeviceType,ViewType,Algo::LU::Unblocked>(a0).run();
Functor_TestBatchedSerialLU<DeviceType,ViewType,AlgoTagType>(a1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror a0_host = Kokkos::create_mirror_view(a0);
typename ViewType::HostMirror a1_host = Kokkos::create_mirror_view(a1);
Expand Down
5 changes: 5 additions & 0 deletions unit_test/batched/Test_Batched_SerialMatUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ namespace Test {

Kokkos::Random_XorShift64_Pool<typename DeviceType::execution_space> random(13718);
Kokkos::fill_random(a, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(b, a);

/// test body
Functor_TestBatchedSerialMatUtil<DeviceType,ViewType,ScalarType,NaiveTag, TestID>(alpha, a).run();
Functor_TestBatchedSerialMatUtil<DeviceType,ViewType,ScalarType,KokkosKernelTag,TestID>(alpha, b).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror a_host = Kokkos::create_mirror_view(a);
typename ViewType::HostMirror b_host = Kokkos::create_mirror_view(b);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_SerialTrsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ namespace Test {
Kokkos::fill_random(a0, random, value_type(1.0));
Kokkos::fill_random(b0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);

Expand All @@ -90,6 +92,8 @@ namespace Test {
Functor_TestBatchedSerialTrsm<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror b0_host = Kokkos::create_mirror_view(b0);
typename ViewType::HostMirror b1_host = Kokkos::create_mirror_view(b1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_SerialTrsv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ namespace Test {
Kokkos::fill_random(a0, random, value_type(1.0));
Kokkos::fill_random(b0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(b0, 1.0);

Kokkos::deep_copy(a1, a0);
Expand All @@ -87,6 +89,8 @@ namespace Test {
Functor_TestBatchedSerialTrsv<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror b0_host = Kokkos::create_mirror_view(b0);
typename ViewType::HostMirror b1_host = Kokkos::create_mirror_view(b1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_TeamGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ namespace Test {
Kokkos::fill_random(b0, random, value_type(1.0));
Kokkos::fill_random(c0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);
Kokkos::deep_copy(c1, c0);
Expand All @@ -96,6 +98,8 @@ namespace Test {
Functor_TestBatchedTeamGemm<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1, beta, c1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror c0_host = Kokkos::create_mirror_view(c0);
typename ViewType::HostMirror c1_host = Kokkos::create_mirror_view(c1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_TeamGemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ namespace Test {
Kokkos::fill_random(b0, random, value_type(1.0));
Kokkos::fill_random(c0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);
Kokkos::deep_copy(c1, c0);
Expand All @@ -94,6 +96,8 @@ namespace Test {
Functor_TestBatchedTeamGemv<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1, beta, c1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror c0_host = Kokkos::create_mirror_view(c0);
typename ViewType::HostMirror c1_host = Kokkos::create_mirror_view(c1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_TeamLU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ namespace Test {
Kokkos::Random_XorShift64_Pool<typename DeviceType::execution_space> random(13718);
Kokkos::fill_random(a0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);

Functor_TestBatchedTeamLU<DeviceType,ViewType,Algo::LU::Unblocked>(a0).run();
Functor_TestBatchedTeamLU<DeviceType,ViewType,AlgoTagType>(a1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror a0_host = Kokkos::create_mirror_view(a0);
typename ViewType::HostMirror a1_host = Kokkos::create_mirror_view(a1);
Expand Down
5 changes: 5 additions & 0 deletions unit_test/batched/Test_Batched_TeamMatUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@ namespace Test {

Kokkos::Random_XorShift64_Pool<typename DeviceType::execution_space> random(13718);
Kokkos::fill_random(a, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(b, a);

/// test body
Functor_TestBatchedTeamMatUtil<DeviceType,ViewType,ScalarType,NaiveTag, TestID>(alpha, a).run();
Functor_TestBatchedTeamMatUtil<DeviceType,ViewType,ScalarType,KokkosKernelTag,TestID>(alpha, b).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror a_host = Kokkos::create_mirror_view(a);
typename ViewType::HostMirror b_host = Kokkos::create_mirror_view(b);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_TeamTrsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ namespace Test {
Kokkos::fill_random(a0, random, value_type(1.0));
Kokkos::fill_random(b0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(a1, a0);
Kokkos::deep_copy(b1, b0);

Expand All @@ -96,6 +98,8 @@ namespace Test {
Functor_TestBatchedTeamTrsm<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror b0_host = Kokkos::create_mirror_view(b0);
typename ViewType::HostMirror b1_host = Kokkos::create_mirror_view(b1);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/batched/Test_Batched_TeamTrsv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ namespace Test {
Kokkos::fill_random(a0, random, value_type(1.0));
Kokkos::fill_random(b0, random, value_type(1.0));

Kokkos::fence();

Kokkos::deep_copy(b0, 1.0);

Kokkos::deep_copy(a1, a0);
Expand All @@ -93,6 +95,8 @@ namespace Test {
Functor_TestBatchedTeamTrsv<DeviceType,ViewType,ScalarType,
ParamTagType,AlgoTagType>(alpha, a1, b1).run();

Kokkos::fence();

/// for comparison send it to host
typename ViewType::HostMirror b0_host = Kokkos::create_mirror_view(b0);
typename ViewType::HostMirror b1_host = Kokkos::create_mirror_view(b1);
Expand Down
2 changes: 1 addition & 1 deletion unit_test/blas/Test_Blas1_asum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Test {
Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();
Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace Test {
Kokkos::fill_random(b_a,rand_pool,ScalarA(10));
Kokkos::fill_random(b_b,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);
Kokkos::deep_copy(h_b_b,b_b);

Expand Down Expand Up @@ -90,6 +92,8 @@ namespace Test {
Kokkos::fill_random(b_a,rand_pool,ScalarA(10));
Kokkos::fill_random(b_b,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);
Kokkos::deep_copy(h_b_b,b_b);

Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_nrm1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down Expand Up @@ -68,6 +70,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_nrm2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down Expand Up @@ -69,6 +71,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_nrm2_squared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down Expand Up @@ -68,6 +70,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_nrminf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down Expand Up @@ -70,6 +72,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_reciprocal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace Test {
Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_y,b_y);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down Expand Up @@ -95,6 +97,8 @@ namespace Test {
Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_y,b_y);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_scal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ namespace Test {
Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_y,b_y);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down Expand Up @@ -95,6 +97,8 @@ namespace Test {
Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_y,b_y);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_sum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down Expand Up @@ -67,6 +69,8 @@ namespace Test {

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(h_b_a,b_a);

typename ViewTypeA::const_type c_a = a;
Expand Down
4 changes: 4 additions & 0 deletions unit_test/blas/Test_Blas1_update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace Test {
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Kokkos::fill_random(b_z,rand_pool,ScalarC(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_z,b_z);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down Expand Up @@ -121,6 +123,8 @@ namespace Test {
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Kokkos::fill_random(b_z,rand_pool,ScalarC(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_z,b_z);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down
2 changes: 2 additions & 0 deletions unit_test/blas/Test_Blas2_gemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace Test {
Kokkos::fill_random(b_y,rand_pool,ScalarY(10));
Kokkos::fill_random(b_A,rand_pool,ScalarA(10));

Kokkos::fence();

Kokkos::deep_copy(b_org_y,b_y);

Kokkos::deep_copy(h_b_x,b_x);
Expand Down

0 comments on commit 7654277

Please sign in to comment.