mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-20 06:48:53 +00:00
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.
This commit is contained in:
@@ -1,4 +1,29 @@
|
||||
# from __future__ import annotations
|
||||
# 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.
|
||||
|
||||
# ============================================
|
||||
# PLEASE KEEP IN SYNC WITH py_nvbench.cpp FILE
|
||||
# ============================================
|
||||
# Please be sure to keep these type hints and docstring in sync
|
||||
# with the pybind11 bindings in ``../../src/py_nvbench.cpp``
|
||||
|
||||
# Use mypy's stubgen to auto-generate stubs using
|
||||
# ``stubgen -m cuda.nvbench._nvbench`` and compare
|
||||
# stubs in generated out/cuda/nvbench/_nvbench.pyi
|
||||
# with definitions given here.
|
||||
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import Optional, Self, Union
|
||||
@@ -22,11 +47,11 @@ class CudaStream:
|
||||
import cuda.nvbench as nvbench
|
||||
|
||||
def bench(state: nvbench.State):
|
||||
dev = core.Device(state.getDevice())
|
||||
dev = core.Device(state.get_device())
|
||||
dev.set_current()
|
||||
# converts CudaString to core.Stream
|
||||
# using __cuda_stream__ protocol
|
||||
dev.create_stream(state.getStream())
|
||||
dev.create_stream(state.get_stream())
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user