Files
nvbench/cmake/NVBenchDependentDlls.cmake
Allison Vacanti b948e79cab Add NVML support for persistence mode, locking clocks.
Locking clocks is currently only implemented for Volta+ devices.

Example usage:

my_bench -d [0,1,3] --persistence-mode 1 --lock-gpu-clocks base

See the cli_help.md docs for more info.
2021-12-17 13:59:43 -05:00

37 lines
1.2 KiB
CMake

# By default, add dependent DLLs to the build dir on MSVC. This avoids
# a variety of runtime issues when using NVML, etc.
# This behavior can be disabled using the following options:
if (WIN32)
option(NVBench_ADD_DEPENDENT_DLLS_TO_BUILD
"Copy dependent dlls to NVBench library build location (MSVC only)."
ON
)
else()
# These are forced off for non-MSVC builds, as $<TARGET_RUNTIME_DLLS:...>
# will always be empty on non-dll platforms.
set(NVBench_ADD_DEPENDENT_DLLS_TO_BUILD OFF)
endif()
if (NVBench_ADD_DEPENDENT_DLLS_TO_BUILD)
message(STATUS
"CMake 3.21.0 is required when NVBench_ADD_DEPENDENT_DLLS_TO_BUILD "
"is enabled."
)
cmake_minimum_required(VERSION 3.21.0)
endif()
function(nvbench_setup_dep_dlls target_name)
# The custom command below fails when there aren't any runtime DLLs to copy,
# so only enable it when a relevant dependency is enabled:
if (NVBench_ADD_DEPENDENT_DLLS_TO_BUILD AND NVBench_ENABLE_NVML)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" -E copy
"$<TARGET_RUNTIME_DLLS:${target_name}>"
"$<TARGET_FILE_DIR:${target_name}>"
COMMAND_EXPAND_LISTS
)
endif()
endfunction()