alpaka
Abstraction Library for Parallel Kernel Acceleration
Traits.hpp
Go to the documentation of this file.
1
/* Copyright 2022 Benjamin Worpitz, Bernhard Manfred Gruber
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include "
alpaka/core/Common.hpp
"
8
#include "
alpaka/core/Interface.hpp
"
9
10
namespace
alpaka
11
{
12
struct
ConceptCurrentThreadWaitFor
13
{
14
};
15
16
//! The wait traits.
17
namespace
trait
18
{
19
//! The thread wait trait.
20
template
<
typename
TAwaited,
typename
TSfinae =
void
>
21
struct
CurrentThreadWaitFor
;
22
23
//! The waiter wait trait.
24
template
<
typename
TWaiter,
typename
TAwaited,
typename
TSfinae =
void
>
25
struct
WaiterWaitFor
;
26
}
// namespace trait
27
28
//! Waits the thread for the completion of the given awaited action to complete.
29
//!
30
//! Special Handling for events:
31
//! If the event is re-enqueued wait() will terminate when the re-enqueued event will be ready and previously
32
//! enqueued states of the event will be ignored.
33
template
<
typename
TAwaited>
34
ALPAKA_FN_HOST
auto
wait
(TAwaited
const
& awaited) ->
void
35
{
36
using
ImplementationBase
=
interface::ImplementationBase<ConceptCurrentThreadWaitFor, TAwaited>
;
37
trait::CurrentThreadWaitFor<ImplementationBase>::currentThreadWaitFor
(awaited);
38
}
39
40
//! The waiter waits for the given awaited action to complete.
41
//!
42
//! Special Handling if \p waiter is a queue and \p awaited an event:
43
//! The \p waiter waits for the event state to become ready based on the recently captured event state at the
44
//! time of the API call even if the event is being re-enqueued later.
45
template
<
typename
TWaiter,
typename
TAwaited>
46
ALPAKA_FN_HOST
auto
wait
(TWaiter& waiter, TAwaited
const
& awaited) ->
void
47
{
48
trait::WaiterWaitFor<TWaiter, TAwaited>::waiterWaitFor
(waiter, awaited);
49
}
50
}
// namespace alpaka
Interface.hpp
Common.hpp
ALPAKA_FN_HOST
#define ALPAKA_FN_HOST
Definition:
Common.hpp:40
alpaka::interface::ImplementationBase
typename detail::ImplementationBaseType< TInterface, TDerived >::type ImplementationBase
Returns the type that implements the given interface in the inheritance hierarchy.
Definition:
Interface.hpp:66
alpaka
The alpaka accelerator library.
Definition:
AccCpuOmp2Blocks.hpp:49
alpaka::wait
ALPAKA_FN_HOST auto wait(TAwaited const &awaited) -> void
Waits the thread for the completion of the given awaited action to complete.
Definition:
Traits.hpp:34
alpaka::ConceptCurrentThreadWaitFor
Definition:
Traits.hpp:13
alpaka::trait::CurrentThreadWaitFor
The thread wait trait.
Definition:
Traits.hpp:21
alpaka::trait::WaiterWaitFor
The waiter wait trait.
Definition:
Traits.hpp:25
include
alpaka
wait
Traits.hpp
Generated on Thu Nov 21 2024 22:46:14 for alpaka by
1.9.1