-
Notifications
You must be signed in to change notification settings - Fork 565
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
Add feature to print forest shape in FIL upon importing #3763
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
1245d00
try 1
levsnv c81eb32
fixes
levsnv e8433c1
fixed
levsnv 2759de3
Apply suggestions from code review
levsnv e21f0e9
addressed review comments
levsnv 3f4a5d6
refactor
levsnv 9e5c5a4
style
levsnv 8ae9e5f
style
levsnv fe12e6c
Merge remote-tracking branch 'origin/refactor-cython-kwargs' into pri…
levsnv 5f85f27
Merge branch 'branch-0.20' into print-model-shape
levsnv 31f9f46
fix memory leaks; confusing naming
levsnv 22abfd4
stop sprawling code duplication
levsnv 456ca96
Merge branch 'print-model-shape' of github.com:levsnv/cuml into print…
levsnv 6fa42ca
Merge remote-tracking branch 'rapidsai/branch-0.20' into print-model-…
levsnv b07e8d7
Merge branch 'branch-0.20' of github.com:rapidsai/cuml into print-mod…
levsnv b42a3d5
Apply suggestions from code review
levsnv d1d6917
addressed review comments except one
levsnv e719e7b
fixed FNV to standard byte-based, added tests
levsnv 93d0c31
style
levsnv 64423b8
Merge branch 'branch-0.20' of github.com:rapidsai/cuml into print-mod…
levsnv a9f7ac9
fixed copyright issues, excluded trivial implementation of public code
levsnv d3c24f9
style, copyright
levsnv f5f825f
addressed review comments
levsnv 47d5911
added back " MB" suffix
levsnv 6b41953
fixed insufficient precision
levsnv 739940b
fix extra <<
levsnv 7e6302f
switched from forest_shape_file to compute_shape_str and shape_str
levsnv dcce65a
copyright.year
levsnv 2a07441
style, documentation
levsnv 0d2a420
more verbose error message
levsnv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2021, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <limits.h> | ||
#include <cstdint> | ||
#include <numeric> | ||
|
||
// Implements https://tools.ietf.org/html/draft-eastlake-fnv-17.html | ||
// Algorithm is public domain, non-cryptographic strength and no patents or rights to patent. | ||
// If input elements are not 8-bit, such a computation does not match | ||
// the FNV spec. | ||
template <typename It> | ||
unsigned long long fowler_noll_vo_fingerprint64(It begin, It end) { | ||
static_assert(sizeof(*begin) == 1, | ||
"FNV deals with byte-sized (octet) input arrays only"); | ||
return std::accumulate(begin, end, 14695981039346656037ull, | ||
[](const unsigned long long& fingerprint, auto x) { | ||
return (fingerprint * 0x100000001b3ull) ^ x; | ||
}); | ||
} | ||
|
||
// xor-folded fingerprint64 to ensure first bits are affected by other input bits | ||
// should give a 1% collision probability within a 10'000 hash set | ||
template <typename It> | ||
uint32_t fowler_noll_vo_fingerprint64_32(It begin, It end) { | ||
unsigned long long fp64 = fowler_noll_vo_fingerprint64(begin, end); | ||
return (fp64 & UINT_MAX) ^ (fp64 >> 32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What are
.blocks_per_sm
doing here?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.
In short, the compiler was complaining about non-standard initializers, which is a gcc extension before C++20: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
I had forgotten to add the
.blocks_per_sm=0
in the relevant PR, but it must have gotten default-initialized to 0 and worked well enough to miss the issue.Now, with the trailing member added, it may be triggering the gcc limitation on out-of-order designated initializers. If I also omit
.pforest_shape_str=nullptr
, I am setting us up for even more pain down the road, even if it works.Maybe there's a different workaround, but wouldn't this code be the most desirable one in the end?