Skip to content

Commit

Permalink
Always run Graph tests (#7011)
Browse files Browse the repository at this point in the history
* Always run Graph tests

* Workaround for HPX

* Move comment
  • Loading branch information
masterleinad committed May 20, 2024
1 parent 6aa2ad7 commit f8f0cc4
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 105 deletions.
25 changes: 1 addition & 24 deletions core/unit_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;OpenACC;HIP;SYCL)
ExecSpaceThreadSafety
ExecutionSpace
FunctorAnalysis
Graph
HostSharedPtr
HostSharedPtrAccessOnDevice
Init
Expand Down Expand Up @@ -658,12 +659,6 @@ if(Kokkos_ENABLE_SERIAL)
UnitTestMainInit.cpp
${Serial_SOURCES2}
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
CoreUnitTest_SerialGraph
SOURCES
UnitTestMainInit.cpp
serial/TestSerial_Graph.cpp
)
endif()

if(Kokkos_ENABLE_THREADS)
Expand Down Expand Up @@ -694,12 +689,6 @@ if (Kokkos_ENABLE_OPENMP)
UnitTestMain.cpp
openmp/TestOpenMP_InterOp.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
CoreUnitTest_OpenMPGraph
SOURCES
UnitTestMainInit.cpp
openmp/TestOpenMP_Graph.cpp
)
endif()

if(Kokkos_ENABLE_HPX)
Expand Down Expand Up @@ -807,12 +796,6 @@ if(Kokkos_ENABLE_CUDA)
UnitTestMainInit.cpp
cuda/TestCuda_InterOp_StreamsMultiGPU.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
CoreUnitTest_CudaGraph
SOURCES
UnitTestMainInit.cpp
cuda/TestCuda_Graph.cpp
)
endif()

if(Kokkos_ENABLE_HIP)
Expand Down Expand Up @@ -840,12 +823,6 @@ if(Kokkos_ENABLE_HIP)
UnitTestMain.cpp
hip/TestHIP_InterOp_Streams.cpp
)
KOKKOS_ADD_EXECUTABLE_AND_TEST(
UnitTest_HIPGraph
SOURCES
UnitTestMainInit.cpp
hip/TestHIP_Graph.cpp
)
endif()

if(Kokkos_ENABLE_SYCL)
Expand Down
22 changes: 13 additions & 9 deletions core/unit_test/TestGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct SetResultToViewFunctor {
}
};

struct TEST_CATEGORY_FIXTURE(count_bugs) : public ::testing::Test {
struct TEST_CATEGORY_FIXTURE(graph) : public ::testing::Test {
public:
using count_functor = CountTestFunctor<TEST_EXECSPACE>;
using set_functor = SetViewToValueFunctor<TEST_EXECSPACE, int>;
Expand All @@ -88,7 +88,7 @@ struct TEST_CATEGORY_FIXTURE(count_bugs) : public ::testing::Test {
}
};

TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_one) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), launch_one) {
auto graph =
Kokkos::Experimental::create_graph<TEST_EXECSPACE>([&](auto root) {
root.then_parallel_for(1, count_functor{count, bugs, 0, 0});
Expand All @@ -101,7 +101,7 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_one) {
ASSERT_EQ(0, bugs_host());
}

TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_one_rvalue) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), launch_one_rvalue) {
Kokkos::Experimental::create_graph(ex, [&](auto root) {
root.then_parallel_for(1, count_functor{count, bugs, 0, 0});
}).submit();
Expand All @@ -112,7 +112,7 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_one_rvalue) {
ASSERT_EQ(0, bugs_host());
}

TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_six) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), launch_six) {
auto graph = Kokkos::Experimental::create_graph(ex, [&](auto root) {
auto f_setup_count = root.then_parallel_for(1, set_functor{count, 0});
auto f_setup_bugs = root.then_parallel_for(1, set_functor{bugs, 0});
Expand Down Expand Up @@ -145,7 +145,7 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), launch_six) {
ASSERT_EQ(0, bugs_host());
}

TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), when_all_cycle) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), when_all_cycle) {
view_type reduction_out{"reduction_out"};
view_host reduction_host{"reduction_host"};
Kokkos::Experimental::create_graph(ex, [&](auto root) {
Expand All @@ -172,7 +172,7 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), when_all_cycle) {

// This test is disabled because we don't currently support copying to host,
// even asynchronously. We _may_ want to do that eventually?
TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), DISABLED_repeat_chain) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), DISABLED_repeat_chain) {
auto graph = Kokkos::Experimental::create_graph(
ex, [&, count_host = count_host](auto root) {
//----------------------------------------
Expand All @@ -198,7 +198,7 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), DISABLED_repeat_chain) {
//----------------------------------------
}

TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), zero_work_reduce) {
TEST_F(TEST_CATEGORY_FIXTURE(graph), zero_work_reduce) {
auto graph = Kokkos::Experimental::create_graph(ex, [&](auto root) {
root.then_parallel_reduce(0, set_result_functor{bugs}, count);
});
Expand All @@ -214,9 +214,13 @@ TEST_F(TEST_CATEGORY_FIXTURE(count_bugs), zero_work_reduce) {
// UVM works on pre pascal cards.
#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_CUDA_UVM) && \
(defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL))
Kokkos::fence();
if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) Kokkos::fence();
#endif
#ifdef KOKKOS_ENABLE_HPX // FIXME_HPX graph.submit() isn't properly enqueued
if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Experimental::HPX>)
Kokkos::fence();
#endif
graph.submit(); // should reset to 0, but doesn't
graph.submit();
Kokkos::deep_copy(ex, count_host, count);
ex.fence();
ASSERT_EQ(count_host(), 0);
Expand Down
1 change: 1 addition & 0 deletions core/unit_test/category_files/TestHPX_Category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#define TEST_CATEGORY_NUMBER 3
#define TEST_CATEGORY_DEATH hpx_DeathTest
#define TEST_EXECSPACE Kokkos::Experimental::HPX
#define TEST_CATEGORY_FIXTURE(name) hpx_##name

#endif
1 change: 1 addition & 0 deletions core/unit_test/category_files/TestOpenACC_Category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#define TEST_CATEGORY_NUMBER 8
#define TEST_CATEGORY_DEATH openacc_DeathTest
#define TEST_EXECSPACE Kokkos::Experimental::OpenACC
#define TEST_CATEGORY_FIXTURE(name) openacc_##name

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#define TEST_CATEGORY_NUMBER 4
#define TEST_CATEGORY_DEATH openmptarget_DeathTest
#define TEST_EXECSPACE Kokkos::Experimental::OpenMPTarget
#define TEST_CATEGORY_FIXTURE(name) openmptarget_##name

#endif
1 change: 1 addition & 0 deletions core/unit_test/category_files/TestSYCL_Category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#define TEST_CATEGORY_NUMBER 7
#define TEST_CATEGORY_DEATH sycl_DeathTest
#define TEST_EXECSPACE Kokkos::Experimental::SYCL
#define TEST_CATEGORY_FIXTURE(name) sycl_##name

#endif
1 change: 1 addition & 0 deletions core/unit_test/category_files/TestThreads_Category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
#define TEST_CATEGORY_NUMBER 1
#define TEST_CATEGORY_DEATH threads_DeathTest
#define TEST_EXECSPACE Kokkos::Threads
#define TEST_CATEGORY_FIXTURE(name) threads_##name

#endif
18 changes: 0 additions & 18 deletions core/unit_test/cuda/TestCuda_Graph.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions core/unit_test/hip/TestHIP_Graph.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions core/unit_test/openmp/TestOpenMP_Graph.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions core/unit_test/serial/TestSerial_Graph.cpp

This file was deleted.

0 comments on commit f8f0cc4

Please sign in to comment.