-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace assert with runtime error #122
Replace assert with runtime error #122
Conversation
Maybe you could abstract that away and have a precondition check utility that takes a message as argument. |
Makes sense. So I would introduce something like this? void throw_runtime_error(const bool condition, const std::string &msg) {
if (condition) {
throw std::runtime_error(msg);
}
} |
You probably want to call it something else, possibly |
That is a better name. We are currently supporting C++17, so maybe using a macro. |
@yasahi-hpc: do you have strong requirements from users for supporting C++17 and not requiring C++20? |
I do not think so. I was just planning to require C++20 at the same time as Kokkos. |
@cedricchevalier19 |
@dalg24 I guess is OK now. Can I have your second review please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked in details but it looks like the right direction
I think so. I am inclined to improve the compile time and runtime errors. Still insufficient though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, are you sure the CI tests both C++20 and no C++20?
I was planning to add C++20 after this PR, but it may be better to do that before |
30ea12f
to
2a1d1d9
Compare
75b7015
to
07282b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Improves #80
This PR aims at replacing runtime
assert
withstd::runtime_error
with appropriate messages.If there is inconsistency in extents, we cannot operate FFT.
Modifications are applied to
get_shift
,get_extents
,get_modified_shape
andconvert_negative_axis
. For example, inget_shift
, we replacedassert
withstd::runtime_error
in the following way.Following modifications are made
assert
withstd::runtime_error
std::runtime_error
is correctly thrown.has_duplicate_values
check_precondition(expression, message)
functionKOKKOSFFT_EXPECTS(expression, message)
macro