-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from uliegecsm/atomic-add
concepts(containers): add concept for `Kokkos::DualView`
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef KOKKOS_UTILS_CONCEPTS_DUALVIEW_HPP | ||
#define KOKKOS_UTILS_CONCEPTS_DUALVIEW_HPP | ||
|
||
#include "Kokkos_DualView.hpp" | ||
|
||
namespace Kokkos::utils::concepts | ||
{ | ||
|
||
//! Concept to specify that a type is a @c Kokkos::DualView. | ||
template <typename T> | ||
concept DualView = Kokkos::is_dual_view_v<T>; | ||
|
||
} // namespace Kokkos::utils::concepts | ||
|
||
#endif // KOKKOS_UTILS_CONCEPTS_DUALVIEW_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
### TEST : DualView ### | ||
add_one_test( | ||
TEST_NAME DualView | ||
) | ||
|
||
### TEST : View ### | ||
add_one_test( | ||
TEST_NAME View | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "kokkos-utils/concepts/DualView.hpp" | ||
#include "kokkos-utils/concepts/View.hpp" | ||
|
||
using execution_space = Kokkos::DefaultExecutionSpace; | ||
|
||
/** | ||
* @file | ||
* | ||
* @addtogroup unittests | ||
* | ||
* **Concepts related to @c Kokkos::DualView** | ||
* | ||
* This group of tests check the behavior of our concepts related to @c Kokkos::DualView. | ||
*/ | ||
|
||
namespace Kokkos::utils::tests::concepts | ||
{ | ||
|
||
//! @test Check that @ref Kokkos::utils::concepts::DualView works as expected. | ||
TEST(concepts, DualView) | ||
{ | ||
using dual_view_1d_t = Kokkos::DualView<int[5] , execution_space>; | ||
using view_1d_t = Kokkos:: View<int[5] , execution_space>; | ||
using dual_view_2d_t = Kokkos::DualView<int[5][5], execution_space>; | ||
using view_2d_t = Kokkos:: View<int[5][5], execution_space>; | ||
|
||
//! A @c Kokkos::DualView fulfills the concept. | ||
static_assert(Kokkos::utils::concepts::DualView<dual_view_1d_t>); | ||
static_assert(Kokkos::utils::concepts::DualView<dual_view_2d_t>); | ||
|
||
//! A @c Kokkos::View does not fulfill the concept. | ||
static_assert(! Kokkos::utils::concepts::DualView<view_1d_t>); | ||
static_assert(! Kokkos::utils::concepts::DualView<view_2d_t>); | ||
|
||
//! A @c Kokkos::DualView does not fulfill the @ref Kokkos::utils::concepts::View concept. | ||
static_assert(! Kokkos::utils::concepts::View<dual_view_1d_t>); | ||
static_assert(! Kokkos::utils::concepts::View<dual_view_2d_t>); | ||
} | ||
|
||
} // namespace Kokkos::utils::tests::concepts |