Skip to content
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

Correct defect found in DLFW testing #4021

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading