Repository navigation
Conversation
`_ibv_get_device_list()` called `ctypes.CDLL("libibverbs.so.1")` unguarded, so on
a host without rdma-core the loader error escaped from the helper and reached the
caller of `DeviceManager.rdma_device()` as
OSError: libibverbs.so.1: cannot open shared object file
instead of the `RuntimeError("no rdma devices found")` that `_get_my_rdma_device()`
already raises for exactly this case.
Treat a missing library as "no devices to enumerate" so that message is the one
the user sees. Also enumerate the HCA list once: when `NCCL_IB_HCA` parses to
nothing the `or` fallback called `_ibv_get_device_list()` a second time.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
_ibv_get_device_list()callsctypes.CDLL("libibverbs.so.1")unguarded (checkpoint_engine/device_utils.py:51). On any host withoutrdma-coreinstalled — a slim container, a CI image, any machine with no RDMA NIC — the loader error escapes from this helper and reaches the caller instead of the error the code already raises for this case:Measured on a Linux host without
rdma-core:So the user sees the dynamic loader's message, while
_get_my_rdma_device()already has the actionable one ready at:89-90:That line is unreachable on such a host, because the exception is raised two frames earlier. A missing library is not an unexpected condition here — it means exactly what
devices == []means: there are no RDMA devices to enumerate.The change
Two hunks in
checkpoint_engine/device_utils.py, plus three tests:_ibv_get_device_list()treats a missinglibibverbsas an empty device list, so_get_my_rdma_device()reportsno rdma devices found._get_rdma_devices()enumerates the HCA list once. WhenNCCL_IB_HCAparses to nothing, theorfallback called_ibv_get_device_list()a second time — a secondCDLLand a second full enumeration for the same answer.No behaviour change on a host where the library is present:
_ibv_get_device_list()returns the same list as before.Verification
Both new tests are written to fail against the unpatched source, so they detect the change rather than passing vacuously. Reverting only
device_utils.pyand keeping the tests:and the third failure is the second hunk directly:
The repository's own CPU gate is unchanged:
The two failures are pre-existing and unrelated to this change — they are Windows-only host artefacts I hit while working here (
tests/test_store_barrier.py:34relies on a libuv-enabled PyTorch, which the Windows wheel is not;tests/test_xpu_parity.py:84asserts:as the path separator where Windows joins with;). Both are inert onubuntu-latest, and the passed count moved from 105 to 108 with these three tests added.ruff checkandruff format --checkare clean acrosscheckpoint_engine/andtests/with the repository's own configuration.What I could not verify
I have no RDMA hardware, no CUDA device, and no multi-node setup, so I did not exercise
P2PStoreor the P2P update path end to end — only the device-enumeration helper and its two callers, which is where the change is. The_ibv_get_device_list()path with the library present is covered by the existingtest_detect_ibv_list, which skips without/sys/class/infiniband.