Kokkos Core Kernels Package Version of the Day
Loading...
Searching...
No Matches
Kokkos_TaskScheduler_fwd.hpp
1//@HEADER
2// ************************************************************************
3//
4// Kokkos v. 4.0
5// Copyright (2022) National Technology & Engineering
6// Solutions of Sandia, LLC (NTESS).
7//
8// Under the terms of Contract DE-NA0003525 with NTESS,
9// the U.S. Government retains certain rights in this software.
10//
11// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
12// See https://kokkos.org/LICENSE for license information.
13// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14//
15//@HEADER
16
17#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18#include <Kokkos_Macros.hpp>
19static_assert(false,
20 "Including non-public Kokkos header files is not allowed.");
21#endif
22#ifndef KOKKOS_TASKSCHEDULER_FWD_HPP
23#define KOKKOS_TASKSCHEDULER_FWD_HPP
24
25//----------------------------------------------------------------------------
26
27#include <cstddef>
28#include <Kokkos_Macros.hpp>
29#if defined(KOKKOS_ENABLE_TASKDAG)
30
31#include <Kokkos_Core_fwd.hpp>
32//----------------------------------------------------------------------------
33
34#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
35// We allow using deprecated classes in this file
36KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH()
37#endif
38
39namespace Kokkos {
40
41// Forward declarations used in Impl::TaskQueue
42
43template <typename ValueType, typename Scheduler>
44class KOKKOS_DEPRECATED BasicFuture;
45
46template <class Space, class Queue>
47class KOKKOS_DEPRECATED SimpleTaskScheduler;
48
49template <class Space, class Queue>
50class KOKKOS_DEPRECATED BasicTaskScheduler;
51
52template <typename Space>
53struct KOKKOS_DEPRECATED is_scheduler : public std::false_type {};
54
55template <class Space, class Queue>
56struct KOKKOS_DEPRECATED is_scheduler<BasicTaskScheduler<Space, Queue>>
57 : public std::true_type {};
58
59template <class Space, class Queue>
60struct KOKKOS_DEPRECATED is_scheduler<SimpleTaskScheduler<Space, Queue>>
61 : public std::true_type {};
62
63enum class KOKKOS_DEPRECATED TaskPriority : int {
64 High = 0,
65 Regular = 1,
66 Low = 2
67};
68
69} // namespace Kokkos
70
71//----------------------------------------------------------------------------
72
73namespace Kokkos {
74
75template <class Device>
76class MemoryPool;
77
78namespace Impl {
79
80template <class TaskQueueTraits>
81class TaskNode;
82
83class TaskBase;
84
85/*\brief Implementation data for task data management, access, and execution.
86 * (Deprecated)
87 * CRTP Inheritance structure to allow static_cast from the
88 * task root type and a task's FunctorType.
89 *
90 * TaskBase< Space , ResultType , FunctorType >
91 * : TaskBase< Space , ResultType , void >
92 * , FunctorType
93 * { ... };
94 *
95 * TaskBase< Space , ResultType , void >
96 * : TaskBase< Space , void , void >
97 * { ... };
98 */
99template <typename Space, typename ResultType, typename FunctorType>
100class Task;
101
102class TaskQueueBase;
103
104template <typename Space, typename MemorySpace>
105class TaskQueue;
106
107template <typename ExecSpace, typename MemorySpace>
108class TaskQueueMultiple;
109
110template <typename ExecSpace, typename MemSpace, typename TaskQueueTraits,
111 class MemoryPool =
113class SingleTaskQueue;
114
115template <typename ExecSpace, typename MemSpace, typename TaskQueueTraits,
116 class MemoryPool>
117class MultipleTaskQueue;
118
119struct TaskQueueTraitsLockBased;
120
121template <size_t CircularBufferSize = 64>
122struct TaskQueueTraitsChaseLev;
123
124template <typename ResultType>
125struct TaskResult;
126
127struct TaskSchedulerBase;
128
129template <class ExecSpace>
130struct default_tasking_memory_space_for_execution_space {
131 using type = typename ExecSpace::memory_space;
132};
133
134#if defined(KOKKOS_ENABLE_CUDA)
135template <>
136struct default_tasking_memory_space_for_execution_space<Kokkos::Cuda> {
137 using type = Kokkos::CudaUVMSpace;
138};
139#endif
140
141template <class ExecSpace>
142using default_tasking_memory_space_for_execution_space_t =
143 typename default_tasking_memory_space_for_execution_space<ExecSpace>::type;
144
145} // namespace Impl
146} // namespace Kokkos
147
148//----------------------------------------------------------------------------
149
150namespace Kokkos {
151
152template <typename Space>
153using DeprecatedTaskScheduler KOKKOS_DEPRECATED = BasicTaskScheduler<
154 Space,
155 Impl::TaskQueue<
156 Space,
157 Impl::default_tasking_memory_space_for_execution_space_t<Space>>>;
158
159template <typename Space>
160using DeprecatedTaskSchedulerMultiple KOKKOS_DEPRECATED = BasicTaskScheduler<
161 Space,
162 Impl::TaskQueueMultiple<
163 Space,
164 Impl::default_tasking_memory_space_for_execution_space_t<Space>>>;
165
166template <typename Space>
167using TaskScheduler KOKKOS_DEPRECATED = SimpleTaskScheduler<
168 Space,
169 Impl::SingleTaskQueue<
170 Space, Impl::default_tasking_memory_space_for_execution_space_t<Space>,
171 Impl::TaskQueueTraitsLockBased>>;
172
173template <typename Space>
174using TaskSchedulerMultiple KOKKOS_DEPRECATED = SimpleTaskScheduler<
175 Space,
176 Impl::MultipleTaskQueue<
177 Space, Impl::default_tasking_memory_space_for_execution_space_t<Space>,
178 Impl::TaskQueueTraitsLockBased,
179 Kokkos::MemoryPool<Kokkos::Device<
180 Space,
181 Impl::default_tasking_memory_space_for_execution_space_t<Space>>>>>;
182
183template <typename Space>
184using ChaseLevTaskScheduler KOKKOS_DEPRECATED = SimpleTaskScheduler<
185 Space,
186 Impl::MultipleTaskQueue<
187 Space, Impl::default_tasking_memory_space_for_execution_space_t<Space>,
188 Impl::TaskQueueTraitsChaseLev<>,
189 Kokkos::MemoryPool<Kokkos::Device<
190 Space,
191 Impl::default_tasking_memory_space_for_execution_space_t<Space>>>>>;
192
193template <class Space, class QueueType>
194KOKKOS_DEPRECATED void wait(BasicTaskScheduler<Space, QueueType> const&);
195
196namespace Impl {
197
198struct TaskSchedulerBase {};
199
200class TaskQueueBase {};
201
202template <typename Scheduler, typename EnableIfConstraint = void>
203class TaskQueueSpecializationConstrained {};
204
205template <typename Scheduler>
206struct TaskQueueSpecialization : TaskQueueSpecializationConstrained<Scheduler> {
207};
208
209template <int, typename>
210struct TaskPolicyData;
211
212} // end namespace Impl
213
214} // namespace Kokkos
215
216#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS
217KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP()
218#endif
219
220//----------------------------------------------------------------------------
221
222#endif /* #if defined( KOKKOS_ENABLE_TASKDAG ) */
223#endif /* #ifndef KOKKOS_TASKSCHEDULER_FWD_HPP */
A thread safe view to a bitset.