alpaka
Abstraction Library for Parallel Kernel Acceleration
Functional.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
9
namespace
alpaka::meta
10
{
11
template
<
typename
T>
12
struct
min
13
{
14
ALPAKA_NO_HOST_ACC_WARNING
15
ALPAKA_FN_HOST_ACC
constexpr
auto
operator()
(T
const
& lhs, T
const
& rhs)
const
16
{
17
return
(lhs < rhs) ? lhs : rhs;
18
}
19
};
20
21
template
<
typename
T>
22
struct
max
23
{
24
ALPAKA_NO_HOST_ACC_WARNING
25
ALPAKA_FN_HOST_ACC
constexpr
auto
operator()
(T
const
& lhs, T
const
& rhs)
const
26
{
27
return
(lhs > rhs) ? lhs : rhs;
28
}
29
};
30
}
// namespace alpaka::meta
Common.hpp
ALPAKA_FN_HOST_ACC
#define ALPAKA_FN_HOST_ACC
Definition:
Common.hpp:39
ALPAKA_NO_HOST_ACC_WARNING
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
Definition:
Common.hpp:82
alpaka::meta
Definition:
Apply.hpp:8
alpaka::meta::max
Definition:
Functional.hpp:23
alpaka::meta::max::operator()
ALPAKA_NO_HOST_ACC_WARNING constexpr ALPAKA_FN_HOST_ACC auto operator()(T const &lhs, T const &rhs) const
Definition:
Functional.hpp:25
alpaka::meta::min
Definition:
Functional.hpp:13
alpaka::meta::min::operator()
ALPAKA_NO_HOST_ACC_WARNING constexpr ALPAKA_FN_HOST_ACC auto operator()(T const &lhs, T const &rhs) const
Definition:
Functional.hpp:15
include
alpaka
meta
Functional.hpp
Generated on Thu Nov 21 2024 22:46:15 for alpaka by
1.9.1