mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-11-17 17:38:18 +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:
@@ -157,6 +157,15 @@ def run(num_elements=1024 * 1024 * 16):
|
||||
f"GPU{gpuid[0]}, GPU{gpuid[1]} and CPU Host)..."
|
||||
)
|
||||
|
||||
# DeviceMemoryResource is backed by a device memory pool, which is not
|
||||
# available on every device.
|
||||
if not (
|
||||
dev0.properties.memory_pools_supported
|
||||
and dev1.properties.memory_pools_supported
|
||||
):
|
||||
print("\nDevice memory pools are not supported on this platform.")
|
||||
return 2
|
||||
|
||||
# Allocate on GPU 0 and grant access to GPU 1
|
||||
dev0.set_current()
|
||||
mr0 = DeviceMemoryResource(dev0)
|
||||
@@ -176,6 +185,14 @@ def run(num_elements=1024 * 1024 * 16):
|
||||
)
|
||||
|
||||
# Allocate pinned host memory
|
||||
# PinnedMemoryResource is backed by a host memory pool, which is not
|
||||
# available on every device.
|
||||
if not (
|
||||
dev0.properties.host_memory_pools_supported
|
||||
and dev1.properties.host_memory_pools_supported
|
||||
):
|
||||
print("\nHost pinned memory pools are not supported on this platform.")
|
||||
return 2
|
||||
pinned_mr = PinnedMemoryResource()
|
||||
h0 = pinned_mr.allocate(buf_size, stream=dev0.default_stream)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user