From b88cc78aebdbd669845224091abca9fbbd4dfc33 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Tue, 1 Jul 2025 09:19:18 -0500 Subject: [PATCH] Add license header to py_nvbench.cpp Also updated comment as to why calling `nvbench::benchmark_manager::get().initialize()` is necessary for running all tests. --- python/src/py_nvbench.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/python/src/py_nvbench.cpp b/python/src/py_nvbench.cpp index 9ca7e64..c9f3824 100644 --- a/python/src/py_nvbench.cpp +++ b/python/src/py_nvbench.cpp @@ -1,4 +1,20 @@ -// TODO: Copyright header +/* + * Copyright 2025 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 with the LLVM exception + * (the "License"); you may not use this file except in compliance with + * the License. + * + * You may obtain a copy of the License at + * + * http://llvm.org/foundation/relicensing/LICENSE.txt + * + * 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 @@ -140,8 +156,8 @@ public: try { - // TODO: This line is mandatory for correctness - // Q: Why is initializing at module init not enough? + // This line is mandatory for correctness to populate + // benchmark with devices requested by user via CLI nvbench::benchmark_manager::get().initialize(); { nvbench::option_parser parser{}; @@ -184,6 +200,8 @@ PYBIND11_MODULE(_nvbench, m) NVBENCH_DRIVER_API_CALL(cuInit(0)); + // This line ensures that benchmark_manager has been created during module init + // It is reinitialized before running all benchmarks to set devices to use nvbench::benchmark_manager::get().initialize(); // TODO: Use cuModuleGetLoadingMode(&mode) to confirm that (mode == CU_MODULE_EAGER_LOADING)