mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-13 00:08:26 +08:00
CUDA 13.4 samples update - v13.4-public
Release 13.4 of the CUDA Samples supported by CUDA Toolkit 13.4. See Changelog for more information.
This commit is contained in:
@@ -72,15 +72,19 @@ verified on the host.
|
||||
|
||||
### Platform Support
|
||||
|
||||
The `ManagedMemoryResource` demo in this sample exercises **concurrent host
|
||||
access** to managed allocations while the GPU is active, which requires the
|
||||
device property `concurrent_managed_access=True`. This is only supported on
|
||||
Linux with HMM (Pascal and newer). On Windows (WDDM/MCDM/TCC) the property
|
||||
is `False`, so the sample exits early with a waive message and exit code
|
||||
`2`. The `DeviceMemoryResource` + `PinnedMemoryResource` demos in this
|
||||
sample would still work on Windows on their own, but to keep the sample
|
||||
self-contained the entire script waives when concurrent managed access is
|
||||
unavailable.
|
||||
This sample needs two device capabilities, and exits with code `2` when
|
||||
either is missing:
|
||||
|
||||
- `PinnedMemoryResource` is backed by a host memory pool, which requires
|
||||
`host_memory_pools_supported=True`. Windows in TCC mode and older
|
||||
integrated GPUs such as Jetson Orin report `False`.
|
||||
- The `ManagedMemoryResource` demo builds host NumPy views over managed
|
||||
allocations, which requires `concurrent_managed_access=True`. Windows
|
||||
(WDDM/MCDM/TCC) and older integrated GPUs such as Jetson Orin report
|
||||
`False`.
|
||||
|
||||
The demos are checked up front rather than individually to keep the sample
|
||||
self-contained.
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -222,18 +222,23 @@ def main():
|
||||
parser.add_argument("--device", type=int, default=0, help="CUDA device id")
|
||||
args = parser.parse_args()
|
||||
|
||||
if sys.platform == "win32":
|
||||
print(
|
||||
"This sample relies on ManagedMemoryResource with concurrent host "
|
||||
"access, which is not supported on Windows "
|
||||
"(concurrent_managed_access=False). Waiving this sample."
|
||||
)
|
||||
sys.exit(2)
|
||||
|
||||
device = Device(args.device)
|
||||
device.set_current()
|
||||
print_gpu_info(device)
|
||||
|
||||
# PinnedMemoryResource is backed by a host memory pool, which is not
|
||||
# available on every device.
|
||||
if not device.properties.host_memory_pools_supported:
|
||||
print("Host pinned memory pools are not supported on this platform.")
|
||||
return 2
|
||||
|
||||
# This sample builds host NumPy views over managed memory. Devices without
|
||||
# concurrent managed access keep managed allocations GPU-exclusive while
|
||||
# the GPU is active, so those host views fault.
|
||||
if not device.properties.concurrent_managed_access:
|
||||
print("Concurrent managed memory access is not supported on this platform.")
|
||||
return 2
|
||||
|
||||
stream = device.create_stream()
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user