isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ComputeCapability.h
1 #pragma once
2 
3 #include <iostream>
4 #include <string>
5 
6 namespace isce3 { namespace cuda { namespace core {
7 
21  constexpr ComputeCapability(int major, int minor)
22  : major {major}, minor {minor}
23  {}
24 
25  explicit operator std::string() const
26  {
27  return std::to_string(major) + "." + std::to_string(minor);
28  }
29 
30  friend std::ostream& operator<<(std::ostream& os, ComputeCapability cc)
31  {
32  return os << std::string(cc);
33  }
34 
35  friend constexpr bool operator==(ComputeCapability lhs,
36  ComputeCapability rhs) noexcept
37  {
38  return lhs.major == rhs.major and lhs.minor == rhs.minor;
39  }
40 
41  friend constexpr bool operator!=(ComputeCapability lhs,
42  ComputeCapability rhs) noexcept
43  {
44  return not(lhs == rhs);
45  }
46 
47  friend constexpr bool operator<(ComputeCapability lhs,
48  ComputeCapability rhs) noexcept
49  {
50  return lhs.major < rhs.major or
51  (lhs.major == rhs.major and lhs.minor < rhs.minor);
52  }
53 
54  friend constexpr bool operator>(ComputeCapability lhs,
55  ComputeCapability rhs) noexcept
56  {
57  return lhs.major > rhs.major or
58  (lhs.major == rhs.major and lhs.minor > rhs.minor);
59  }
60 
61  friend constexpr bool operator<=(ComputeCapability lhs,
62  ComputeCapability rhs) noexcept
63  {
64  return not(lhs > rhs);
65  }
66 
67  friend constexpr bool operator>=(ComputeCapability lhs,
68  ComputeCapability rhs) noexcept
69  {
70  return not(lhs < rhs);
71  }
72 
73  int major;
74  int minor;
75 };
76 
78 constexpr ComputeCapability minComputeCapability() noexcept { return {3, 5}; }
79 
80 }}} // namespace isce3::cuda::core
CUDA device compute capability.
Definition: ComputeCapability.h:14
int major
Major compute version.
Definition: ComputeCapability.h:73
constexpr ComputeCapability(int major, int minor)
Construct a new ComputeCapability object.
Definition: ComputeCapability.h:21
int minor
Minor compute version.
Definition: ComputeCapability.h:74

Generated for ISCE3.0 by doxygen 1.8.5.