From 77b23742b7a670ac6eedb1e9a4775752b3ce4597 Mon Sep 17 00:00:00 2001 From: Chuck Hastings <45364586+ChuckHastings@users.noreply.github.com> Date: Tue, 15 Mar 2022 09:39:50 -0400 Subject: [PATCH] Remove references to gmock (#2114) CI started failing due to some gmock references. Upon review, these gmock references are unnecessary. Authors: - Chuck Hastings (https://github.com/ChuckHastings) - Rick Ratzel (https://github.com/rlratzel) Approvers: - Seunghwa Kang (https://github.com/seunghwak) - Rick Ratzel (https://github.com/rlratzel) - Jordan Jacobelli (https://github.com/Ethyling) URL: https://github.com/rapidsai/cugraph/pull/2114 --- conda/recipes/libcugraph/meta.yaml | 4 ++-- cpp/tests/CMakeLists.txt | 6 ------ .../legacy/betweenness_centrality_test.cu | 2 -- .../legacy/edge_betweenness_centrality_test.cu | 2 -- .../centrality/legacy/katz_centrality_test.cu | 17 ++++++++++++----- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index c95e53ff8b3..68d4e626e29 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -44,8 +44,8 @@ requirements: - boost-cpp>=1.66 - nccl>=2.9.9 - ucx-proc=*=gpu - - gtest - - gmock + - gtest=1.10.0 # FIXME: pinned to version in https://github.com/rapidsai/integration/blob/branch-22.04/conda/recipes/versions.yaml + - gmock=1.10.0 # FIXME: pinned to version in https://github.com/rapidsai/integration/blob/branch-22.04/conda/recipes/versions.yaml run: - {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }} - libraft-headers {{ minor_version }} diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index ff5af6ba2e4..a4c89b76ce4 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -74,8 +74,6 @@ function(ConfigureTest CMAKE_TEST_NAME) PRIVATE cugraphtestutil cugraph::cugraph - GTest::gmock - GTest::gmock_main GTest::gtest GTest::gtest_main NCCL::NCCL @@ -153,8 +151,6 @@ function(ConfigureTestMG CMAKE_TEST_NAME) cugraphmgtestutil cugraphtestutil cugraph::cugraph - GTest::gmock - GTest::gmock_main GTest::gtest GTest::gtest_main NCCL::NCCL @@ -239,8 +235,6 @@ function(ConfigureCTest CMAKE_TEST_NAME) PRIVATE cugraph::cugraph_c cugraph_c_testutil - GTest::gmock - GTest::gmock_main GTest::gtest GTest::gtest_main ) diff --git a/cpp/tests/centrality/legacy/betweenness_centrality_test.cu b/cpp/tests/centrality/legacy/betweenness_centrality_test.cu index 51906f74f0e..6ce260440b0 100644 --- a/cpp/tests/centrality/legacy/betweenness_centrality_test.cu +++ b/cpp/tests/centrality/legacy/betweenness_centrality_test.cu @@ -30,8 +30,6 @@ #include #include -#include - #include #include #include diff --git a/cpp/tests/centrality/legacy/edge_betweenness_centrality_test.cu b/cpp/tests/centrality/legacy/edge_betweenness_centrality_test.cu index 551c606cb04..bb49a402a4f 100644 --- a/cpp/tests/centrality/legacy/edge_betweenness_centrality_test.cu +++ b/cpp/tests/centrality/legacy/edge_betweenness_centrality_test.cu @@ -27,8 +27,6 @@ #include #include -#include - #include #include diff --git a/cpp/tests/centrality/legacy/katz_centrality_test.cu b/cpp/tests/centrality/legacy/katz_centrality_test.cu index e66eaef193d..f5e5ffd0de8 100644 --- a/cpp/tests/centrality/legacy/katz_centrality_test.cu +++ b/cpp/tests/centrality/legacy/katz_centrality_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,6 @@ #include #include -#include -#include - #include #include @@ -152,10 +149,20 @@ class Tests_Katz : public ::testing::TestWithParam { cugraph::katz_centrality(G, d_katz, alpha, 100, 1e-6, false, true); + auto threshold_ratio = 1e-3; + auto threshold_magnitude = (1.0 / static_cast(m)) * threshold_ratio; + std::vector top10CUGraph = getTopKIds(d_katz, m); std::vector top10Golden = getGoldenTopKIds(fs_result); - EXPECT_THAT(top10CUGraph, ::testing::ContainerEq(top10Golden)); + auto nearly_equal = [threshold_ratio, threshold_magnitude](auto lhs, auto rhs) { + return std::abs(lhs - rhs) < + std::max(std::max(lhs, rhs) * threshold_ratio, threshold_magnitude); + }; + + ASSERT_TRUE( + std::equal(top10CUGraph.begin(), top10CUGraph.end(), top10Golden.begin(), nearly_equal)) + << "Katz centrality values do not match with the reference values."; } };