|
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 | + */ |
2 | 18 |
|
3 | 19 | #include <nvbench/nvbench.cuh> |
4 | 20 |
|
@@ -140,8 +156,8 @@ class GlobalBenchmarkRegistry |
140 | 156 |
|
141 | 157 | try |
142 | 158 | { |
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 |
145 | 161 | nvbench::benchmark_manager::get().initialize(); |
146 | 162 | { |
147 | 163 | nvbench::option_parser parser{}; |
@@ -184,6 +200,8 @@ PYBIND11_MODULE(_nvbench, m) |
184 | 200 |
|
185 | 201 | NVBENCH_DRIVER_API_CALL(cuInit(0)); |
186 | 202 |
|
| 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 |
187 | 205 | nvbench::benchmark_manager::get().initialize(); |
188 | 206 |
|
189 | 207 | // TODO: Use cuModuleGetLoadingMode(&mode) to confirm that (mode == CU_MODULE_EAGER_LOADING) |
|
0 commit comments