-
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 #10 from uliegecsm/concepts-exec-mem
concepts(core): ExecutionSpace, MemorySpace and Space concepts for C++20
- Loading branch information
Showing
9 changed files
with
155 additions
and
1 deletion.
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
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_EXECUTIONSPACE_HPP | ||
#define KOKKOS_UTILS_CONCEPTS_EXECUTIONSPACE_HPP | ||
|
||
#include "Kokkos_Concepts.hpp" | ||
|
||
namespace Kokkos::utils::concepts | ||
{ | ||
|
||
//! Concept to specify that a type is a @c Kokkos execution space. | ||
template <typename T> | ||
concept ExecutionSpace = Kokkos::is_execution_space_v<T>; | ||
|
||
} // namespace Kokkos::utils::concepts | ||
|
||
#endif // KOKKOS_UTILS_CONCEPTS_EXECUTIONSPACE_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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef KOKKOS_UTILS_CONCEPTS_MEMORYSPACE_HPP | ||
#define KOKKOS_UTILS_CONCEPTS_MEMORYSPACE_HPP | ||
|
||
#include "Kokkos_Concepts.hpp" | ||
|
||
namespace Kokkos::utils::concepts | ||
{ | ||
|
||
//! Concept to specify that a type is a @c Kokkos memory space. | ||
template <typename T> | ||
concept MemorySpace = Kokkos::is_memory_space_v<T>; | ||
|
||
} // namespace Kokkos::utils::concepts | ||
|
||
#endif // KOKKOS_UTILS_CONCEPTS_MEMORYSPACE_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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef KOKKOS_UTILS_CONCEPTS_SPACE_HPP | ||
#define KOKKOS_UTILS_CONCEPTS_SPACE_HPP | ||
|
||
#include "Kokkos_Concepts.hpp" | ||
|
||
namespace Kokkos::utils::concepts | ||
{ | ||
|
||
//! Concept to specify that a type is a @c Kokkos space. | ||
template <typename T> | ||
concept Space = Kokkos::is_space<T>::value; | ||
|
||
} // namespace Kokkos::utils::concepts | ||
|
||
#endif // KOKKOS_UTILS_CONCEPTS_SPACE_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
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,30 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "Kokkos_Core.hpp" | ||
|
||
#include "kokkos-utils/concepts/ExecutionSpace.hpp" | ||
|
||
using execution_space = Kokkos::DefaultExecutionSpace; | ||
|
||
/** | ||
* @file | ||
* | ||
* @addtogroup unittests | ||
* | ||
* **Concepts related to @c Kokkos execution space** | ||
* | ||
* This group of tests check the behavior of our concepts related to @c Kokkos execution space. | ||
*/ | ||
|
||
namespace Kokkos::utils::tests::concepts | ||
{ | ||
|
||
//! @test Check that @ref Kokkos::utils::concepts::ExecutionSpace works as expected. | ||
TEST(concepts, ExecutionSpace) | ||
{ | ||
static_assert( Kokkos::utils::concepts::ExecutionSpace<typename execution_space::execution_space>); | ||
static_assert(! Kokkos::utils::concepts::ExecutionSpace<typename execution_space::memory_space>); | ||
static_assert(! Kokkos::utils::concepts::ExecutionSpace<Kokkos::Device<typename execution_space::execution_space, typename execution_space::memory_space>>); | ||
} | ||
|
||
} // namespace Kokkos::utils::tests::concepts |
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,30 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "Kokkos_Core.hpp" | ||
|
||
#include "kokkos-utils/concepts/MemorySpace.hpp" | ||
|
||
using execution_space = Kokkos::DefaultExecutionSpace; | ||
|
||
/** | ||
* @file | ||
* | ||
* @addtogroup unittests | ||
* | ||
* **Concepts related to @c Kokkos memory space** | ||
* | ||
* This group of tests check the behavior of our concepts related to @c Kokkos memory space. | ||
*/ | ||
|
||
namespace Kokkos::utils::tests::concepts | ||
{ | ||
|
||
//! @test Check that @ref Kokkos::utils::concepts::MemorySpace works as expected. | ||
TEST(concepts, MemorySpace) | ||
{ | ||
static_assert(! Kokkos::utils::concepts::MemorySpace<typename execution_space::execution_space>); | ||
static_assert( Kokkos::utils::concepts::MemorySpace<typename execution_space::memory_space>); | ||
static_assert(! Kokkos::utils::concepts::MemorySpace<Kokkos::Device<typename execution_space::execution_space, typename execution_space::memory_space>>); | ||
} | ||
|
||
} // namespace Kokkos::utils::tests::concepts |
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,30 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "Kokkos_Core.hpp" | ||
|
||
#include "kokkos-utils/concepts/Space.hpp" | ||
|
||
using execution_space = Kokkos::DefaultExecutionSpace; | ||
|
||
/** | ||
* @file | ||
* | ||
* @addtogroup unittests | ||
* | ||
* **Concepts related to @c Kokkos space** | ||
* | ||
* This group of tests check the behavior of our concepts related to @c Kokkos space. | ||
*/ | ||
|
||
namespace Kokkos::utils::tests::concepts | ||
{ | ||
|
||
//! @test Check that @ref Kokkos::utils::concepts::Space works as expected. | ||
TEST(concepts, Space) | ||
{ | ||
static_assert(Kokkos::utils::concepts::Space<typename execution_space::execution_space>); | ||
static_assert(Kokkos::utils::concepts::Space<typename execution_space::memory_space>); | ||
static_assert(Kokkos::utils::concepts::Space<Kokkos::Device<typename execution_space::execution_space, typename execution_space::memory_space>>); | ||
} | ||
|
||
} // namespace Kokkos::utils::tests::concepts |