Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_ExecutionSpacesUser.hpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
11#define TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
12
13#include <iostream>
14#include <sstream>
15#include <vector>
16
17#include <Kokkos_Core.hpp>
18
19#include "Teuchos_RCP.hpp"
20
21#include "Tpetra_Details_ExecutionSpacesSlot.hpp"
22
23namespace Tpetra {
24namespace Details {
25namespace Spaces {
26
34class User {
35 public:
36#ifdef KOKKOS_ENABLE_CUDA
37
46 template <typename ExecSpace,
47 Spaces::Priority priority = Spaces::Priority::medium,
48 Spaces::IsCuda<ExecSpace> = true>
49 Teuchos::RCP<const ExecSpace> space_instance() const {
50 return cudaSlot.space_instance<priority>();
51 }
52
62 template <typename ExecSpace, Spaces::IsCuda<ExecSpace> = true>
63 Teuchos::RCP<const ExecSpace>
65 return cudaSlot.space_instance(priority);
66 }
67#endif // KOKKOS_ENABLE_CUDA
68
69#ifdef KOKKOS_ENABLE_SERIAL
70 template <typename ExecSpace,
71 Spaces::Priority priority = Spaces::Priority::medium,
72 Spaces::IsSerial<ExecSpace> = true>
73 Teuchos::RCP<const ExecSpace> space_instance() const {
74 return serialSlot.space_instance<priority>();
75 }
76 template <typename ExecSpace, Spaces::IsSerial<ExecSpace> = true>
77 Teuchos::RCP<const ExecSpace>
79 return serialSlot.space_instance(priority);
80 }
81#endif // KOKKOS_ENABLE_SERIAL
82
83#ifdef KOKKOS_ENABLE_OPENMP
84 template <typename ExecSpace,
85 Spaces::Priority priority = Spaces::Priority::medium,
86 Spaces::IsOpenMP<ExecSpace> = true>
87 Teuchos::RCP<const ExecSpace> space_instance() const {
88 return openMPSlot.space_instance<priority>();
89 }
90 template <typename ExecSpace, Spaces::IsOpenMP<ExecSpace> = true>
91 Teuchos::RCP<const ExecSpace>
93 return openMPSlot.space_instance(priority);
94 }
95#endif // KOKKOS_ENABLE_OPENMP
96
97#ifdef KOKKOS_ENABLE_HIP
98 template <typename ExecSpace,
99 Spaces::Priority priority = Spaces::Priority::medium,
100 Spaces::IsHIP<ExecSpace> = true>
101 Teuchos::RCP<const ExecSpace> space_instance() const {
102 return HIPSlot.space_instance<priority>();
103 }
104 template <typename ExecSpace, Spaces::IsHIP<ExecSpace> = true>
105 Teuchos::RCP<const ExecSpace>
107 return HIPSlot.space_instance(priority);
108 }
109#endif // KOKKOS_ENABLE_HIP
110
111#ifdef KOKKOS_ENABLE_SYCL
112 template <typename ExecSpace,
113 Spaces::Priority priority = Spaces::Priority::medium,
114 Spaces::IsSYCL<ExecSpace> = true>
115 Teuchos::RCP<const ExecSpace> space_instance() const {
116 return SYCLSlot.space_instance<priority>();
117 }
118 template <typename ExecSpace, Spaces::IsSYCL<ExecSpace> = true>
119 Teuchos::RCP<const ExecSpace>
121 return SYCLSlot.space_instance(priority);
122 }
123#endif // KOKKOS_ENABLE_SYCL
124
125#ifdef KOKKOS_ENABLE_SERIAL
127#endif
128#ifdef KOKKOS_ENABLE_OPENMP
130#endif
131#ifdef KOKKOS_ENABLE_CUDA
133#endif
134#ifdef KOKKOS_ENABLE_HIP
136#endif
137#ifdef KOKKOS_ENABLE_SYCL
139#endif
140
141}; // User
142} // namespace Spaces
143} // namespace Details
144} // namespace Tpetra
145
146#endif // TPETRA_DETAILS_EXECUTIONSPACESUSER_HPP
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.
Struct that holds views of the contents of a CrsMatrix.
A class can inherit from this if it wants to use Tpetra managed spaces.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.