Skip to content

Commit

Permalink
fix c api issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarghi-nv committed Sep 11, 2023
1 parent 2af9333 commit 4dc0a92
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cpp/include/cugraph_c/sampling_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ typedef enum cugraph_prior_sources_behavior_t {
but exclude any vertex that has already been used as a source */
} cugraph_prior_sources_behavior_t;

/**
* @brief Enumeration for compression type
*/
typedef enum cugraph_compression_type_t {
COO = 0,
CSR,
CSC,
DCSR,
DCSC
} cugraph_compression_type_t;

/**
* @brief Create sampling options object
*
Expand All @@ -225,6 +236,14 @@ cugraph_error_code_t cugraph_sampling_options_create(cugraph_sampling_options_t*
*/
void cugraph_sampling_set_renumber_results(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set whether to compress per-hop (True) or globally (False)
*
* @param options - opaque pointer to the sampling options
* @param value - Boolean value to assign to the option
*/
void cugraph_sampling_set_compress_per_hop(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set flag to sample with_replacement
*
Expand All @@ -241,6 +260,14 @@ void cugraph_sampling_set_with_replacement(cugraph_sampling_options_t* options,
*/
void cugraph_sampling_set_return_hops(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set compression type
*
* @param options - opaque pointer to the sampling options
* @param value - Enum defining the compresion type
*/
void cugraph_sampling_set_compression_type(cugraph_sampling_options_t* options, cugraph_compression_type_t value);

/**
* @brief Set prior sources behavior
*
Expand Down
10 changes: 10 additions & 0 deletions cpp/src/c_api/uniform_neighbor_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ extern "C" void cugraph_sampling_set_renumber_results(cugraph_sampling_options_t
internal_pointer->renumber_results_ = value;
}

extern "C" void cugraph_sampling_set_compress_per_hop(cugraph_sampling_options_t* options, bool_t value) {
auto internal_pointer = reinterpret_cast<cugraph::c_api::cugraph_sampling_options_t*>(options);
internal_pointer->compress_per_hop_ = value;
}

extern "C" void cugraph_sampling_set_with_replacement(cugraph_sampling_options_t* options,
bool_t value)
{
Expand All @@ -395,6 +400,11 @@ extern "C" void cugraph_sampling_set_return_hops(cugraph_sampling_options_t* opt
internal_pointer->return_hops_ = value;
}

extern "C" void cugraph_sampling_set_compression_type(cugraph_sampling_options_t* options, cugraph_compression_type_t value) {
auto internal_pointer = reinterpret_cast<cugraph::c_api::cugraph_sampling_options_t*>(options);
internal_pointer->compression_type_ = value;
}

extern "C" void cugraph_sampling_set_prior_sources_behavior(cugraph_sampling_options_t* options,
cugraph_prior_sources_behavior_t value)
{
Expand Down

0 comments on commit 4dc0a92

Please sign in to comment.