-
Notifications
You must be signed in to change notification settings - Fork 197
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
Internal library to share headers between test and bench #1162
Conversation
NB: this PR depend on and includes all changes in #1085 |
# ============================================================================= | ||
|
||
if(BUILD_TESTS OR BUILD_BENCH) | ||
add_library(raft_internal INTERFACE) |
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'm particularly not sure and welcome any suggestions regarding the naming of the component. Currently:
- The name is
raft_internal
, because I wanted to call itinternal
, but it may be a reserved word in cmake. - All headers are placed into double-nested
internal/internal
. The firstinternal
is for cmake to isolate it from the other components, the second is for includes, so that all includes from this component are easily identifiable, e.g.:
#include <internal/neighbors/naive_knn.cuh>
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.
Thinking through this a little bit- what do you think about keeping the outer directory cpp/internal
as-is but nesting everything inside cpp/internal/raft
instead of cpp/internal/internal
. This would effectively allows us to include the cpp/internal
directory in the build for the bench and test source files whilst making the include paths themselves look the same as the other raft includes. So for example, this would still allow us to include the naive_knn.cuh
file as #include <raft/neighbors/naive_knn.cuh>
but the file would be coming from cpp/internal
instead. This assumes we wouldn't have name collisions there, which I highly doubt we would.
Another option could be to do something like cpp/internal/raft/internal
but I kind of prefer the option above more. What do you think?
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.
The reason I'd prefer to have raft
in the name is so that we don't have to worry about potential header collisions if, for example, a package named internal
is ever shipped for linux. Separating the namespace by including raft
makes it very clear where our scope ends.
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.
Actually, it turns out we have name collisions already! In branch-23.02 we have include/raft/matrix/select_k.cuh
and its corresponding test test/raft/matrix/select_k.cuh
; the latter is included using quotes syntax, so it's not a problem so far. In this PR I moved it to the internal
component and changed the include syntax, so it would be a problem if we change the folder name to raft. So I see two options:
- rename
test/raft/matrix/select_k.cuh
to something likeselect_k_helpers.cuh
orselect_k_utils.cuh
- rename the root folder
internal
to something different fromraft
, yet not potentially clashing with third-party libraries.
In the new commit I opted for the option (2) with raft_internal
as an experiment. Though I don't have a strong preference in this question. I only think that the trailing internal
in the folder structure is not the best option, because it feels somewhat harder to maintain.
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 think I can live w/ raft_internal
in the meantime. We can always revisit if we find this is presenting maintenance challenges.
Codecov ReportBase: 87.99% // Head: 87.99% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## branch-23.02 #1162 +/- ##
=============================================
Coverage 87.99% 87.99%
=============================================
Files 21 21
Lines 483 483
=============================================
Hits 425 425
Misses 58 58 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@achirkin I think this PR looks good. Can you also add a short description of this new directory to the bottom of the README.md in the root of the repository? |
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
/merge |
Add a new component to raft for headers, which are used in both tests and benchmarks.
Closes #1153