Skip to content

Commit

Permalink
rename variable for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Aug 23, 2024
1 parent de79620 commit 8c17009
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
10 changes: 5 additions & 5 deletions cpp/include/cugraph_c/sampling_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void cugraph_sampling_options_free(cugraph_sampling_options_t* options);
/// mimic
typedef struct {
int32_t align_;
} cugraph_sample_heterogeneous_fanout_t;
} cugraph_sample_heterogeneous_fan_out_t;

/**
* @brief Create heterogeneous fanout
Expand All @@ -353,20 +353,20 @@ typedef struct {
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_create_heterogeneous_fanout(
cugraph_error_code_t cugraph_create_heterogeneous_fan_out(
const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_type_erased_host_array_view_t* edge_type_offsets,
const cugraph_type_erased_host_array_view_t* fanout,
cugraph_sample_heterogeneous_fanout_t** heterogeneous_fanout,
cugraph_sample_heterogeneous_fan_out_t** heterogeneous_fanout,
cugraph_error_t** error);

/**
* @brief Free edge type and fanout pairs
*
* @param [in] heterogeneous_fanout The edge type size and fanout values
*/
void cugraph_heterogeneous_fanout_free(cugraph_sample_heterogeneous_fanout_t* heterogeneous_fanout);
void cugraph_heterogeneous_fanout_free(cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fanout);

