Skip to content

Commit 4af54ac

Browse files
committed
add windows support
1 parent cd90278 commit 4af54ac

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ class _SynchronousMemoryResource(MemoryResource):
10881088
return self._dev_id
10891089

10901090

1091-
VirtualMemoryHandleTypeT = Literal["posix_fd", "generic", "none"]
1091+
VirtualMemoryHandleTypeT = Literal["posix_fd", "generic", "none", "win32"]
10921092
VirtualMemoryLocationTypeT = Literal["device", "host", "host_numa", "host_numa_current"]
10931093
VirtualMemoryGranularityT = Literal["minimum", "recommended"]
10941094
VirtualMemoryAccessTypeT = Literal["rw", "r", "none"]

cuda_core/tests/test_memory.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,11 @@ def test_vmm_allocator_basic_allocation():
322322
"""
323323
device = Device()
324324
device.set_current()
325-
325+
options = VirtualMemoryResourceOptions()
326+
if platform.system() == "Windows":
327+
options.handle_type = "win32"
326328
# Create VMM allocator with default config
327-
vmm_mr = VirtualMemoryResource(device)
329+
vmm_mr = VirtualMemoryResource(device, config=options)
328330

329331
# Test basic allocation
330332
buffer = vmm_mr.allocate(4096)
@@ -363,7 +365,7 @@ def test_vmm_allocator_policy_configuration():
363365
location_type="device",
364366
granularity="minimum",
365367
gpu_direct_rdma=True,
366-
handle_type="posix_fd",
368+
handle_type="posix_fd" if platform.system() != "Windows" else "win32",
367369
peers=(),
368370
self_access="rw",
369371
peer_access="rw",
@@ -412,7 +414,10 @@ def test_vmm_allocator_grow_allocation():
412414
device = Device()
413415
device.set_current()
414416

415-
vmm_mr = VirtualMemoryResource(device)
417+
options = VirtualMemoryResourceOptions()
418+
if platform.system() == "Windows":
419+
options.handle_type = "win32"
420+
vmm_mr = VirtualMemoryResource(device, config=options)
416421

417422
# Create initial allocation
418423
buffer = vmm_mr.allocate(2 * 1024 * 1024)

0 commit comments

Comments
 (0)