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

Use custom nvbench entry point to ensure cudf::nvbench_base_fixture usage #13183

Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ target_compile_options(

target_link_libraries(
cudf_datagen
PUBLIC GTest::gmock GTest::gtest GTest::gmock_main GTest::gtest_main benchmark::benchmark
nvbench::nvbench Threads::Threads cudf cudftestutil
PUBLIC GTest::gmock GTest::gtest benchmark::benchmark nvbench::nvbench Threads::Threads cudf
cudftestutil
PRIVATE $<TARGET_NAME_IF_EXISTS:conda_env>
)

Expand Down Expand Up @@ -91,14 +91,14 @@ endfunction()
# This function takes in a benchmark name and benchmark source for nvbench benchmarks and handles
# setting all of the associated properties and linking to build the benchmark
function(ConfigureNVBench CMAKE_BENCH_NAME)
add_executable(${CMAKE_BENCH_NAME} ${ARGN})
add_executable(${CMAKE_BENCH_NAME} ${ARGN} fixture/nvbench_main.cu)
set_target_properties(
${CMAKE_BENCH_NAME}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<BUILD_INTERFACE:${CUDF_BINARY_DIR}/benchmarks>"
INSTALL_RPATH "\$ORIGIN/../../../lib"
)
target_link_libraries(
${CMAKE_BENCH_NAME} PRIVATE cudf_benchmark_common cudf_datagen nvbench::main
${CMAKE_BENCH_NAME} PRIVATE cudf_benchmark_common cudf_datagen nvbench::nvbench
$<TARGET_NAME_IF_EXISTS:conda_env>
)
install(
Expand Down
22 changes: 22 additions & 0 deletions cpp/benchmarks/fixture/nvbench_main.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
robertmaynard marked this conversation as resolved.
Show resolved Hide resolved
* Copyright (c) 2023, 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <benchmarks/fixture/rmm_pool_raii.hpp>
#define NVBENCH_ENVIRONMENT cudf::nvbench_base_fixture

#include <nvbench/main.cuh>

NVBENCH_MAIN
2 changes: 0 additions & 2 deletions cpp/benchmarks/fixture/rmm_pool_raii.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,3 @@ struct nvbench_base_fixture {
};

} // namespace cudf

#define NVBENCH_ENVIRONMENT cudf::nvbench_base_fixture
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/patches/nvbench_global_setup.diff
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ index 0ba82d7..7ab02c1 100644
printer.set_total_state_count(total_states); \
\
printer.set_completed_state_count(0); \
+ NVBENCH_ENVIRONMENT(); \
+ auto env_state = NVBENCH_ENVIRONMENT(); \
for (auto &bench_ptr : benchmarks) \
{ \
bench_ptr->set_printer(printer); \