Skip to content

Commit

Permalink
unit-tests: adding logic specific to openmptarget backend
Browse files Browse the repository at this point in the history
Adding the openmptarget folder that contains the source
files for the backend's unit-tests.
Ignoring Vector batched tests that only run on host.
Also commenting out the batched tests as they do not build
correctly at the moment.
  • Loading branch information
lucbv committed Apr 23, 2021
1 parent 5486f95 commit c060a70
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 12 deletions.
45 changes: 45 additions & 0 deletions unit_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,51 @@ IF (KOKKOS_ENABLE_HIP)
)
ENDIF ()

IF (KOKKOS_ENABLE_OPENMPTARGET)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/openmp_target)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}/openmptarget)

KOKKOSKERNELS_ADD_UNIT_TEST(
blas_openmptarget
SOURCES
Test_Main.cpp
openmptarget/Test_OpenMPTarget_Blas.cpp
COMPONENTS blas
)

# KOKKOSKERNELS_ADD_UNIT_TEST(
# batched_dla_openmptarget
# SOURCES
# Test_Main.cpp
# openmptarget/Test_OpenMPTarget_Batched.cpp
# COMPONENTS batched
# )

KOKKOSKERNELS_ADD_UNIT_TEST(
sparse_openmptarget
SOURCES
Test_Main.cpp
openmptarget/Test_OpenMPTarget_Sparse.cpp
COMPONENTS sparse
)

KOKKOSKERNELS_ADD_UNIT_TEST(
graph_openmptarget
SOURCES
Test_Main.cpp
openmptarget/Test_OpenMPTarget_Graph.cpp
COMPONENTS graph
)

KOKKOSKERNELS_ADD_UNIT_TEST(
common_openmptarget
SOURCES
Test_Main.cpp
openmptarget/Test_OpenMPTarget_Common.cpp
COMPONENTS common
)
ENDIF ()

IF (KOKKOS_ENABLE_OPENMP)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/openmp)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}/openmp)
Expand Down
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorArithmatic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -308,4 +309,4 @@ TEST_F( TestCategory, batched_vector_dcomplex_real_imag_value4 ) {
#endif
#undef __DO_NOT_TEST__

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorLogical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -131,4 +132,4 @@ TEST_F( TestCategory, batched_vector_logical_simd_double4 ) {
// }
// #endif

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorMath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -178,4 +179,4 @@ TEST_F( TestCategory, batched_vector_math_simd_double4 ) {
// }
// #endif

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorMisc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -183,4 +184,4 @@ TEST_F( TestCategory, batched_vector_misc_simd_double4 ) {
// }
// #endif

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorRelation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -140,4 +141,4 @@ TEST_F( TestCategory, batched_vector_relation_simd_double4 ) {
// }
// #endif

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
5 changes: 3 additions & 2 deletions unit_test/batched/Test_Batched_VectorView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// to ensure it is not included in these
// backends unit-test

#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP)
#if !defined(TEST_CUDA_BATCHED_CPP) && !defined(TEST_HIP_BATCHED_CPP) \
&& !defined(TEST_OPENMPTARGET_BATCHED_CPP)

#include "gtest/gtest.h"
#include "Kokkos_Core.hpp"
Expand Down Expand Up @@ -249,4 +250,4 @@ TEST_F( TestCategory, batched_vector_view_simd_dcomplex4 ) {
}
#endif

#endif // check on TEST_CUDA_BATCHED_CPP and TEST_HIP_BATCHED_CPP
#endif // check to not include this in a device test
26 changes: 26 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef TEST_OPENMPTARGET_HPP
#define TEST_OPENMPTARGET_HPP

#include <gtest/gtest.h>
#include <Kokkos_Core.hpp>
#include <KokkosKernels_config.h>

#if defined(KOKKOSKERNELS_TEST_ETI_ONLY) && !defined(KOKKOSKERNELS_ETI_ONLY)
#define KOKKOSKERNELS_ETI_ONLY
#endif

class openmptarget : public ::testing::Test {
protected:
static void SetUpTestCase()
{
}

static void TearDownTestCase()
{
}
};

#define TestCategory openmptarget
#define TestExecSpace Kokkos::Experimental::OpenMPTarget

#endif // TEST_OPENMPTARGET_HPP
7 changes: 7 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget_Batched.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_OPENMPTARGET_BATCHED_CPP
#define TEST_OPENMPTARGET_BATCHED_CPP

#include "Test_OpenMPTarget.hpp"
#include "Test_Batched.hpp"

#endif // TEST_OPENMPTARGET_BATCHED_CPP
7 changes: 7 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget_Blas.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_OPENMPTARGET_BLAS_CPP
#define TEST_OPENMPTARGET_BLAS_CPP

#include "Test_OpenMPTarget.hpp"
#include "Test_Blas.hpp"

#endif // TEST_OPENMPTARGET_BLAS_CPP
7 changes: 7 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget_Common.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_OPENMPTARGET_COMMON_CPP
#define TEST_OPENMPTARGET_COMMON_CPP

#include "Test_OpenMPTarget.hpp"
#include "Test_Common.hpp"

#endif // TEST_OPENMPTARGET_COMMON_CPP
7 changes: 7 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget_Graph.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_OPENMPTARGET_GRAPH_CPP
#define TEST_OPENMPTARGET_GRAPH_CPP

#include "Test_OpenMPTarget.hpp"
#include "Test_Graph.hpp"

#endif // TEST_OPENMPTARGET_GRAPH_CPP
7 changes: 7 additions & 0 deletions unit_test/openmptarget/Test_OpenMPTarget_Sparse.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_OPENMPTARGET_SPARSE_CPP
#define TEST_OPENMPTARGET_SPARSE_CPP

#include "Test_OpenMPTarget.hpp"
#include "Test_Sparse.hpp"

#endif // TEST_OPENMPTARGET_SPARSE_CPP

0 comments on commit c060a70

Please sign in to comment.