Skip to content

Commit eabe2dd

Browse files
committed
fixes for the CUDA build
1 parent 9bc0c69 commit eabe2dd

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

kul.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,12 @@ class conversion {
11791179
};
11801180

11811181
template <class T, class From, class To>
1182-
inline constexpr conversion<T> static_conversion = conversion<T>(
1182+
KOKKOS_INLINE_FUNCTION constexpr conversion<T> static_conversion()
1183+
{
1184+
return conversion<T>(
11831185
From::static_magnitude(), From::static_origin(),
11841186
To::static_magnitude(), To::static_origin());
1187+
}
11851188

11861189
// Section [prefix]: class template versions of metric prefixes
11871190

@@ -1528,7 +1531,7 @@ class quantity {
15281531
std::enable_if_t<!are_equal<Unit, Unit2>, bool> = false>
15291532
KOKKOS_INLINE_FUNCTION constexpr
15301533
quantity(quantity<T2, Unit2> const& other)
1531-
:m_value(static_conversion<T2, Unit2, Unit>(other.value()))
1534+
:m_value(static_conversion<T2, Unit2, Unit>()(other.value()))
15321535
{
15331536
static_assert(Unit::static_dimension() == Unit2::static_dimension(),
15341537
"cannot convert between quantities with different dimensions");

kul_unit_tests.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ TEST(conversion, in_mm)
331331

332332
TEST(static_conversion, in_mm)
333333
{
334-
auto constexpr c = kul::static_conversion<double, kul::inch, kul::milli<kul::meter>>;
334+
auto constexpr c = kul::static_conversion<double, kul::inch, kul::milli<kul::meter>>();
335335
auto constexpr v = c(1.0);
336336
static_assert(v == 25.4, "static inch to mm");
337337
}
@@ -364,20 +364,20 @@ TEST(quantity, compare)
364364
static_assert(c1 >= c1, "constexpr greater-than-or-equal of equal");
365365
auto const r1 = kul::quantity<double, kul::meter>(1.0);
366366
auto const r2 = kul::quantity<double, kul::meter>(2.0);
367-
EXPECT_TRUE(c1 == c1);
368-
EXPECT_TRUE(!(c1 != c1));
369-
EXPECT_TRUE(!(c1 == c2));
370-
EXPECT_TRUE(c1 != c2);
371-
EXPECT_TRUE(c1 < c2);
372-
EXPECT_TRUE(!(c1 > c2));
373-
EXPECT_TRUE(!(c2 < c1));
374-
EXPECT_TRUE(c2 > c1);
375-
EXPECT_TRUE(c1 <= c2);
376-
EXPECT_TRUE(!(c1 >= c2));
377-
EXPECT_TRUE(!(c2 <= c1));
378-
EXPECT_TRUE(c2 >= c1);
379-
EXPECT_TRUE(c1 <= c1);
380-
EXPECT_TRUE(c1 >= c1);
367+
EXPECT_TRUE(r1 == r1);
368+
EXPECT_TRUE(!(r1 != r1));
369+
EXPECT_TRUE(!(r1 == r2));
370+
EXPECT_TRUE(r1 != r2);
371+
EXPECT_TRUE(r1 < r2);
372+
EXPECT_TRUE(!(r1 > r2));
373+
EXPECT_TRUE(!(r2 < r1));
374+
EXPECT_TRUE(r2 > r1);
375+
EXPECT_TRUE(r1 <= r2);
376+
EXPECT_TRUE(!(r1 >= r2));
377+
EXPECT_TRUE(!(r2 <= r1));
378+
EXPECT_TRUE(r2 >= r1);
379+
EXPECT_TRUE(r1 <= r1);
380+
EXPECT_TRUE(r1 >= r1);
381381
}
382382

383383
TEST(quantity, add)

p3a_quantity.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ struct minimum<quantity<T, Unit>> {
123123

124124
template <class M, class T, class Unit,
125125
std::enable_if_t<!std::is_same_v<M, bool>, bool> = false>
126-
P3A_HOST_DEVICE P3A_ALWAYS_INLINE
126+
P3A_HOST_DEVICE P3A_ALWAYS_INLINE inline
127127
auto condition(M const& mask, quantity<T, Unit> const& a, quantity<T, Unit> const& b)
128128
{
129129
return quantity<T, Unit>(condition(mask, a.value(), b.value()));
130130
}
131131

132132
template <class T, class Unit, class Abi>
133-
P3A_HOST_DEVICE P3A_ALWAYS_INLINE
133+
P3A_HOST_DEVICE P3A_ALWAYS_INLINE inline
134134
auto load(
135135
quantity<T, Unit> const* ptr,
136136
int offset,
@@ -140,7 +140,7 @@ auto load(
140140
}
141141

142142
template <class T, class Unit, class Abi>
143-
P3A_HOST_DEVICE P3A_ALWAYS_INLINE
143+
P3A_HOST_DEVICE P3A_ALWAYS_INLINE inline
144144
void store(
145145
quantity<simd<T, Abi>, Unit> const& q,
146146
quantity<T, Unit>* ptr,
@@ -151,7 +151,7 @@ void store(
151151
}
152152

153153
template <class T, class Unit, class Abi, class Integral>
154-
P3A_HOST_DEVICE P3A_ALWAYS_INLINE
154+
P3A_HOST_DEVICE P3A_ALWAYS_INLINE inline
155155
auto load(
156156
quantity<T, Unit> const* ptr,
157157
simd<Integral, Abi> const& offset,
@@ -161,7 +161,7 @@ auto load(
161161
}
162162

163163
template <class T, class Unit, class Abi, class Integral>
164-
P3A_HOST_DEVICE P3A_ALWAYS_INLINE
164+
P3A_HOST_DEVICE P3A_ALWAYS_INLINE inline
165165
void store(
166166
quantity<simd<T, Abi>, Unit> const& q,
167167
quantity<T, Unit>* ptr,

0 commit comments

Comments
 (0)