Skip to content

UCP/WIREUP: consider NUMA locality for cpuset during device scoring - #11459

Merged
roiedanino merged 8 commits into
openucx:masterfrom
roiedanino:cx9-numa
Jun 3, 2026
Merged

roiedanino merged 8 commits into
openucx:masterfrom
roiedanino:cx9-numa

Conversation

@roiedanino

@roiedanino roiedanino commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

What?

Use the UCP worker CPU mask when calculating topology memory distance for host-memory-capable devices.

Why?

When several equivalent network devices are available, UCX scoring may otherwise use a memory-distance value based on the current thread affinity instead of the worker locality. This can lead wireup to select a less NUMA-local device for the worker, especially on multi-NIC / multi-NUMA systems.

How?

Add ucs_topo_get_memory_distance_for_cpuset() and implement it in the sysfs topology provider. When a worker has a non-empty CPU mask, ucp_worker_iface_get_memory_distance() calculates device memory distance against that CPU set. If the worker CPU mask is empty, UCX keeps the previous behavior and falls back to ucs_topo_get_memory_distance().

The PR also extends the mock UCP proto tests with fake sys devices/NUMA nodes and verifies that worker CPU mask locality affects the selected RC device.

@roiedanino roiedanino self-assigned this May 14, 2026
@roiedanino
roiedanino marked this pull request as draft May 14, 2026 14:46
@roiedanino roiedanino added the WIP-DNM Work in progress / Do not review label May 14, 2026
Signed-off-by: Roie Danino <rdanino@nvidia.com>
Signed-off-by: Roie Danino <rdanino@nvidia.com>
@roiedanino
roiedanino marked this pull request as ready for review May 17, 2026 14:15
@roiedanino roiedanino removed the WIP-DNM Work in progress / Do not review label May 17, 2026
Signed-off-by: Roie Danino <rdanino@nvidia.com>

@william-gallagher-nv william-gallagher-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked through changes with @roiedanino. One small suggestion.

Comment thread src/ucp/wireup/select.c Resolved
Comment thread test/gtest/ucp/test_ucp_proto_mock.cc Resolved
@roiedanino
roiedanino requested a review from shasson5 May 27, 2026 12:17
Comment thread src/ucp/wireup/select.c Resolved
Comment thread src/ucp/wireup/select.c Resolved
@roiedanino

Copy link
Copy Markdown
Contributor Author

@svc-nvidia-pr-review

@svc-nvidia-pr-review

Copy link
Copy Markdown

🚫 @roiedanino — not authorized to trigger a review on this repo. Contact a repo admin to be added to the allowed-users list.

@roiedanino

Copy link
Copy Markdown
Contributor Author

@svc-nvidia-pr-review

@svc-nvidia-pr-review

Copy link
Copy Markdown

🚫 @roiedanino — not authorized to trigger a review on this repo. Contact a repo admin to be added to the allowed-users list.

gleon99
gleon99 previously approved these changes May 31, 2026
@yosefe

yosefe commented Jun 1, 2026

Copy link
Copy Markdown
Member

@roiedanino i which cases the score function is exactly the same?
won't it be easier to update to score function?

@roiedanino

Copy link
Copy Markdown
Contributor Author

@yosefe, when we have 2 devices or more of the same generation

…the scoring function instead of tie-breaking

Signed-off-by: Roie Danino <rdanino@nvidia.com>
@gleon99

gleon99 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@roiedanino plz fix PR description (UCX_WIREUP_PREFER_LOCAL_DEVICE), then merge

@roiedanino roiedanino changed the title UCP/WIREUP: consider NUMA locality during device selection UCP/WIREUP: consider NUMA locality for cpuset during device scoring Jun 3, 2026
@roiedanino
roiedanino enabled auto-merge (squash) June 3, 2026 06:14
@roiedanino
roiedanino merged commit 50262d1 into openucx:master Jun 3, 2026
160 checks passed
@roiedanino
roiedanino deleted the cx9-numa branch June 3, 2026 06:25
Comment thread src/ucp/wireup/select.c
Comment on lines -628 to -631
ucs_trace(UCT_TL_RESOURCE_DESC_FMT
"->addr[%u] : %s score %.2f priority %d",
UCT_TL_RESOURCE_DESC_ARG(resource),
addr_index, criteria->title, score, priority);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed the trace print?

Comment thread src/ucp/core/ucp_worker.c
ucs_topo_get_memory_distance(sys_dev, distance);
} else {
ucs_topo_get_memory_distance_for_cpuset(
sys_dev, &wiface->worker->cpu_mask, distance);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case we get cpu_mask from user application?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'm reverting this PR:

#11516

This fix has 0 effect, the actual issue comes from HPCX packaging:
UCX_MODULE_DIR is not exported properly, causing a massive degradation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants