From 0ee32c12da59d14e10b7364dab9b912bc4ca6150 Mon Sep 17 00:00:00 2001 From: Ralf Juengling Date: Mon, 30 Nov 2026 12:02:47 -0800 Subject: [PATCH 1/3] test(cuda.core): pick only host NUMA nodes in the pool-kind numa_id test test_imported_pinned_resource_reports_numa_id chose the first nonzero NUMA node with memory. On Grace systems (GH200, GB300) that is GPU memory, which cuMemPoolCreate rejects as a host NUMA location, so the test failed with CUDA_ERROR_INVALID_VALUE. Require the node to have CPUs as well, and skip when none qualifies. Closes #3650. --- .../tests/memory_ipc/test_ipc_pool_kind.py | 59 +++++++++++++++---- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/cuda_core/tests/memory_ipc/test_ipc_pool_kind.py b/cuda_core/tests/memory_ipc/test_ipc_pool_kind.py index b7edc0192265..ea3d9c987aa3 100644 --- a/cuda_core/tests/memory_ipc/test_ipc_pool_kind.py +++ b/cuda_core/tests/memory_ipc/test_ipc_pool_kind.py @@ -46,19 +46,32 @@ pytestmark = pytest.mark.parallel_threads_limit(2) -def _nonzero_numa_node_with_memory(): - """The first host NUMA node other than 0 that has memory, or None.""" +NUMA_SYSFS = "/sys/devices/system/node" + + +def _parse_node_list(text): + """The node IDs in a sysfs node list such as ``0,2-3``.""" + nodes = set() + for node_range in text.strip().split(","): + if node_range: + first, _, last = node_range.partition("-") + nodes.update(range(int(first), int(last or first) + 1)) + return nodes + + +def _nonzero_host_numa_node(sysfs=NUMA_SYSFS): + """The first NUMA node other than 0 that has host memory, or None. + + A node with memory but no CPUs may be GPU memory, as on Grace systems, and + cuMemPoolCreate rejects it as a host NUMA location (#3650). + """ try: - with open("/sys/devices/system/node/has_memory") as f: - node_list = f.read().strip() + with open(f"{sysfs}/has_memory") as f_memory, open(f"{sysfs}/has_cpu") as f_cpu: + with_memory = _parse_node_list(f_memory.read()) + with_cpu = _parse_node_list(f_cpu.read()) except FileNotFoundError: return None - for node_range in node_list.split(","): - first, _, last = node_range.partition("-") - for node in range(int(first), int(last or first) + 1): - if node > 0: - return node - return None + return min((node for node in with_memory & with_cpu if node > 0), default=None) def _other_class(mr_type): @@ -251,9 +264,9 @@ def test_rejected_import_keeps_existing_import(self, pool_resource, exported_buf def test_imported_pinned_resource_reports_numa_id(self, ipc_device): skip_if_host_numa_pinned_memory_unsupported(ipc_device) # An imported resource used to report 0, so node 0 cannot tell the two apart. - numa_id = _nonzero_numa_node_with_memory() + numa_id = _nonzero_host_numa_node() if numa_id is None: - pytest.skip("needs a host NUMA node other than 0 with memory") + pytest.skip("needs a host NUMA node other than 0 with memory and CPUs") ipc_device.set_current() mr = PinnedMemoryResource(PinnedMemoryResourceOptions(max_size=POOL_SIZE, ipc_enabled=True, numa_id=numa_id)) try: @@ -261,3 +274,25 @@ def test_imported_pinned_resource_reports_numa_id(self, ipc_device): run_child(child_imported_numa_id, mr.allocation_handle, numa_id) finally: mr.close() + + +@pytest.mark.agent_authored(model="claude-sonnet-5-5") +@pytest.mark.parametrize( + ("has_memory", "has_cpu", "expected"), + [ + ("0-1", "0", None), # GH200: CPU memory at node 0, GPU memory at node 1 + ("0-9", "0", None), # GH200 with MIG nodes + ("0-1", "0-1", 1), # two-socket host + ("0,2-3", "0,3", 3), # the CPU-less node 2 is skipped + ("0", "0", None), + ], +) +def test_nonzero_host_numa_node(tmp_path, has_memory, has_cpu, expected): + (tmp_path / "has_memory").write_text(has_memory + "\n") + (tmp_path / "has_cpu").write_text(has_cpu + "\n") + assert _nonzero_host_numa_node(str(tmp_path)) == expected + + +@pytest.mark.agent_authored(model="claude-sonnet-5-5") +def test_nonzero_host_numa_node_without_sysfs(tmp_path): + assert _nonzero_host_numa_node(str(tmp_path)) is None From 6e1eaf7df76a54b594aac768ddf7bc081fa3512c Mon Sep 17 00:00:00 2001 From: Ralf Juengling Date: Mon, 30 Nov 2026 13:45:06 -0800 Subject: [PATCH 2/3] TEMP: force a full CI run to validate #3661 on the nightly runners (drop before merge) --- lychee.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lychee.toml b/lychee.toml index e8613a5cd791..7b30ca084b98 100644 --- a/lychee.toml +++ b/lychee.toml @@ -18,3 +18,5 @@ exclude = [ '^https://github\.com/NVIDIA/cuda-python/issues/2345$', '^https://github\.com/NVIDIA/cuda-python/issues/3363$', ] + +# TEMP: forces a full CI run for #3661 validation; remove before merge. From 89f393b8980dcfaf2443b53a2ad26c86b1a42486 Mon Sep 17 00:00:00 2001 From: Ralf Juengling Date: Mon, 30 Nov 2026 13:53:43 -0800 Subject: [PATCH 3/3] Revert "TEMP: force a full CI run to validate #3661 on the nightly runners (drop before merge)" This reverts commit 6e1eaf7df76a54b594aac768ddf7bc081fa3512c. --- lychee.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/lychee.toml b/lychee.toml index 7b30ca084b98..e8613a5cd791 100644 --- a/lychee.toml +++ b/lychee.toml @@ -18,5 +18,3 @@ exclude = [ '^https://github\.com/NVIDIA/cuda-python/issues/2345$', '^https://github\.com/NVIDIA/cuda-python/issues/3363$', ] - -# TEMP: forces a full CI run for #3661 validation; remove before merge.