numerics 0.1.0
Loading...
Searching...
No Matches
policy.hpp
Go to the documentation of this file.
1/// @file policy.hpp
2/// @brief Backend enum and default backend selection.
3#pragma once
4
5namespace num {
6
7enum class Backend {
8 seq,
10 simd,
11 blas,
12 omp,
13 gpu,
14 lapack,
15};
16
17inline constexpr Backend seq = Backend::seq;
18inline constexpr Backend blocked = Backend::blocked;
19inline constexpr Backend simd = Backend::simd;
20inline constexpr Backend blas = Backend::blas;
21inline constexpr Backend omp = Backend::omp;
22inline constexpr Backend gpu = Backend::gpu;
23inline constexpr Backend lapack = Backend::lapack;
24
25inline constexpr bool has_blas =
26#if defined(NUMERICS_HAS_BLAS)
27 true;
28#else
29 false;
30#endif
31
32inline constexpr bool has_lapack =
33#if defined(NUMERICS_HAS_LAPACK)
34 true;
35#else
36 false;
37#endif
38
39inline constexpr bool has_omp =
40#if defined(NUMERICS_HAS_OMP)
41 true;
42#else
43 false;
44#endif
45
46inline constexpr bool has_simd =
47#if defined(NUMERICS_HAS_SIMD)
48 true;
49#else
50 false;
51#endif
52
53inline constexpr Backend default_backend =
54#if defined(NUMERICS_HAS_BLAS)
56#elif defined(NUMERICS_HAS_OMP)
58#elif defined(NUMERICS_HAS_SIMD)
60#else
62#endif
63
65
66inline constexpr Backend lapack_backend =
67#if defined(NUMERICS_HAS_LAPACK)
69#elif defined(NUMERICS_HAS_OMP)
71#else
73#endif
74
75} // namespace num
constexpr Backend simd
Definition policy.hpp:19
Backend
Definition policy.hpp:7
constexpr Backend best_backend
Definition policy.hpp:64
constexpr Backend lapack_backend
Definition policy.hpp:66
constexpr Backend gpu
Definition policy.hpp:22
constexpr bool has_lapack
Definition policy.hpp:32
constexpr bool has_blas
Definition policy.hpp:25
constexpr Backend default_backend
Definition policy.hpp:53
constexpr bool has_simd
Definition policy.hpp:46
constexpr bool has_omp
Definition policy.hpp:39
constexpr Backend blas
Definition policy.hpp:20
constexpr Backend lapack
Definition policy.hpp:23
constexpr Backend omp
Definition policy.hpp:21
constexpr Backend seq
Definition policy.hpp:17
constexpr Backend blocked
Definition policy.hpp:18