-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Use batched copy if. #6826
Use batched copy if. #6826
Conversation
void CopyIf(InIt in_first, InIt in_second, OutIt out_first, Predicate pred) { | ||
// We loop over batches because thrust::copy_if cant deal with sizes > 2^31 | ||
// See thrust issue #1302, #6822 | ||
size_t max_copy_size = std::numeric_limits<int>::max() / 2; |
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.
Not sure what standard current compiler supports, but this can be a 'constexpr', since max is. See example:
https://en.cppreference.com/w/cpp/language/constant_expression
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 see "XGBoost now adopts the C++14 standard", it should be allowed.
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.
@vkuzmin-uber Thanks for the review, I will open another PR for constexpr. Most of the time the compiler should be able to eliminate these constants automatically so did not pay enough attention to it, thanks for pointing it out.
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 see it is merged already. Leave comment just in case - constexpr for expressions like this makes sense
Close #6822 .