Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Jan 9, 2025
1 parent 9e24488 commit 2f3a737
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
13 changes: 7 additions & 6 deletions cpp/tests/community/leiden_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand Down Expand Up @@ -128,16 +128,17 @@ class Tests_Leiden : public ::testing::TestWithParam<std::tuple<Leiden_Usecase,
ASSERT_FLOAT_EQ(compare_modularity, expected_modularity);
ASSERT_EQ(level, expected_level);
}

auto unique_clustering_v = cugraph::test::sort<vertex_t>(handle, clustering_v);

unique_clustering_v = cugraph::test::unique<vertex_t>(handle, std::move(unique_clustering_v));

auto expected_unique_clustering_v = cugraph::test::sequence<int32_t>(
handle, unique_clustering_v.size(), size_t{1}, int32_t{0});
auto expected_unique_clustering_v =
cugraph::test::sequence<int32_t>(handle, unique_clustering_v.size(), size_t{1}, int32_t{0});

auto h_unique_clustering_v = cugraph::test::to_host(handle, unique_clustering_v);
auto h_expected_unique_clustering_v = cugraph::test::to_host(handle, expected_unique_clustering_v);
auto h_expected_unique_clustering_v =
cugraph::test::to_host(handle, expected_unique_clustering_v);

ASSERT_TRUE(std::equal(h_unique_clustering_v.begin(),
h_unique_clustering_v.end(),
Expand Down
37 changes: 18 additions & 19 deletions cpp/tests/community/mg_leiden_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -189,15 +189,14 @@ class Tests_MGLeiden
// Check numbering
vertex_t num_vertices = mg_graph_view.local_vertex_partition_range_size();
rmm::device_uvector<vertex_t> clustering_v(num_vertices, handle_->get_stream());
cugraph::leiden<vertex_t, edge_t, weight_t, true>(
*handle_,
rng_state,
mg_graph_view,
mg_edge_weight_view,
clustering_v.data(),
leiden_usecase.max_level_,
leiden_usecase.resolution_);

cugraph::leiden<vertex_t, edge_t, weight_t, true>(*handle_,
rng_state,
mg_graph_view,
mg_edge_weight_view,
clustering_v.data(),
leiden_usecase.max_level_,
leiden_usecase.resolution_);

// Ensure each rank has consecutive labels

auto unique_clustering_v = cugraph::test::sort<vertex_t>(*handle_, clustering_v);
Expand All @@ -208,8 +207,9 @@ class Tests_MGLeiden

auto expected_unique_clustering_v = cugraph::test::sequence<int32_t>(
*handle_, unique_clustering_v.size(), size_t{1}, h_unique_clustering_v[0]);

auto h_expected_unique_clustering_v = cugraph::test::to_host(*handle_, expected_unique_clustering_v);

auto h_expected_unique_clustering_v =
cugraph::test::to_host(*handle_, expected_unique_clustering_v);

ASSERT_TRUE(std::equal(h_unique_clustering_v.begin(),
h_unique_clustering_v.end(),
Expand All @@ -220,14 +220,13 @@ class Tests_MGLeiden
auto cluster_ids_size_per_rank = cugraph::host_scalar_allgather(
handle_->get_comms(), h_unique_clustering_v.size(), handle_->get_stream());

assert(
h_unique_clustering_v.back() == (cluster_ids_size_per_rank[handle_->get_comms().get_rank - 1]));
assert(h_unique_clustering_v.back() ==
(cluster_ids_size_per_rank[handle_->get_comms().get_rank - 1]));

// Necessary condition for the culster IDs to be globally numbered consecutively and coupled with
// the first check, it is sufficient.
EXPECT_EQ(
h_unique_clustering_v.back(),
cluster_ids_size_per_rank[handle_->get_comms().get_rank()] - 1)
// Necessary condition for the culster IDs to be globally numbered consecutively and coupled
// with the first check, it is sufficient.
EXPECT_EQ(h_unique_clustering_v.back(),
cluster_ids_size_per_rank[handle_->get_comms().get_rank()] - 1)
<< "Returned cluster IDs are not globally numbered consecutively";
}

Expand Down

0 comments on commit 2f3a737

Please sign in to comment.