Add C-API method to fetch cuVS version from Java.#935
Add C-API method to fetch cuVS version from Java.#935rapids-bot[bot] merged 4 commits intorapidsai:branch-25.08from
Conversation
| * @param[out] patch Patch version | ||
| * @return cuvsError_t | ||
| */ | ||
| cuvsError_t cuvsVersionGet(uint16_t *major, uint16_t *minor, uint16_t *patch); |
There was a problem hiding this comment.
Is the error return type by convention, or something else? Since this method can never fail, right ?
There was a problem hiding this comment.
Agreed; this method can't fail, really.
This method currently follows the spec in #930, and the convention in the file.
I toyed with a different implementation:
std::tuple<uint16_t, uint16_t, uint16_t> cuvsVersionGet()
{
return {CUVS_VERSION_MAJOR, CUVS_VERSION_MINOR, CUVS_VERSION_PATCH};
}I wasn't sure of the implications of using std::tuple with Panama/JNI.
There was a problem hiding this comment.
Ah, alternatively, I could make this a void function, if that's preferable.
There was a problem hiding this comment.
Use of std::tuple is fine in the C++ API, albeit, I would still caution against it in favor of using a specialized struct. Alternatively, the C API could have functions to compute the individual values like the following:
cuvsVersionGetMajor
cuvsVersionGetMajor
cuvsVersionGetPath.
But, I would still have these return through pointer ref so that we can still buffer in an error if needed. Please see the CUDA runtime C API for an example.
There was a problem hiding this comment.
Use of std::tuple is fine in the C++ API, albeit...
The trick there is that I don't know what std::tuple<...> translates to in JNI. I considered the separate calls, and figured that the caller is unlikely to call one without calling the others. We might as well save the extra JNI round-trips.
Thank you, all. I'm inclined to leave this function in its current form, if it's agreeable to @ChrisHegarty.
There was a problem hiding this comment.
The trick there is that I don't know what std::tuple<...> translates to in JNI.
What I'm saying is that std::tuple is not a C construct, and so we can't use it at all in the formal C-based API. We've built cuVS APIs (similar to much of RAPIDS) as a C++ core with a C wrapper around it. Everything we do in the C layer needs to be proper C (though it can call C++ underneath, obviously).
There was a problem hiding this comment.
All this looks pretty complicated, and a simple string returned in "25.06.0" format should suffice too :-)
But, I'm not saying we can't handle it in Java, though. It should be possible, with the methods Corey suggested:
cuvsVersionGetMajor
cuvsVersionGetMajor
cuvsVersionGetPath.
There was a problem hiding this comment.
In general, we would prefer to keep strings (and the need for string manipulation) out of C APIs. That's why we prefer concrete numbers for these values. Strings are fine in the Python/Java layers, but not in the C layer (unless it's for logging or relaying exceptions).
There was a problem hiding this comment.
We could've handled the string in Java layer directly. But, if you think having those three pieces available separately makes more sense, then I'm okay with it :-)
There was a problem hiding this comment.
if you think having those three pieces available separately makes more sense
Yes, centralizing this makes a ton of sense for the purposes of making sure the same symbol / underlying data is being given to everyone. The C layer is the place to do this.
|
LGTM, Thanks! |
|
/ok to test 76f40b0 |
|
Please set up git pre-commit as per the instructions here. After you run the pre-commit hooks, the style checker will run in this PR and we'll be able to approve and merge your changes. |
ChrisHegarty
left a comment
There was a problem hiding this comment.
LGTM. Modelling this through Panama FFI in Java should be straightforward.
|
/ok to test 7b4525f |
|
/ok to test 7b4525f |
|
I know it seems redundant @mythrocks, but could we capture a quick test in here just for potential regression / maintainence purposes? You could literally verify that the value returned matches the constants. |
I was debating that. I was wondering about having to move the version constants to the header, and why one would need the function any more. That reasoning wasn't right: We'd still need it for JNI. I've updated with a test, and rejigged the rest accordingly. |
@cjnolet, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test b074b76 |
|
/merge |
|
I'm investigating the build failure now. The following is odd: The golang build seems to fail with multiple definitions. The symbols in question are |
|
I can't seem to get the Go builds going locally to debug. I have switched the version constants to If this doesn't pass CI, I'll have to resort to using |
|
/ok to test e2a792d |
|
@cjnolet, thank you for retargeting this PR to 25.08 already. |
|
@mythrocks, the reason why CI is still not running in this PR is because there are unverified commits in the history. |
|
/ok to test eaf9fbe |
2f955c1 to
108322b
Compare
Heard. I've tried squashing the commits in this PR and re-signing, but it's still turning up as Odd, since I have signed commits working with my other projects. |
2ce9cff to
034ff66
Compare
|
@mythrocks, I wouldn't worry about it. You could squash the commits in your branch and then open up a new PR, but it's really not a big deal. I'd honestly rather keep the history than have a force-push to this PR to change it. You'll just need to manually do |
Fixes rapidsai#930. This commit adds a C API function to fetch the cuVS version.
034ff66 to
0ffd8b7
Compare
Heard. Apologies for the forced push(es), but I think I've gotten it now. I figured if we were to lose history, it should probably be on a simple PR like this one. It turns out that I wasn't verifying correctly so far. I think I have it going now. |
|
In the future, I would prefer that you not force push to the PR. This can create a whole slew of other problems, especially when you have write access. |
|
@mythrocks not sure if the failing test was flaky or not. We can try to rerun |
|
/ok to test 303684e |
|
This seems to be a failure in the C++ gtests: I'll check for whether this test is failing in other PRs. |
|
@mythrocks I saw that same test failure in #916 as well. AFK at the moment, so don't know if it is still failing. |
ACK. The test passes locally on my workstation. I'll reach out to the |
Fixes rapidsai#930. This commit adds a C API function to fetch the cuVS version. Authors: - MithunR (https://github.com/mythrocks) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Chris Hegarty (https://github.com/ChrisHegarty) - Corey J. Nolet (https://github.com/cjnolet) - James Lamb (https://github.com/jameslamb) URL: rapidsai#935
Fixes #930.
This commit adds a C API function to fetch the cuVS version.