/**
* @brief Uniform Neighborhood Sampling
Expand Down Expand Up @@ -547,7 +547,7 @@ cugraph_error_code_t cugraph_neighbor_sample(
const cugraph_type_erased_device_array_view_t* label_to_comm_rank,
const cugraph_type_erased_device_array_view_t* label_offsets,
const cugraph_type_erased_host_array_view_t* fan_out,
const cugraph_sample_heterogeneous_fanout_t* heterogeneous_fanout,
const cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fanout,
const cugraph_sampling_options_t* options,
bool_t is_biased,
bool_t do_expensive_check,
Expand Down
19 changes: 9 additions & 10 deletions cpp/src/c_api/neighbor_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {
cugraph::c_api::cugraph_type_erased_device_array_view_t const* label_to_comm_rank_{nullptr};
cugraph::c_api::cugraph_type_erased_device_array_view_t const* label_offsets_{nullptr};
cugraph::c_api::cugraph_type_erased_host_array_view_t const* fan_out_{nullptr};
cugraph::c_api::cugraph_sample_heterogeneous_fanout_t const* heterogeneous_fan_out_{nullptr};
cugraph::c_api::cugraph_sample_heterogeneous_fan_out_t const* heterogeneous_fan_out_{nullptr};
cugraph::c_api::cugraph_sampling_options_t options_{};
bool is_biased_{false};
bool do_expensive_check_{false};
Expand All @@ -94,7 +94,7 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {
cugraph_type_erased_device_array_view_t const* label_to_comm_rank,
cugraph_type_erased_device_array_view_t const* label_offsets,
cugraph_type_erased_host_array_view_t const* fan_out,
cugraph_sample_heterogeneous_fanout_t const* heterogeneous_fan_out,
cugraph_sample_heterogeneous_fan_out_t const* heterogeneous_fan_out,
cugraph::c_api::cugraph_sampling_options_t options,
bool is_biased,
bool do_expensive_check)
Expand Down Expand Up @@ -122,7 +122,7 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {
reinterpret_cast<cugraph::c_api::cugraph_type_erased_host_array_view_t const*>(fan_out)),

heterogeneous_fan_out_(
reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fanout_t const*>(
reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fan_out_t const*>(
heterogeneous_fan_out)),

options_(options),
Expand Down Expand Up @@ -1007,7 +1007,7 @@ cugraph_error_code_t cugraph_neighbor_sample(
const cugraph_type_erased_device_array_view_t* label_to_comm_rank,
const cugraph_type_erased_device_array_view_t* label_offsets,
const cugraph_type_erased_host_array_view_t* fan_out,
const cugraph_sample_heterogeneous_fanout_t* heterogeneous_fan_out,
const cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fan_out,
const cugraph_sampling_options_t* options,
bool_t is_biased,
bool_t do_expensive_check,
Expand Down Expand Up @@ -1064,14 +1064,14 @@ cugraph_error_code_t cugraph_neighbor_sample(
} else {

CAPI_EXPECTS(reinterpret_cast<cugraph::c_api::cugraph_type_erased_host_array_view_t const*>(
std::get<0>(*reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fanout_t const*>(heterogeneous_fan_out)))
std::get<0>(*reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fan_out_t const*>(heterogeneous_fan_out)))
->type_ == INT32,
CUGRAPH_INVALID_INPUT,
"edge type offsets type must be INT32",
*error);

CAPI_EXPECTS(reinterpret_cast<cugraph::c_api::cugraph_type_erased_host_array_view_t const*>(
std::get<0>(*reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fanout_t const*>(heterogeneous_fan_out)))
std::get<0>(*reinterpret_cast<cugraph::c_api::cugraph_sample_heterogeneous_fan_out_t const*>(heterogeneous_fan_out)))
->type_ == INT32,
CUGRAPH_INVALID_INPUT,
"fan_out values type must be INT32",
Expand Down Expand Up @@ -1186,16 +1186,15 @@ cugraph_error_code_t cugraph_biased_neighbor_sample(
return cugraph::c_api::run_algorithm(graph, functor, result, error);
}

extern "C" cugraph_error_code_t cugraph_create_heterogeneous_fanout(
extern "C" cugraph_error_code_t cugraph_create_heterogeneous_fan_out(
const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_type_erased_host_array_view_t* edge_type_offsets,
const cugraph_type_erased_host_array_view_t* fan_out,
cugraph_sample_heterogeneous_fanout_t** heterogeneous_fan_out,
cugraph_sample_heterogeneous_fan_out_t** heterogeneous_fan_out,
cugraph_error_t** error)
{

*heterogeneous_fan_out = reinterpret_cast<cugraph_sample_heterogeneous_fanout_t*> (new std::tuple<cugraph::c_api::cugraph_type_erased_host_array_t *, cugraph::c_api::cugraph_type_erased_host_array_t*> {
*heterogeneous_fan_out = reinterpret_cast<cugraph_sample_heterogeneous_fan_out_t*> (new std::tuple<cugraph::c_api::cugraph_type_erased_host_array_t *, cugraph::c_api::cugraph_type_erased_host_array_t*> {
new cugraph::c_api::cugraph_type_erased_host_array_t(reinterpret_cast<cugraph::c_api::cugraph_type_erased_host_array_view_t const*>(edge_type_offsets)),
new cugraph::c_api::cugraph_type_erased_host_array_t(reinterpret_cast<cugraph::c_api::cugraph_type_erased_host_array_view_t const*>(fan_out))});

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/c_api/neighbor_sampling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace cugraph {
namespace c_api {

using cugraph_sample_heterogeneous_fanout_t = std::tuple<
using cugraph_sample_heterogeneous_fan_out_t = std::tuple<
cugraph_type_erased_host_array_t*, cugraph_type_erased_host_array_t*>;

} // namespace c_api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ cdef extern from "cugraph_c/sampling_algorithms.h":
const cugraph_type_erased_device_array_view_t* label_to_comm_rank,
const cugraph_type_erased_device_array_view_t* label_offsets,
const cugraph_type_erased_host_array_view_t* fan_out,
const cugraph_sample_heterogeneous_fanout_t* heterogeneous_fanout,
const cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fanout,
const cugraph_sampling_options_t* options,
bool_t is_biased,
bool_t do_expensive_check,
Expand Down Expand Up @@ -123,19 +123,19 @@ cdef extern from "cugraph_c/sampling_algorithms.h":
cugraph_error_t** error
)

ctypedef struct cugraph_sample_heterogeneous_fanout_t:
ctypedef struct cugraph_sample_heterogeneous_fan_out_t:
pass

cdef cugraph_error_code_t \
cugraph_create_heterogeneous_fanout(
cugraph_create_heterogeneous_fan_out(
const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_type_erased_host_array_view_t* edge_type_offsets,
const cugraph_type_erased_host_array_view_t* fanout,
cugraph_sample_heterogeneous_fanout_t** heterogeneous_fanout,
cugraph_sample_heterogeneous_fan_out_t** heterogeneous_fanout,
cugraph_error_t** error
)

cdef void \
cugraph_heterogeneous_fanout_free(
cugraph_sample_heterogeneous_fanout_t* heterogeneous_fanout);
cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fanout);
10 changes: 5 additions & 5 deletions python/pylibcugraph/pylibcugraph/neighbor_sample.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ from pylibcugraph._cugraph_c.algorithms cimport (
)
from pylibcugraph._cugraph_c.sampling_algorithms cimport (
cugraph_neighbor_sample,
cugraph_sample_heterogeneous_fanout_t,
cugraph_create_heterogeneous_fanout,
cugraph_sample_heterogeneous_fan_out_t,
cugraph_create_heterogeneous_fan_out,
cugraph_heterogeneous_fanout_free,
)
from pylibcugraph.resource_handle cimport (
Expand Down Expand Up @@ -225,7 +225,7 @@ def neighbor_sample(ResourceHandle resource_handle,
)

cdef cugraph_graph_t* c_graph_ptr = input_graph.c_graph_ptr
cdef cugraph_sample_heterogeneous_fanout_t* heterogeneous_fanout_ptr = <cugraph_sample_heterogeneous_fanout_t*>NULL
cdef cugraph_sample_heterogeneous_fan_out_t* heterogeneous_fanout_ptr = <cugraph_sample_heterogeneous_fan_out_t*>NULL
cdef cugraph_type_erased_host_array_view_t* fan_out_ptr = <cugraph_type_erased_host_array_view_t*>NULL
cdef cugraph_type_erased_host_array_view_t* fan_out_size_ptr = <cugraph_type_erased_host_array_view_t*>NULL
cdef cugraph_type_erased_host_array_view_t* fan_out_values_ptr = <cugraph_type_erased_host_array_view_t*>NULL
Expand Down Expand Up @@ -277,7 +277,7 @@ def neighbor_sample(ResourceHandle resource_handle,
len(h_fan_out[1]),
get_c_type_from_numpy_type(h_fan_out[1].dtype))

error_code = cugraph_create_heterogeneous_fanout(
error_code = cugraph_create_heterogeneous_fan_out(
c_resource_handle_ptr,
c_graph_ptr,
fan_out_size_ptr,
Expand All @@ -286,7 +286,7 @@ def neighbor_sample(ResourceHandle resource_handle,
&error_ptr
)

assert_success(error_code, error_ptr, "cugraph_create_heterogeneous_fanout")
assert_success(error_code, error_ptr, "cugraph_create_heterogeneous_fan_out")

cdef cugraph_sample_result_t* result_ptr

Expand Down

0 comments on commit 8c17009

Please sign in to comment.