Skip to content

Commit

Permalink
Merge pull request #4023 from rapidsai/branch-23.12
Browse files Browse the repository at this point in the history
Forward-merge branch-23.12 to branch-24.02
  • Loading branch information
GPUtester authored Nov 28, 2023
2 parents 5d4bcce + 1e446c4 commit 96c39cc
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 70 deletions.
6 changes: 3 additions & 3 deletions cpp/src/c_api/graph_mg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,9 @@ extern "C" cugraph_error_code_t cugraph_mg_graph_create(
NULL,
&src,
&dst,
&weights,
&edge_ids,
&edge_type_ids,
(weights == nullptr) ? nullptr : &weights,
(edge_ids == nullptr) ? nullptr : &edge_ids,
(edge_type_ids == nullptr) ? nullptr : &edge_type_ids,
store_transposed,
1,
FALSE,
Expand Down
110 changes: 43 additions & 67 deletions cpp/tests/c_api/mg_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,22 @@ extern "C" int create_mg_test_graph(const cugraph_resource_handle_t* handle,

rank = cugraph_resource_handle_get_rank(handle);

if (rank == 0) {
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
size_t original_num_edges = num_edges;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
if (rank != 0) num_edges = 0;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");
} else {
ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));

ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");

ret_code = cugraph_type_erased_device_array_create(handle, 0, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");
}
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");

src_view = cugraph_type_erased_device_array_view(src);
dst_view = cugraph_type_erased_device_array_view(dst);
Expand All @@ -207,7 +199,7 @@ extern "C" int create_mg_test_graph(const cugraph_resource_handle_t* handle,
NULL,
NULL,
store_transposed,
num_edges,
original_num_edges, // UNUSED
FALSE,
p_graph,
ret_error);
Expand Down Expand Up @@ -260,30 +252,22 @@ extern "C" int create_mg_test_graph_double(const cugraph_resource_handle_t* hand

rank = cugraph_resource_handle_get_rank(handle);

if (rank == 0) {
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
size_t original_num_edges = num_edges;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
if (rank != 0) num_edges = 0;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");
} else {
ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));

ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");

ret_code = cugraph_type_erased_device_array_create(handle, 0, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");
}
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, weight_tid, &wgt, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");

src_view = cugraph_type_erased_device_array_view(src);
dst_view = cugraph_type_erased_device_array_view(dst);
Expand All @@ -309,7 +293,7 @@ extern "C" int create_mg_test_graph_double(const cugraph_resource_handle_t* hand
NULL,
NULL,
store_transposed,
num_edges,
original_num_edges, // UNUSED
FALSE,
p_graph,
ret_error);
Expand Down Expand Up @@ -357,30 +341,22 @@ extern "C" int create_mg_test_graph_with_edge_ids(const cugraph_resource_handle_

rank = cugraph_resource_handle_get_rank(handle);

if (rank == 0) {
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
size_t original_num_edges = num_edges;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
if (rank != 0) num_edges = 0;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, edge_tid, &idx, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "idx create failed.");
} else {
ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, cugraph_error_message(*ret_error));

ret_code = cugraph_type_erased_device_array_create(handle, 0, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &dst, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "dst create failed.");

ret_code = cugraph_type_erased_device_array_create(handle, 0, edge_tid, &idx, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "wgt create failed.");
}
ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, edge_tid, &idx, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "idx create failed.");

src_view = cugraph_type_erased_device_array_view(src);
dst_view = cugraph_type_erased_device_array_view(dst);
Expand All @@ -406,7 +382,7 @@ extern "C" int create_mg_test_graph_with_edge_ids(const cugraph_resource_handle_
idx_view,
NULL,
store_transposed,
num_edges,
original_num_edges, // UNUSED
FALSE,
p_graph,
ret_error);
Expand Down Expand Up @@ -464,7 +440,7 @@ extern "C" int create_mg_test_graph_with_properties(const cugraph_resource_handl

size_t original_num_edges = num_edges;

if (rank == 0) num_edges = 0;
if (rank != 0) num_edges = 0;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
Expand Down Expand Up @@ -529,7 +505,7 @@ extern "C" int create_mg_test_graph_with_properties(const cugraph_resource_handl
idx_view,
type_view,
store_transposed,
original_num_edges,
original_num_edges, // UNUSED
FALSE,
p_graph,
ret_error);
Expand Down Expand Up @@ -593,7 +569,7 @@ int create_mg_test_graph_new(const cugraph_resource_handle_t* handle,
size_t original_num_edges = num_edges;

if (rank != 0) num_edges = 0;

ret_code =
cugraph_type_erased_device_array_create(handle, num_edges, vertex_tid, &src, ret_error);
TEST_ASSERT(test_ret_value, ret_code == CUGRAPH_SUCCESS, "src create failed.");
Expand Down Expand Up @@ -658,7 +634,7 @@ int create_mg_test_graph_new(const cugraph_resource_handle_t* handle,
edge_id_view,
edge_type_view,
store_transposed,
renumber,
original_num_edges, // UNUSED
FALSE,
graph,
ret_error);
Expand Down

0 comments on commit 96c39cc

Please sign in to comment.