10 #ifndef TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
11 #define TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
17 #include "Teuchos_RCP.hpp"
20 #include <Kokkos_Core.hpp>
31 template <
typename ExecSpace>
class Slot {
33 using execution_space = ExecSpace;
40 for (
int i = 0; i < static_cast<int>(Spaces::Priority::NUM_LEVELS); ++i) {
42 instances_[i] = Spaces::space_instance<execution_space>(
43 static_cast<Spaces::Priority
>(i));
58 template <Spaces::Priority priority = Spaces::Priority::medium>
60 return instances_[
static_cast<int>(priority)];
75 Teuchos::RCP<const execution_space>
78 case Spaces::Priority::high:
79 return space_instance<Spaces::Priority::high>();
80 case Spaces::Priority::medium:
81 return space_instance<Spaces::Priority::medium>();
82 case Spaces::Priority::low:
83 return space_instance<Spaces::Priority::low>();
85 throw std::runtime_error(
"unexpected Tpetra Space priority");
94 Teuchos::RCP<const execution_space>
95 instances_[
static_cast<int>(Spaces::Priority::NUM_LEVELS)];
102 #endif // TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
Teuchos::RCP< const execution_space > space_instance() const
Get a specific execution space instance based on the given priority level.
Teuchos::RCP< const execution_space > space_instance(const Spaces::Priority &priority) const
Get a specific execution space instance based on the given priority level.
Slot()
Default constructor that creates instances for each possible space priority level.
Lazily acquires and stores Kokkos Execution Spaces.
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.