Commit Graph

643 Commits

Author SHA1 Message Date
Oleksandr Pavlyk
e7cc1e344c Add an benchmark example parametrized by typename and integral constant. (#275)
* Add an benchmark example parametrized by typename and integral constant.

Add a variation of copy_type_sweep kernel, where block size is controlled
via integral constant passed as template parameter.

* Addressed PR review feedback

* Use auto to gridSize

* Address PR review change request

* Add comment to use ceil_div with CCCL >= 2.8
2025-10-07 13:49:17 -04:00
Oleksandr Pavlyk
b88a45f417 Merge pull request #269 from jayavenkatesh19/main
remove pynvjitlink references in examples
2025-09-17 13:54:36 -05:00
Jaya Venkatesh
0f997271f7 added numba-cuda to requirements
Signed-off-by: Jaya Venkatesh <jjayabaskar@nvidia.com>
2025-09-16 14:54:08 -07:00
Jaya Venkatesh
bfa6a6c7c6 remove pynvjitlink references in examples
Signed-off-by: Jaya Venkatesh <jjayabaskar@nvidia.com>
2025-09-08 16:00:19 -07:00
Allison Piper
4642df7006 Fix sccache checks when running locally. (#268) 2025-09-05 15:50:09 -04:00
Allison Piper
33a659ecd3 Add CTK 13.0 + Clang20 to CI. (#266) 2025-09-03 11:24:07 -04:00
Allison Piper
ebc1bd1795 Avoid unreachable code warning (#265) 2025-09-02 22:03:39 -04:00
Oleksandr Pavlyk
935bb0b633 Merge pull request #237 from oleksandr-pavlyk/add-pynvbench
Python package pynvbench introduced that exposes `cuda.bench` namespace. Repository provides a set of examples.
2025-08-06 12:22:55 -05:00
Oleksandr Pavlyk
b5e4b4ba31 cuda.nvbench -> cuda.bench
Per PR review suggestion:
   - `cuda.parallel`    - device-wide algorithms/Thrust
   - `cuda.cooperative` - Cooperative algorithsm/CUB
   - `cuda.bench`       - Benchmarking/NVBench
2025-08-04 13:42:43 -05:00
Oleksandr Pavlyk
c2a2acc9b6 Change float64_t arg-type for set_throttle_threshold to float32_t
The C++ method signature of set_throttle_threshold/set_trottle_recovery_delay,
which uses nvbench::float32_t
2025-08-04 12:14:52 -05:00
Oleksandr Pavlyk
584f48ac97 Remove warm-up invocations outside of launcher in examples/throughout and auto_throughput 2025-08-04 12:14:44 -05:00
Oleksandr Pavlyk
d8b0acc8d4 Export exception to nvbench namespace 2025-08-04 12:00:42 -05:00
Oleksandr Pavlyk
9dfdd8af89 Minimal test file 2025-08-04 11:59:17 -05:00
Oleksandr Pavlyk
6aff4712f8 Change permissions of test/run_1.py 2025-08-04 10:13:08 -05:00
Oleksandr Pavlyk
73e18419b2 Stub of __cuda_stream__ special method declare tuple[int, int] as return type
This is to indicate that special method always returns a pair of integers
2025-08-04 10:11:33 -05:00
Oleksandr Pavlyk
a5e0a48f80 Add test test functions for cpp/python exceptions 2025-08-04 10:09:10 -05:00
Oleksandr Pavlyk
40a2337a6b Review fix: make nvbenhch_run_error constructable
Allow `throw nvbench_run_error("Msg");` to compile.

Add comment around definition of nvbench_run_error
2025-08-04 10:09:04 -05:00
Oleksandr Pavlyk
4fc628c4d7 Python native extension to use CXX/CUDA standard of NVBench library
This fixes cryptic build failure with GNU compiler 14
2025-08-01 15:33:39 -05:00
Oleksandr Pavlyk
3fea652d16 Fix type in stub declaration for Benchmark.add_string_axis 2025-08-01 15:03:06 -05:00
Oleksandr Pavlyk
fa8dd48186 json_printer.cu changed to use write-out buffer of 4KB (#259)
* json_printer.cu changed to use write-out buffer of 4KB

The json_printer::do_process_bulk_data_float64 used to write
out one float32 value at a time. This PR introduces a buffer of 4KB
that is being filled with values until full, and then written out.

The 4KB value aligns with system memory page size and seems
appropriate for relatively small datasizes of duration measurements.

* Add explicit static cast from std::size_t to std::streamsize

The explcit cast avoids narrowing error.

* Factor out writing array out to binary file into standalone function

This function is templated based on buffer-size. The function can be
reused to also write-out frequence samples in the future.
2025-08-01 12:48:25 -07:00
Oleksandr Pavlyk
080052a564 nvbench::state::set_stopping_criterion now also sets criterion params (#257)
This change closes gh-255 by alignign implementation of
state::set_stopping_criterion with that of
benchmark_base::set_stopping_criterion.
2025-08-01 11:46:36 -07:00
Oleksandr Pavlyk
f1fbfd85b4 Renamed src/README.md to src/.BUILD_LOCALLY.md
Provided more context to the command stated in the readme, and
changed so as to not hard-code installation paths of NVBench,
and checkout path of pybind11.
2025-07-31 16:27:54 -05:00
Oleksandr Pavlyk
453a1648aa Improvements to readability of examples per PR review 2025-07-31 16:20:52 -05:00
Oleksandr Pavlyk
c91204f259 Improved docstrings per PR review suggestions 2025-07-31 15:48:49 -05:00
Oleksandr Pavlyk
fb23591aef Fixed missing space in README 2025-07-31 15:42:30 -05:00
Oleksandr Pavlyk
f12edf722b Merge pull request #256 from oleksandr-pavlyk/fix-typo-in-comment
Fix typo: updaring->updating
2025-07-31 09:27:31 -05:00
Oleksandr Pavlyk
add539a0c1 Replaced argument type annotation: int -> typing.SupportsInt
Same for float->typing.SupportsFloat. Result types remain int/float
2025-07-30 16:54:56 -05:00
Oleksandr Pavlyk
a341c30d60 Fix typo: updaring->updating 2025-07-30 13:56:24 -05:00
Oleksandr Pavlyk
88a3ad0138 Add test/stub.py
The following static analysis run should run green

```
mypy --ignore-missing-imports test/stub.py
```
2025-07-30 13:54:37 -05:00
Oleksandr Pavlyk
9c01f229a6 Add Benchmark set methods, such as set_stopping_criterion, set_timeout, etc
Add
   - State.get_stopping_criterion() -> str
   - Benchmark.set_stopping_criterion(criterion: str) -> Self
   - Benchmark.set_criterion_param_int64(name: str, value: int) -> Self
   - Benchmark.set_criterion_param_float64(name: str, value: float) -> Self
   - Benchmark.set_criterion_param_string(name: str, value: str) -> Self
   - Benchmark.set_timeout(duration: float) -> Self
   - Benchmark.set_skip_time(skip_time: float) -> Self
   - Benchmark.set_throttle_threshold(frac: float) -> Self
   - Benchmark.set_throttle_recovery_delay(duration: float) -> Self
   - Benchmark.set_min_samples(count: int) -> Self
2025-07-30 13:37:17 -05:00
Oleksandr Pavlyk
6b9050e404 Add example of benchmarking pytorch code 2025-07-28 15:57:11 -05:00
Oleksandr Pavlyk
413c4a114b Support nvbench.State.set_throttle_threshold 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
afb9951ed8 Enable building of NVBench as part of buildign extension
1. Download and include CPM.cmake, version 0.42.0
2. Use CPM.make to get Pybind11
3. Update to use pybind11=3.0.0
4. Also use CPM to configure/build nvbench
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
b6821b7624 Rename NVBenchRuntimeException to NVBenchRuntimeError
Added exception to __init__.pyi
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
b97e27cbf2 Add use of add_axis_values and add_axis_values_as_string to test/run_1.py 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
eb614ac52f Add State.get_axis_values and State.get_axis_values_as_string
Add nvbench.State methods to get Python dictionary representing
axis values of benchmark configuration state represents.

get_axis_values_as_string gives a string of space-separated
name=values pairs.
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
5613281c2e nvbench.State.exec validates arg to be a callable
Add names to method arguments to make it more self-descriptive.
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
c747a19b98 Remove code setting up CUDA_MODULE_LOADING=EAGER in Python extension 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
985db4f144 Add examples/cccl_cooperative_block_reduce.py 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
445d881eda Expand README
Make it explicit in README that we build and locally install NVBench first,
and then build Python package use the library as a dependency.

The nvbench library is installed into Python layout alongside the native
extension.
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
5e8c17c740 Fix mypy error in import statement used in cutlass_gemm example 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
b9554d7980 Fix method name typo in stub file discovered by mypy 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
5c01c34793 Fix mypy error in cutlass_gemm example 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
5428534124 Add license header to __init__.py 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
480614e847 Add license to stub fuile, add comment about syncing impl and stubs
Add comments stating the need to keep implementation and Python stub
file in sync to both files. In the stub file to comment documents
use of mypy's stubgen to generate stubs and calls to compare that against
current stubs. It also calls out the need to keep docstrings and
doctring examples in sync with implementation.
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
a69a3647b2 CUTLASS example added, license headers added, fixes
- Add license header to each example file.
- Fixed broken runs caused by type declarations.
- Fixed hang in throughput.py when --run-once by doing a
  manual warm-up step, like in auto_throughput.py
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
c136efab65 Use absolute imports in cuda/nvbench/__init__.py 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
fc0249d188 Updated examples/axes.py to use get_float64_or_default 2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
361c0337be Use cuda-pathfinder instead of cuda-bindings for Pathfinder
Removed use of __all__ per PR feedback. Emit warnings.warn if
version information could not be retrieved from the package metadata,
e.g., package has been renamed by source code was not updated.
2025-07-28 15:37:05 -05:00
Oleksandr Pavlyk
51fa07fab8 Avoid overloading get_int64_or_default as get_int64
Introduce get_int64_or_default method, and counterparts for
float64 and string.

Provided names for Python arguments.

Tried generating Python stubs automatically with

```
stubgen -m cuda.nvbench._nvbench
```

Gave up on this, since it does not include doc-strings.
It would be nice to compare auto-generated _nvbench.pyi with
__init__.pyi for discrepancies though.
2025-07-28 15:37:05 -05:00