Skip to content

Commit 07282b9

Browse files
author
Yuuichi Asahi
committed
fix conflicts
1 parent edbd483 commit 07282b9

4 files changed

+27
-36
lines changed

common/src/KokkosFFT_Helpers.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ auto get_shift(const ViewType& inout, axis_type<DIM> _axes, int direction = 1) {
2323

2424
// Assert if the elements are overlapped
2525
constexpr int rank = ViewType::rank();
26-
check_precondition(!KokkosFFT::Impl::has_duplicate_values(axes),
27-
"axes are overlapped");
28-
check_precondition(
26+
KOKKOSFFT_EXPECTS(!KokkosFFT::Impl::has_duplicate_values(axes),
27+
"Axes overlap");
28+
KOKKOSFFT_EXPECTS(
2929
!KokkosFFT::Impl::is_out_of_range_value_included(axes, rank),
30-
"axes include out of range index."
31-
"axes should be in the range of [-rank, rank-1].");
30+
"Axes include an out-of-range index."
31+
"Axes must be in the range of [-rank, rank-1].");
3232

3333
axis_type<rank> shift = {0};
3434
for (int i = 0; i < static_cast<int>(DIM); i++) {

common/src/KokkosFFT_layouts.hpp

+10-12
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ auto get_extents(const InViewType& in, const OutViewType& out,
6767
if (is_real_v<in_value_type>) {
6868
// Then R2C
6969
if (is_complex_v<out_value_type>) {
70-
if (_out_extents.at(inner_most_axis) !=
71-
_in_extents.at(inner_most_axis) / 2 + 1) {
72-
throw std::runtime_error(
73-
"For R2C, the output extent of transform should be input extent / "
74-
"2 + 1");
75-
}
70+
KOKKOSFFT_EXPECTS(
71+
_out_extents.at(inner_most_axis) ==
72+
_in_extents.at(inner_most_axis) / 2 + 1,
73+
"For R2C, the 'output extent' of transform must be equal to "
74+
"'input extent'/2 + 1");
7675
} else {
7776
throw std::runtime_error(
7877
"If the input type is real, the output type should be complex");
@@ -82,12 +81,11 @@ auto get_extents(const InViewType& in, const OutViewType& out,
8281
if (is_real_v<out_value_type>) {
8382
// Then C2R
8483
if (is_complex_v<in_value_type>) {
85-
if (_in_extents.at(inner_most_axis) !=
86-
_out_extents.at(inner_most_axis) / 2 + 1) {
87-
throw std::runtime_error(
88-
"For C2R, the input extent of transform should be output extent / "
89-
"2 + 1");
90-
}
84+
KOKKOSFFT_EXPECTS(
85+
_in_extents.at(inner_most_axis) ==
86+
_out_extents.at(inner_most_axis) / 2 + 1,
87+
"For C2R, the 'input extent' of transform must be equal to "
88+
"'output extent' / 2 + 1");
9189
} else {
9290
throw std::runtime_error(
9391
"If the output type is real, the input type should be complex");

common/src/KokkosFFT_padding.hpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ auto get_modified_shape(const InViewType in, const OutViewType /* out */,
5151
}
5252

5353
// Assert if the elements are overlapped
54-
if (KokkosFFT::Impl::has_duplicate_values(positive_axes)) {
55-
throw std::runtime_error("get_modified_shape: axes are overlapped.");
56-
}
57-
if (KokkosFFT::Impl::is_out_of_range_value_included(positive_axes, rank)) {
58-
throw std::runtime_error(
59-
"get_modified_shape: axes include out of range index."
60-
"axes should be in the range of [-rank, rank-1].");
61-
}
54+
KOKKOSFFT_EXPECTS(!KokkosFFT::Impl::has_duplicate_values(positive_axes),
55+
"Axes overlap");
56+
KOKKOSFFT_EXPECTS(
57+
!KokkosFFT::Impl::is_out_of_range_value_included(positive_axes, rank),
58+
"Axes include an out-of-range index."
59+
"Axes must be in the range of [-rank, rank-1].");
6260

6361
using full_shape_type = shape_type<rank>;
6462
full_shape_type modified_shape;

common/src/KokkosFFT_utils.hpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,21 @@ inline void check_precondition(const bool expression,
5050
}
5151
throw std::runtime_error(ss.str());
5252
}
53-
inline void check_precondition(const bool expression, const std::string& msg,
54-
const char* file_name, int line,
55-
const char* function_name) {
56-
std::stringstream ss("file: ");
57-
ss << file_name << '(' << line << ") `" << function_name << "`: " << msg
58-
<< '\n';
59-
if (!expression) {
60-
throw std::runtime_error(ss.str());
61-
}
62-
}
63-
#endif
6453

6554
template <typename ViewType>
6655
auto convert_negative_axis(ViewType, int _axis = -1) {
6756
static_assert(Kokkos::is_view<ViewType>::value,
6857
"convert_negative_axis: ViewType is not a Kokkos::View.");
6958
int rank = static_cast<int>(ViewType::rank());
59+
<<<<<<< HEAD
7060
if (_axis < -rank || _axis >= rank) {
7161
throw std::runtime_error("axis should be in [-rank, rank-1]");
7262
}
63+
=======
64+
65+
KOKKOSFFT_EXPECTS(_axis >= -rank && _axis < rank,
66+
"Axis must be in [-rank, rank-1]");
67+
>>>>>>> a786585 (improve assertion)
7368

7469
int axis = _axis < 0 ? rank + _axis : _axis;
7570
return axis;

0 commit comments

Comments
 (0)