MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / main

Function main

python/2_CoreConcepts/parallelHistogram/parallelHistogram.py:103–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102
103def main():
104 print("=" * 60)
105 print("Parallel Histogram with Atomics (cuda.core)")
106 print("=" * 60)
107
108 # Initialize device using cuda.core
109 device = Device(0)
110 device.set_current()
111 print(f"\nDevice: {device.name}")
112 print(f"Compute Capability: {device.compute_capability}")
113
114 # Create stream using cuda.core
115 stream = device.create_stream()
116
117 # Make CuPy use the same stream for correct ordering (avoids null-stream sync)
118 cp.cuda.Stream.from_external(stream).use()
119
120 try:
121 _run_histogram(device, stream)
122 finally:
123 cp.cuda.Stream.null.use() # Restore CuPy to default stream before closing
124 stream.close()
125
126
127def _run_histogram(device, stream):

Callers 1

Calls 1

_run_histogramFunction · 0.85

Tested by

no test coverage detected