Merge branch 'main' into change-nvbench-main-target-to-build-static-library-not-object-file

This commit is contained in:
Oleksandr Pavlyk
2026-05-05 11:46:03 -05:00
committed by GitHub
4 changed files with 31 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2025 NVIDIA Corporation
# Copyright 2025-2026 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
@@ -109,7 +109,7 @@ class State:
self, column_name: str, value: Union[SupportsInt, SupportsFloat, str]
) -> None: ...
def get_axis_values(self) -> dict[str, int | float | str]: ...
def get_axis_values_as_string(self) -> str: ...
def get_axis_values_as_string(self, color: bool = ...) -> str: ...
def get_stopping_criterion(self) -> str: ...
def register(fn: Callable[[State], None]) -> Benchmark: ...

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2025 NVIDIA Corporation
* Copyright 2025-2026 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
@@ -1097,7 +1097,9 @@ Get string of space-separated name=value pairs for this configuration
)XXXX";
pystate_cls.def("get_axis_values_as_string",
&nvbench::state::get_axis_values_as_string,
method_get_axis_values_as_string_doc);
method_get_axis_values_as_string_doc,
py::kw_only{},
py::arg("color") = false);
// method State.get_axis_values
static constexpr const char *method_get_axis_values_doc = R"XXXX(

View File

@@ -1,3 +1,19 @@
# Copyright 2026 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.
import sys
import cuda.bench as bench
@@ -27,6 +43,9 @@ def add_two(state: bench.State):
a = cuda.to_device(np.random.random(N))
c = cuda.device_array_like(a)
colorized_av = state.get_axis_values_as_string(color=True)
assert isinstance(colorized_av, str)
assert "elements" in state.get_axis_values()
assert "elements=" in state.get_axis_values_as_string()
@@ -100,9 +119,10 @@ def add_three(state: bench.State):
def register_benchmarks():
(
bench.register(add_two).add_int64_axis(
"elements", [2**pow2 - 1 for pow2 in range(20, 23)]
)
bench.register(add_two)
.add_int64_axis("elements", [2**pow2 - 1 for pow2 in range(20, 23)])
.set_stopping_criterion("entropy")
.set_criterion_param_float64("min-r2", 0.85)
)
(
bench.register(add_float)

View File

@@ -1,4 +1,4 @@
# Copyright 2025 NVIDIA Corporation
# Copyright 2025-2026 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
@@ -20,7 +20,7 @@ from typing import Dict, Optional, Tuple
import cuda.bench as bench
import cuda.cccl.headers as headers
import cuda.core.experimental as core
import cuda.core as core
def as_core_Stream(cs: bench.CudaStream) -> core.Stream: