-
Notifications
You must be signed in to change notification settings - Fork 310
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
Define and Implement C++ API for negative sampling #4523
Merged
rapids-bot
merged 25 commits into
rapidsai:branch-24.10
from
ChuckHastings:negative_sampling_api
Aug 21, 2024
Merged
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
29cbe97
Define C++ API for negative sampling
ChuckHastings 983a881
first cut at negative sampling implementation (untested)... fixed API
ChuckHastings 5504c74
rename utility_wrapper.cuh
ChuckHastings 912ae6f
Working SG negative sampling tests
ChuckHastings 0ce0712
add MG tests
ChuckHastings 0d89269
Merge branch 'branch-24.08' into negative_sampling_api
ChuckHastings a31f5a9
Add C API and PLC for negative sampling
ChuckHastings fdad347
Merge branch 'branch-24.08' into negative_sampling_api
ChuckHastings 6a90844
Fix filename change lost in merge
ChuckHastings 2f23ac1
Negative sampling now working for SG, MG with 1/2/4 GPUs
ChuckHastings 51d30db
Merge branch 'branch-24.10' into negative_sampling_api
ChuckHastings 06c3d5d
Refactor to do biased sampling by vertex partitions instead of exposi…
ChuckHastings b9ab33a
Merge branch 'branch-24.10' into negative_sampling_api
ChuckHastings 4de3bda
address other PR comments
ChuckHastings b38d4c6
Fix a few straggling references to remove_false_negatives, refactor a…
ChuckHastings 16bbd7b
Merge branch 'branch-24.10' into negative_sampling_api
ChuckHastings 905d1b6
refactor negative sampling based on PR comments
ChuckHastings dbc0b38
start refactoring to make tests .cpp files
ChuckHastings 5f35987
move MG validation code into validation_utilitices.cu
ChuckHastings 06e71c4
rename sampling file
ChuckHastings 94990e1
remove reference of device structure from host API
ChuckHastings 3305835
Merge branch 'branch-24.10' into negative_sampling_api
ChuckHastings 996b9ac
update to accomodate GPUs with no bias
ChuckHastings 8a28b0b
move num_samples parameter, add tests for edge masking, some cosmetic…
ChuckHastings b381784
Merge branch 'branch-24.10' into negative_sampling_api
ChuckHastings 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
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,115 @@ | ||
/* | ||
* Copyright (c) 2024, 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cugraph_c/array.h> | ||
#include <cugraph_c/graph.h> | ||
#include <cugraph_c/random.h> | ||
#include <cugraph_c/resource_handle.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Opaque COO definition | ||
*/ | ||
typedef struct { | ||
int32_t align_; | ||
} cugraph_coo_t; | ||
|
||
/** | ||
* @brief Opaque COO list definition | ||
*/ | ||
typedef struct { | ||
int32_t align_; | ||
} cugraph_coo_list_t; | ||
|
||
/** | ||
* @brief Get the source vertex ids | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
* @return type erased array view of source vertex ids | ||
*/ | ||
cugraph_type_erased_device_array_view_t* cugraph_coo_get_sources(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Get the destination vertex ids | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
* @return type erased array view of destination vertex ids | ||
*/ | ||
cugraph_type_erased_device_array_view_t* cugraph_coo_get_destinations(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Get the edge weights | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
* @return type erased array view of edge weights, NULL if no edge weights in COO | ||
*/ | ||
cugraph_type_erased_device_array_view_t* cugraph_coo_get_edge_weights(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Get the edge id | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
* @return type erased array view of edge id, NULL if no edge ids in COO | ||
*/ | ||
cugraph_type_erased_device_array_view_t* cugraph_coo_get_edge_id(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Get the edge type | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
* @return type erased array view of edge type, NULL if no edge types in COO | ||
*/ | ||
cugraph_type_erased_device_array_view_t* cugraph_coo_get_edge_type(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Get the number of coo object in the list | ||
* | ||
* @param [in] coo_list Opaque pointer to COO list | ||
* @return number of elements | ||
*/ | ||
size_t cugraph_coo_list_size(const cugraph_coo_list_t* coo_list); | ||
|
||
/** | ||
* @brief Get a COO from the list | ||
* | ||
* @param [in] coo_list Opaque pointer to COO list | ||
* @param [in] index Index of desired COO from list | ||
* @return a cugraph_coo_t* object from the list | ||
*/ | ||
cugraph_coo_t* cugraph_coo_list_element(cugraph_coo_list_t* coo_list, size_t index); | ||
|
||
/** | ||
* @brief Free coo object | ||
* | ||
* @param [in] coo Opaque pointer to COO | ||
*/ | ||
void cugraph_coo_free(cugraph_coo_t* coo); | ||
|
||
/** | ||
* @brief Free coo list | ||
* | ||
* @param [in] coo_list Opaque pointer to list of COO objects | ||
*/ | ||
void cugraph_coo_list_free(cugraph_coo_list_t* coo_list); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
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.
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.
Sort of our convention is to list scalar parameters at the end. We may better move
num_samples
afterdst_biases
.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.
Moved in next push