-
Notifications
You must be signed in to change notification settings - Fork 312
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
Initial cuGraph C API - biased RW, C tests, script updates, cmake files, C library helpers #1799
Initial cuGraph C API - biased RW, C tests, script updates, cmake files, C library helpers #1799
Conversation
Merge latest release 0.17
Merge latest branch-0.18
Update forked branch-0.18
Update forked branch-0.18 from release
Update branch-0.19 from release
update forked from release branch-0.19
Merge from release branch-0.19
Merge latest rapidsai:branch-0.19 into aschaffer:branch-0.19
Create forked branch-0.20
merge latest release branch-0.20
Merge latest rapidsai/branch-0.20 into forked branch-0.20
aschaffer/21.08 <- rapidsai/21.08
…xt_binding_rw_biased
…to fea_ext_binding_rw_biased
…xt_binding_rw_biased
…xt_binding_rw_biased
Codecov Report
@@ Coverage Diff @@
## branch-21.12 #1799 +/- ##
===============================================
Coverage ? 70.10%
===============================================
Files ? 143
Lines ? 8827
Branches ? 0
===============================================
Hits ? 6188
Misses ? 2639
Partials ? 0 Continue to review full report at Codecov.
|
…itor code flow for RW visitor.
@@ -205,6 +205,7 @@ add_library(cugraph SHARED | |||
src/visitors/graph_envelope.cpp | |||
src/visitors/visitors_factory.cpp | |||
src/visitors/bfs_visitor.cpp | |||
src/visitors/rw_visitor.cpp |
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.
So, do we plan to place bindings related files under the cugrpah/cpp directory? Or we'd better separate the core libcugraph from the bindings related files? (i.e. placing bindings related files under something like cugraph/bindings)
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 visitor implementation is not restricted to bindings only. It's meant to be (and it is) used for implementation purposes, too. These are cpp files. There will be a separate branch for the C-only API.
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.
Then, what about creating a separate directory under the cpp (similar to tests)? Is this directly relevant to libcugraph users? (someone willing to directly use our C++ API). If not, I am not sure it is a good idea to include this in our core libcugraph_(sg|mg).so.
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.
Yes, it is. As you probably know Visitor is useful to enrich the functionality of an object (visitee) without having to add new methods to it, which may inflate the code and cause merge conflicts on high traffic headers, like graph*.hpp
.
The visitor abstraction is being used in RW, for example, for exactly such reasons.
Also, this structuring of this code has been in place for a while. And it has been extensively discussed before-hand (at least 2 presentations and demos have been done). Constantly shuffling code around after the fact is counterproductive, confusing, and wasteful. If new code restructuring is in the works, then this is not the PR for it. This PR has different goals. We've already agreed on small, targeted PRs as opposed to all-inclusive major code restructuring ones.
There's also the question of what exactly is the criterion for code cut-off to be accepted in cugraph
. If this is to be discussed, then, again, maybe this is something to discuss before-fact, not after. I am starting to get the feeling that it's increasingly hard to get code accepted in cugraph
and a lot of effort is potentially wasted with code shuffling and reshuffling on what appears to be quite ad-hoc and last-moment criteria.
*/ | ||
return 0; | ||
|
||
G = cugraph_make_sg_graph(&handle, |
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 just realized I named the test and test file with the word "create" instead of "make". Similar to Chuck's comment re: func and file names matching, I'd make these match too (either change the API to "create" or the file and test to "make").
cpp/tests/c_api/random_walks_test.c
Outdated
|
||
return (count_passed == num_paths); | ||
} | ||
int test_random_walks_1() |
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.
You may not be finished updating this test, but just so you don't forget: this was just meant to be a placeholder name - I'd change it to something more descriptive so the user can identify what failed from the test output.
rerun tests |
…ates of the C-API.
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.
Still reviewing but a few things jumped out (I've only looked at the tests) so I'll post what I have so far.
My biggest concern is that it looks like some tests are hardcoded to return success, which should be easy to fix so that CI will actually catch problems.
int data_type_sz[] = {4, 8, 4, 8}; | ||
} | ||
|
||
bool_t runtime_assert(bool_t statement_truth_value, const char* error_msg) |
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 the name "assert" here is misleading. When reading code, I expect execution to stop when a false value is passed to this function.
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 don't necessarily agree, but you're free to change that.
cugraph_free_handle(p_handle); | ||
|
||
/* because bools and err return codes from programs have opposite meaning...*/ | ||
if (flag_failed) |
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 this is still inverted: tests need to return 0 on success, but this will return 0 if flag_failed is true, meaning it's a failure? Maybe I'm confused...
edit: oh, this flag is only used for the check above which must "fail". I would possibly rename the variable, or add something to the comment, or change the name of the test, or all of the above.
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.
It's correct. This is a negative test.
} | ||
|
||
/* negative test RW call flow*/ | ||
int test_random_walks_3() |
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.
this tests and others still using the placeholder name need to have a more descriptive name.
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.
You provided these names. You're free to change them in the next release.
31, 32, 34, 312, 3124, 3125, 31246, 31256, 324, 325, 3246, 3256, 346, 46, 56}; | ||
|
||
/* linear search of `value` inside `p_cmprsd_path[max_num_paths]`*/ | ||
bool_t is_one_of(int32_t value, int32_t* p_cmprsd_path, int max_num_paths) |
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 some of these abbreviations are harder to type and read than the non-abbreviated words. Can this just say "compressed" instead of "cmprsd" (assuming that's what it's abbreviating)?
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.
Again, question of style/taste. You're free to change them in the next release.
|
||
cugraph_free_handle(p_handle); | ||
|
||
return 0; |
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.
Because the asserts don't fail the test and their return values aren't being captured and checked, this test will always pass, and therefore CI will not catch anything.
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.
Yes, this is just debug info. We can modify this in the next release.
vertex_t h_start[] = {0, 2}; | ||
|
||
p_handle = cugraph_create_handle(); | ||
runtime_assert(p_handle != NULL, "raft handle creation failed."); |
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.
since this isn't a real assert (the implementation I saw above seems to just print to stderr), the final return value of the test needs to reflect if this fails, but it's just being ignored. Same for all other runtime_assert
calls that aren't setting a flag of some sort.
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.
We can modify this in the next release.
rerun tests |
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.
Created #1867 to remind us to address the review feedback that is being deferred.
…xt_binding_rw_biased
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.
Approving now that #1867 has been created.
rerun tests |
1 similar comment
rerun tests |
@gpucibot merge |
Initial cuGraph C API:
g++
orgcc
) accordingly.The Python API for the updated Biased RW will be done in a separate PR.