Ginkgo Generated from branch based on master. Ginkgo version 1.7.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
version.hpp
1/*******************************<GINKGO LICENSE>******************************
2Copyright (c) 2017-2023, the Ginkgo authors
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
8
91. Redistributions of source code must retain the above copyright
10notice, this list of conditions and the following disclaimer.
11
122. Redistributions in binary form must reproduce the above copyright
13notice, this list of conditions and the following disclaimer in the
14documentation and/or other materials provided with the distribution.
15
163. Neither the name of the copyright holder nor the names of its
17contributors may be used to endorse or promote products derived from
18this software without specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31******************************<GINKGO LICENSE>*******************************/
32
33#ifndef GKO_PUBLIC_CORE_BASE_VERSION_HPP_
34#define GKO_PUBLIC_CORE_BASE_VERSION_HPP_
35
36
37#include <ostream>
38
39
40#include <ginkgo/config.hpp>
41#include <ginkgo/core/base/types.hpp>
42
43
44namespace gko {
45
46
54struct version {
55 constexpr version(const uint64 major, const uint64 minor,
56 const uint64 patch, const char* tag)
58 {}
59
64
69
74
80 const char* const tag;
81};
82
83inline bool operator==(const version& first, const version& second)
84{
85 return first.major == second.major && first.minor == second.minor &&
86 first.patch == second.patch;
87}
88
89inline bool operator!=(const version& first, const version& second)
90{
91 return !(first == second);
92}
93
94inline bool operator<(const version& first, const version& second)
95{
96 if (first.major < second.major) return true;
97 if (first.major == second.major && first.minor < second.minor) return true;
98 if (first.major == second.major && first.minor == second.minor &&
99 first.patch < second.patch)
100 return true;
101 return false;
102}
103
104inline bool operator<=(const version& first, const version& second)
105{
106 return !(second < first);
107}
108
109inline bool operator>(const version& first, const version& second)
110{
111 return second < first;
112}
113
114inline bool operator>=(const version& first, const version& second)
115{
116 return !(first < second);
117}
118
119#undef GKO_ENABLE_VERSION_COMPARISON
120
121
130inline std::ostream& operator<<(std::ostream& os, const version& ver)
131{
132 os << ver.major << "." << ver.minor << "." << ver.patch;
133 if (ver.tag) {
134 os << " (" << ver.tag << ")";
135 }
136 return os;
137}
138
139
162public:
168 static const version_info& get()
169 {
170 static version_info info{};
171 return info;
172 }
173
178
185
193
200
207
214
221
222private:
223 static constexpr version get_header_version() noexcept
224 {
225 return version{GKO_VERSION_MAJOR, GKO_VERSION_MINOR, GKO_VERSION_PATCH,
226 GKO_VERSION_TAG};
227 }
228
229 static version get_core_version() noexcept;
230
231 static version get_reference_version() noexcept;
232
233 static version get_omp_version() noexcept;
234
235 static version get_cuda_version() noexcept;
236
237 static version get_hip_version() noexcept;
238
239 static version get_dpcpp_version() noexcept;
240
242 : header_version{get_header_version()},
243 core_version{get_core_version()},
244 reference_version{get_reference_version()},
245 omp_version{get_omp_version()},
246 cuda_version{get_cuda_version()},
247 hip_version{get_hip_version()},
248 dpcpp_version{get_dpcpp_version()}
249 {}
250};
251
252
261std::ostream& operator<<(std::ostream& os, const version_info& ver_info);
262
263
264} // namespace gko
265
266
267#endif // GKO_PUBLIC_CORE_BASE_VERSION_HPP_
Ginkgo uses version numbers to label new features and to communicate backward compatibility guarantee...
Definition version.hpp:161
version dpcpp_version
Contains version information of the DPC++ module.
Definition version.hpp:220
version header_version
Contains version information of the header files.
Definition version.hpp:177
version cuda_version
Contains version information of the CUDA module.
Definition version.hpp:206
version reference_version
Contains version information of the reference module.
Definition version.hpp:192
version omp_version
Contains version information of the OMP module.
Definition version.hpp:199
version core_version
Contains version information of the core library.
Definition version.hpp:184
version hip_version
Contains version information of the HIP module.
Definition version.hpp:213
static const version_info & get()
Returns an instance of version_info.
Definition version.hpp:168
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
std::uint64_t uint64
64-bit unsigned integral type.
Definition types.hpp:166
constexpr bool operator!=(const dim< Dimensionality, DimensionType > &x, const dim< Dimensionality, DimensionType > &y)
Checks if two dim objects are different.
Definition dim.hpp:258
This structure is used to represent versions of various Ginkgo modules.
Definition version.hpp:54
const uint64 major
The major version number.
Definition version.hpp:63
const char *const tag
Addition tag string that describes the version in more detail.
Definition version.hpp:80
const uint64 patch
The patch version number.
Definition version.hpp:73
const uint64 minor
The minor version number.
Definition version.hpp:68