Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_ExecutionSpacesSlot.hpp
1#ifndef TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
2#define TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
3
4#include <iostream>
5#include <sstream>
6#include <vector>
7
8#include "Teuchos_RCP.hpp"
11#include <Kokkos_Core.hpp>
12
13namespace Tpetra {
14namespace Details {
15namespace Spaces {
16
22template <typename ExecSpace> class Slot {
23public:
24 using execution_space = ExecSpace;
25
30 Slot() {
31 for (int i = 0; i < static_cast<int>(Spaces::Priority::NUM_LEVELS); ++i) {
32 // retrieve an RCP from the global instance manager
34 static_cast<Spaces::Priority>(i));
35 }
36 }
37
49 template <Spaces::Priority priority = Spaces::Priority::medium>
50 Teuchos::RCP<const execution_space> space_instance() const {
51 return instances_[static_cast<int>(priority)];
52 }
53
66 Teuchos::RCP<const execution_space>
67 space_instance(const Spaces::Priority &priority) const {
68 switch (priority) {
69 case Spaces::Priority::high:
71 case Spaces::Priority::medium:
73 case Spaces::Priority::low:
75 default:
76 throw std::runtime_error("unexpected Tpetra Space priority");
77 }
78 }
79
80private:
85 Teuchos::RCP<const execution_space>
86 instances_[static_cast<int>(Spaces::Priority::NUM_LEVELS)];
87}; // Slot
88
89} // namespace Spaces
90} // namespace Details
91} // namespace Tpetra
92
93#endif // TPETRA_DETAILS_EXEUTIONSPACESSLOT_HPP
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.
Teuchos::RCP< const ExecSpace > space_instance(const Priority &priority, int i=0)
get a strong Teuchos::RCP to Tpetra-managed Kokkos execution space instance i
Priority
Priority interface for Tpetra's managed execution spaces.
Slot()
Default constructor that creates instances for each possible space 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.
Teuchos::RCP< const execution_space > space_instance() const
Get a specific execution space instance based on the given priority level.
Nonmember function that computes a residual Computes R = B - A * X.
Namespace Tpetra contains the class and methods constituting the Tpetra library.