xtensor
Loading...
Searching...
No Matches
xtensor_config.hpp
1
/***************************************************************************
2
* Copyright (c) Johan Mabille, Sylvain Corlay and Wolf Vollprecht *
3
* Copyright (c) QuantStack *
4
* *
5
* Distributed under the terms of the BSD 3-Clause License. *
6
* *
7
* The full license is in the file LICENSE, distributed with this software. *
8
****************************************************************************/
9
10
#ifndef XTENSOR_CONFIG_HPP
11
#define XTENSOR_CONFIG_HPP
12
13
#define XTENSOR_VERSION_MAJOR 0
14
#define XTENSOR_VERSION_MINOR 27
15
#define XTENSOR_VERSION_PATCH 1
16
17
18
// Define if the library is going to be using exceptions.
19
#if (!defined(__cpp_exceptions) && !defined(__EXCEPTIONS) && !defined(_CPPUNWIND))
20
#undef XTENSOR_DISABLE_EXCEPTIONS
21
#define XTENSOR_DISABLE_EXCEPTIONS
22
#endif
23
24
// Exception support.
25
#if defined(XTENSOR_DISABLE_EXCEPTIONS)
26
#include <iostream>
27
#define XTENSOR_THROW(_, msg) \
28
{ \
29
std::cerr << msg << std::endl; \
30
std::abort(); \
31
}
32
#else
33
#define XTENSOR_THROW(exception, msg) throw exception(msg)
34
#endif
35
36
// Workaround for some missing constexpr functionality in MSVC 2015 and MSVC 2017 x86
37
#if defined(_MSC_VER)
38
// The following must not be defined to const, otherwise
39
// it prevents generation of copy operators of classes
40
// containing XTENSOR_CONSTEXPR_ENHANCED_STATIC members
41
#define XTENSOR_CONSTEXPR_ENHANCED_STATIC
42
#else
43
#define XTENSOR_CONSTEXPR_ENHANCED_STATIC constexpr static
44
#endif
45
46
#ifndef XTENSOR_DEFAULT_DATA_CONTAINER
47
#define XTENSOR_DEFAULT_DATA_CONTAINER(T, A) uvector<T, A>
48
#endif
49
50
#ifndef XTENSOR_DEFAULT_SHAPE_CONTAINER
51
#define XTENSOR_DEFAULT_SHAPE_CONTAINER(T, EA, SA) \
52
xt::svector<typename XTENSOR_DEFAULT_DATA_CONTAINER(T, EA)::size_type, 4, SA, true>
53
#endif
54
55
#ifdef XTENSOR_USE_XSIMD
56
#include <xsimd/xsimd.hpp>
57
#define XSIMD_DEFAULT_ALIGNMENT xsimd::default_arch::alignment()
58
#endif
59
60
61
#ifndef XTENSOR_DEFAULT_ALLOCATOR
62
#ifdef XTENSOR_ALLOC_TRACKING
63
#ifndef XTENSOR_ALLOC_TRACKING_POLICY
64
#define XTENSOR_ALLOC_TRACKING_POLICY xt::alloc_tracking::policy::print
65
#endif
66
#ifdef XTENSOR_USE_XSIMD
67
#include <xsimd/xsimd.hpp>
68
#define XTENSOR_DEFAULT_ALLOCATOR(T) \
69
xt::tracking_allocator<T, xsimd::aligned_allocator<T, XSIMD_DEFAULT_ALIGNMENT>, XTENSOR_ALLOC_TRACKING_POLICY>
70
#else
71
#define XTENSOR_DEFAULT_ALLOCATOR(T) \
72
xt::tracking_allocator<T, std::allocator<T>, XTENSOR_ALLOC_TRACKING_POLICY>
73
#endif
74
#else
75
#ifdef XTENSOR_USE_XSIMD
76
77
#define XTENSOR_DEFAULT_ALLOCATOR(T) xsimd::aligned_allocator<T, XTENSOR_DEFAULT_ALIGNMENT>
78
#else
79
#define XTENSOR_DEFAULT_ALLOCATOR(T) std::allocator<T>
80
#endif
81
#endif
82
#endif
83
84
#ifndef XTENSOR_DEFAULT_ALIGNMENT
85
#ifdef XTENSOR_USE_XSIMD
86
#define XTENSOR_DEFAULT_ALIGNMENT XSIMD_DEFAULT_ALIGNMENT
87
#else
88
#define XTENSOR_DEFAULT_ALIGNMENT 0
89
#endif
90
#endif
91
92
#ifndef XTENSOR_DEFAULT_LAYOUT
93
#define XTENSOR_DEFAULT_LAYOUT ::xt::layout_type::row_major
94
#endif
95
96
#ifndef XTENSOR_DEFAULT_TRAVERSAL
97
#define XTENSOR_DEFAULT_TRAVERSAL ::xt::layout_type::row_major
98
#endif
99
100
#ifndef XTENSOR_OPENMP_TRESHOLD
101
#define XTENSOR_OPENMP_TRESHOLD 0
102
#endif
103
104
#ifndef XTENSOR_TBB_THRESHOLD
105
#define XTENSOR_TBB_THRESHOLD 0
106
#endif
107
108
#ifndef XTENSOR_SELECT_ALIGN
109
#define XTENSOR_SELECT_ALIGN(T) (XTENSOR_DEFAULT_ALIGNMENT != 0 ? XTENSOR_DEFAULT_ALIGNMENT : alignof(T))
110
#endif
111
112
#ifndef XTENSOR_FIXED_ALIGN
113
#define XTENSOR_FIXED_ALIGN XTENSOR_SELECT_ALIGN(void*)
114
#endif
115
116
#ifdef IN_DOXYGEN
117
namespace
xtl
118
{
119
template
<
class
... T>
120
struct
conjunction
121
{
122
constexpr
bool
value =
true
;
123
};
124
125
template
<
class
... C>
126
using
check_concept = std::enable_if_t<
conjunction
<C...>::value,
int
>;
127
128
#define XTL_REQUIRES(...) xtl::check_concept<__VA_ARGS__> = 0
129
}
130
#endif
131
132
#endif
xtl::conjunction
Definition
xtensor_config.hpp:121
include
xtensor
core
xtensor_config.hpp
Generated by
1.13.2