From 1d2a9a717e9f404927e9041d3d2d6cffc56cf4ac Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 15 Apr 2024 13:52:55 -0400 Subject: [PATCH 1/6] Use static gtest and gbench everywhere --- conda/environments/all_cuda-118_arch-x86_64.yaml | 3 --- conda/environments/all_cuda-122_arch-x86_64.yaml | 3 --- conda/recipes/libcudf/conda_build_config.yaml | 6 ------ conda/recipes/libcudf/meta.yaml | 11 ----------- cpp/CMakeLists.txt | 2 +- cpp/cmake/thirdparty/get_gtest.cmake | 6 ++++-- dependencies.yaml | 6 ------ 7 files changed, 5 insertions(+), 32 deletions(-) diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index e629f8b633e..00ff83a8fa0 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -8,7 +8,6 @@ channels: - nvidia dependencies: - aiobotocore>=2.2.0 -- benchmark==1.8.0 - boto3>=1.21.21 - botocore>=1.24.21 - breathe>=4.35.0 @@ -34,8 +33,6 @@ dependencies: - fmt>=10.1.1,<11 - fsspec>=0.6.0 - gcc_linux-64=11.* -- gmock>=1.13.0 -- gtest>=1.13.0 - hypothesis - identify>=2.5.20 - ipython diff --git a/conda/environments/all_cuda-122_arch-x86_64.yaml b/conda/environments/all_cuda-122_arch-x86_64.yaml index f135a88cac2..0260f7674ce 100644 --- a/conda/environments/all_cuda-122_arch-x86_64.yaml +++ b/conda/environments/all_cuda-122_arch-x86_64.yaml @@ -8,7 +8,6 @@ channels: - nvidia dependencies: - aiobotocore>=2.2.0 -- benchmark==1.8.0 - boto3>=1.21.21 - botocore>=1.24.21 - breathe>=4.35.0 @@ -35,8 +34,6 @@ dependencies: - fmt>=10.1.1,<11 - fsspec>=0.6.0 - gcc_linux-64=11.* -- gmock>=1.13.0 -- gtest>=1.13.0 - hypothesis - identify>=2.5.20 - ipython diff --git a/conda/recipes/libcudf/conda_build_config.yaml b/conda/recipes/libcudf/conda_build_config.yaml index 53770956ebe..b7fbaab9306 100644 --- a/conda/recipes/libcudf/conda_build_config.yaml +++ b/conda/recipes/libcudf/conda_build_config.yaml @@ -16,12 +16,6 @@ sysroot_version: cmake_version: - ">=3.26.4" -gbench_version: - - "==1.8.0" - -gtest_version: - - ">=1.13.0" - libarrow_version: - "==14.0.2" diff --git a/conda/recipes/libcudf/meta.yaml b/conda/recipes/libcudf/meta.yaml index 63eb83084dd..f0275544ccb 100644 --- a/conda/recipes/libcudf/meta.yaml +++ b/conda/recipes/libcudf/meta.yaml @@ -69,9 +69,6 @@ requirements: - librdkafka {{ librdkafka_version }} - fmt {{ fmt_version }} - spdlog {{ spdlog_version }} - - benchmark {{ gbench_version }} - - gtest {{ gtest_version }} - - gmock {{ gtest_version }} - zlib {{ zlib_version }} outputs: @@ -108,8 +105,6 @@ outputs: - librmm ={{ minor_version }} - libkvikio ={{ minor_version }} - dlpack {{ dlpack_version }} - - gtest {{ gtest_version }} - - gmock {{ gtest_version }} test: commands: - test -f $PREFIX/lib/libcudf.so @@ -221,9 +216,6 @@ outputs: {% else %} - libcurand-dev {% endif %} - - benchmark {{ gbench_version }} - - gtest {{ gtest_version }} - - gmock {{ gtest_version }} run: - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - {{ pin_subpackage('libcudf', exact=True) }} @@ -233,9 +225,6 @@ outputs: {% else %} - libcurand {% endif %} - - benchmark {{ gbench_version }} - - gtest {{ gtest_version }} - - gmock {{ gtest_version }} about: home: https://rapids.ai/ license: Apache-2.0 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7d62e0acb10..98afd8fd734 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -956,7 +956,7 @@ endif() if(CUDF_BUILD_BENCHMARKS) # Find or install GoogleBench include(${rapids-cmake-dir}/cpm/gbench.cmake) - rapids_cpm_gbench() + rapids_cpm_gbench(BUILD_STATIC) # Find or install nvbench include(cmake/thirdparty/get_nvbench.cmake) diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake index cfb219448f1..5038e8e811b 100644 --- a/cpp/cmake/thirdparty/get_gtest.cmake +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -17,7 +17,9 @@ function(find_and_configure_gtest) include(${rapids-cmake-dir}/cpm/gtest.cmake) # Find or install GoogleTest - rapids_cpm_gtest(BUILD_EXPORT_SET cudf-testing-exports INSTALL_EXPORT_SET cudf-testing-exports) + rapids_cpm_gtest( + BUILD_EXPORT_SET cudf-testing-exports INSTALL_EXPORT_SET cudf-testing-exports BUILD_STATIC + ) if(GTest_ADDED) rapids_export( diff --git a/dependencies.yaml b/dependencies.yaml index 8cd4c798c38..b3bb4b4a50e 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -247,9 +247,6 @@ dependencies: - output_types: conda packages: - fmt>=10.1.1,<11 - - &gbench benchmark==1.8.0 - - >est gtest>=1.13.0 - - &gmock gmock>=1.13.0 - librmm==24.6.* - libkvikio==24.6.* - librdkafka>=1.9.0,<1.10.0a0 @@ -590,9 +587,6 @@ dependencies: - output_types: conda packages: - *cmake_ver - - *gbench - - *gtest - - *gmock specific: - output_types: conda matrices: From 475a5859747c9e4c7c26a421c086cc2d3f331f12 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 15 Apr 2024 15:19:09 -0400 Subject: [PATCH 2/6] Correct style issues found by CI --- cpp/cmake/thirdparty/get_gtest.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake index 5038e8e811b..4923c1fabb1 100644 --- a/cpp/cmake/thirdparty/get_gtest.cmake +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -18,7 +18,9 @@ function(find_and_configure_gtest) # Find or install GoogleTest rapids_cpm_gtest( - BUILD_EXPORT_SET cudf-testing-exports INSTALL_EXPORT_SET cudf-testing-exports BUILD_STATIC + BUILD_EXPORT_SET cudf-testing-exports + INSTALL_EXPORT_SET cudf-testing-exports + BUILD_STATIC ) if(GTest_ADDED) From 976815e48fdc577c1bac9e8fc4968985487707e6 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 18 Apr 2024 17:43:46 -0400 Subject: [PATCH 3/6] Refactor cudftestutil to not have a public gtest dependency --- cpp/CMakeLists.txt | 10 ++++------ cpp/benchmarks/CMakeLists.txt | 2 +- cpp/include/cudf_test/column_wrapper.hpp | 1 - cpp/tests/CMakeLists.txt | 5 +++-- cpp/tests/groupby/groupby_test_util.cpp | 1 + .../utilities/{base_fixture.cpp => random_seed.cpp} | 0 6 files changed, 9 insertions(+), 10 deletions(-) rename cpp/tests/utilities/{base_fixture.cpp => random_seed.cpp} (100%) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 98afd8fd734..a5c8c3d3fd6 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -844,14 +844,12 @@ if(CUDF_BUILD_TESTUTIL) add_library(cudf::cudftest_default_stream ALIAS cudftest_default_stream) - # Needs to be static so that we support usage of static builds of gtest which doesn't compile with - # fPIC enabled and therefore can't be embedded into shared libraries. add_library( - cudftestutil STATIC + cudftestutil SHARED tests/io/metadata_utilities.cpp - tests/utilities/base_fixture.cpp tests/utilities/column_utilities.cu tests/utilities/debug_utilities.cu + tests/utilities/random_seed.cpp tests/utilities/table_utilities.cu tests/utilities/tdigest_utilities.cu ) @@ -876,8 +874,8 @@ if(CUDF_BUILD_TESTUTIL) target_link_libraries( cudftestutil - PUBLIC GTest::gmock GTest::gtest Threads::Threads cudf cudftest_default_stream - PRIVATE $ + PUBLIC Threads::Threads cudf cudftest_default_stream + PRIVATE GTest::gmock GTest::gtest $ ) target_include_directories( diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index b384f6d5674..04413514ac5 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -40,7 +40,7 @@ target_include_directories( # Use an OBJECT library so we only compile these helper source files only once add_library( - cudf_benchmark_common OBJECT "${CUDF_SOURCE_DIR}/tests/utilities/base_fixture.cpp" + cudf_benchmark_common OBJECT "${CUDF_SOURCE_DIR}/tests/utilities/random_seed.cpp" synchronization/synchronization.cpp io/cuio_common.cpp ) target_link_libraries(cudf_benchmark_common PRIVATE cudf_datagen $) diff --git a/cpp/include/cudf_test/column_wrapper.hpp b/cpp/include/cudf_test/column_wrapper.hpp index 151fe50be4f..dc873658abf 100644 --- a/cpp/include/cudf_test/column_wrapper.hpp +++ b/cpp/include/cudf_test/column_wrapper.hpp @@ -17,7 +17,6 @@ #pragma once #include -#include #include #include diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 053fcc0989a..d0c2b3d2bce 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -55,8 +55,9 @@ function(ConfigureTest CMAKE_TEST_NAME) ) target_link_libraries( - ${CMAKE_TEST_NAME} PRIVATE cudftestutil GTest::gmock_main GTest::gtest_main nvtx3-cpp - $ "${_CUDF_TEST_EXTRA_LIB}" + ${CMAKE_TEST_NAME} + PRIVATE cudftestutil GTest::gmock GTest::gmock_main GTest::gtest GTest::gtest_main nvtx3-cpp + $ "${_CUDF_TEST_EXTRA_LIB}" ) rapids_cuda_set_runtime(${CMAKE_TEST_NAME} USE_STATIC ${CUDA_STATIC_RUNTIME}) rapids_test_add( diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index de51012e8e1..c729d599594 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/cpp/tests/utilities/base_fixture.cpp b/cpp/tests/utilities/random_seed.cpp similarity index 100% rename from cpp/tests/utilities/base_fixture.cpp rename to cpp/tests/utilities/random_seed.cpp From 2530c68bb8b303c803ba1f0ae7e0dc96ae4ac53f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 19 Apr 2024 09:10:04 -0400 Subject: [PATCH 4/6] Remove gtest dependency from cudftestutil --- cpp/cmake/thirdparty/get_gtest.cmake | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake index 4923c1fabb1..10e6b026d9a 100644 --- a/cpp/cmake/thirdparty/get_gtest.cmake +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -17,26 +17,7 @@ function(find_and_configure_gtest) include(${rapids-cmake-dir}/cpm/gtest.cmake) # Find or install GoogleTest - rapids_cpm_gtest( - BUILD_EXPORT_SET cudf-testing-exports - INSTALL_EXPORT_SET cudf-testing-exports - BUILD_STATIC - ) - - if(GTest_ADDED) - rapids_export( - BUILD GTest - VERSION ${GTest_VERSION} - EXPORT_SET GTestTargets - GLOBAL_TARGETS gtest gmock gtest_main gmock_main - NAMESPACE GTest:: - ) - - include("${rapids-cmake-dir}/export/find_package_root.cmake") - rapids_export_find_package_root( - BUILD GTest [=[${CMAKE_CURRENT_LIST_DIR}]=] EXPORT_SET cudf-testing-exports - ) - endif() + rapids_cpm_gtest(BUILD_STATIC) endfunction() From 0e45394e7db26f7cf962f70242fbfdb2c3dfd8d7 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 19 Apr 2024 11:21:33 -0400 Subject: [PATCH 5/6] Update copyright year --- cpp/tests/groupby/groupby_test_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index c729d599594..8bd109fca53 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2023, NVIDIA CORPORATION. + * Copyright (c) 2020-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From d7058f8d25d262f95b10ad7fa773413b5c069460 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 23 Apr 2024 13:19:32 -0400 Subject: [PATCH 6/6] Remove unneeded hacks for GTest < 1.11 --- cpp/include/cudf_test/cudf_gtest.hpp | 82 +--------------------------- 1 file changed, 1 insertion(+), 81 deletions(-) diff --git a/cpp/include/cudf_test/cudf_gtest.hpp b/cpp/include/cudf_test/cudf_gtest.hpp index fa76204d622..89394fbd1c3 100644 --- a/cpp/include/cudf_test/cudf_gtest.hpp +++ b/cpp/include/cudf_test/cudf_gtest.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023, NVIDIA CORPORATION. + * Copyright (c) 2019-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,86 +16,6 @@ #pragma once -#ifdef GTEST_INCLUDE_GTEST_GTEST_H_ -#error "Don't include gtest/gtest.h directly, include cudf_gtest.hpp instead" -#endif - -/** - * @file cudf_gtest.hpp - * @brief Work around for GTests( <=v1.10 ) emulation of variadic templates in - * @verbatim ::Testing::Types @endverbatim - * - * @note Instead of including `gtest/gtest.h`, all libcudf test files should - * include `cudf_gtest.hpp` instead. - * - * Removes the 50 type limit in a type-parameterized test list. - * - * Uses macros to rename GTests's emulated variadic template types and then - * redefines them properly. - */ - -// @cond -#if __has_include() -// gtest doesn't provide a version header so we need to -// use a file existence trick. -// gtest-type-util.h.pump only exists in versions < 1.11 -#define Types Types_NOT_USED -#define Types0 Types0_NOT_USED -#define TypeList TypeList_NOT_USED -#define Templates Templates_NOT_USED -#define Templates0 Templates0_NOT_USED -#include -#undef Types -#undef Types0 -#undef TypeList -#undef Templates -#undef Templates0 - -namespace testing { -template -struct Types { - using type = Types; -}; - -template -struct Types { - using Head = T; - using Tail = Types; - - using type = Types; -}; - -namespace internal { -using Types0 = Types<>; - -template -struct Templates {}; - -template -struct Templates { - using Head = internal::TemplateSel; - using Tail = Templates; - - using type = Templates; -}; - -using Templates0 = Templates<>; - -template -struct TypeList { - using type = Types; -}; - -template -struct TypeList> { - using type = Types; -}; - -} // namespace internal -} // namespace testing -#endif // gtest < 1.11 -// @endcond - #include #include