Skip to content

Commit de62306

Browse files
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.
1 parent 8b81c00 commit de62306

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

python/src/py_nvbench.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
// TODO: Copyright header
1+
/*
2+
* Copyright 2025 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 with the LLVM exception
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License.
7+
*
8+
* You may obtain a copy of the License at
9+
*
10+
* http://llvm.org/foundation/relicensing/LICENSE.txt
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
218

319
#include <nvbench/nvbench.cuh>
420

@@ -140,8 +156,8 @@ class GlobalBenchmarkRegistry
140156

141157
try
142158
{
143-
// TODO: This line is mandatory for correctness
144-
// Q: Why is initializing at module init not enough?
159+
// This line is mandatory for correctness to populate
160+
// benchmark with devices requested by user via CLI
145161
nvbench::benchmark_manager::get().initialize();
146162
{
147163
nvbench::option_parser parser{};
@@ -184,6 +200,8 @@ PYBIND11_MODULE(_nvbench, m)
184200

185201
NVBENCH_DRIVER_API_CALL(cuInit(0));
186202

203+
// This line ensures that benchmark_manager has been created during module init
204+
// It is reinitialized before running all benchmarks to set devices to use
187205
nvbench::benchmark_manager::get().initialize();
188206

189207
// TODO: Use cuModuleGetLoadingMode(&mode) to confirm that (mode == CU_MODULE_EAGER_LOADING)

0 commit comments

Comments
 (0)