mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-13 00:08:26 +08:00
Release v13.3 of the CUDA samples with CUDA 13.3 Toolkit (#435)
This is the release of the CUDA 13.3 samples, which include additions for CUDA Tile C++, and updated CCCL and Python samples.
This commit is contained in:
@@ -8,7 +8,7 @@ Demonstrates parallel prefix sum (scan) algorithms using cuda.compute with cuda.
|
||||
- Exclusive scan: `output[i] = init_value + input[0] + input[1] + ... + input[i-1]`
|
||||
- Uses cuda.compute APIs for optimized CUB-based implementations
|
||||
- Uses cuda.core APIs for device and stream management
|
||||
- Demonstrates CuPy integration via `ExternalStream`
|
||||
- Demonstrates CuPy integration via `Stream.from_external`
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -21,9 +21,9 @@ Demonstrates parallel prefix sum (scan) algorithms using cuda.compute with cuda.
|
||||
- CUDA Toolkit 13.0+
|
||||
- Python 3.10+
|
||||
- `cuda-python` (13.0.0+)
|
||||
- `cuda-core` (>=0.6.0)
|
||||
- `cuda-core` (>=1.0.0)
|
||||
- `cuda-cccl` (1.0.0+)
|
||||
- `cupy-cuda13x` (13.0.0+)
|
||||
- `cupy-cuda13x` (14.0.0+)
|
||||
- `numpy` (>=2.3.2)
|
||||
|
||||
## Usage
|
||||
@@ -56,8 +56,8 @@ This sample demonstrates proper stream usage across libraries:
|
||||
# Create stream with cuda.core
|
||||
stream = device.create_stream()
|
||||
|
||||
# Wrap for CuPy compatibility (requires int handle)
|
||||
cp_stream = cp.cuda.ExternalStream(int(stream.handle))
|
||||
# Wrap for CuPy compatibility (cuda.core Stream implements the __cuda_stream__ protocol)
|
||||
cp_stream = cp.cuda.Stream.from_external(stream)
|
||||
|
||||
# Use with CuPy operations
|
||||
with cp_stream:
|
||||
|
||||
@@ -62,7 +62,7 @@ def main() -> bool:
|
||||
device = Device(0)
|
||||
device.set_current()
|
||||
stream = device.create_stream()
|
||||
cp_stream = cp.cuda.ExternalStream(int(stream.handle))
|
||||
cp_stream = cp.cuda.Stream.from_external(stream)
|
||||
|
||||
ok = True
|
||||
try:
|
||||
@@ -153,7 +153,7 @@ def main() -> bool:
|
||||
)
|
||||
stream.sync()
|
||||
|
||||
event_opts = EventOptions(enable_timing=True)
|
||||
event_opts = EventOptions(timing_enabled=True)
|
||||
start_event = device.create_event(options=event_opts)
|
||||
end_event = device.create_event(options=event_opts)
|
||||
|
||||
@@ -184,7 +184,7 @@ def main() -> bool:
|
||||
print("• Inclusive: output[i] includes input[i]")
|
||||
print("• Exclusive: output[i] excludes input[i], starts with init_value")
|
||||
print("• cuda.compute provides CUB-based optimized implementations")
|
||||
print("• cuda.core Stream integrates with CuPy via ExternalStream")
|
||||
print("• cuda.core Stream integrates with CuPy via Stream.from_external")
|
||||
print("• Applications: stream compaction, radix sort, histograms")
|
||||
print("=" * 60)
|
||||
return ok
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Requires Python 3.10+, CUDA Toolkit 13.0+
|
||||
|
||||
cuda-python>=13.0.0
|
||||
cuda-core>=0.6.0
|
||||
cuda-core>=1.0.0
|
||||
cuda-cccl>=1.0.0
|
||||
cupy-cuda13x>=13.0.0
|
||||
cupy-cuda13x>=14.0.0
|
||||
numpy>=2.3.2
|
||||
|
||||
Reference in New Issue
Block a user