TOPO: resolve NVML fabric symbols lazily#1305
Conversation
|
@Sergei-Lebedev @ikryukov codex solution - I check it with the above tests, before/after PR, if you get a chance and have pointers how to guide it for a better fix if needed - let me know |
|
/build |
|
/build |
642553f to
2189389
Compare
|
/build |
2189389 to
83a5f6a
Compare
|
/build |
Signed-off-by: Tomislav Janjusic <tomislavj@nvidia.com>
Signed-off-by: Tomislav Janjusic <tomislavj@nvidia.com>
3bff122 to
11a6cc0
Compare
Align the static resolver declarations per .clang-format and move all locals in ucc_sysinfo_cuda_update_fabric_info to the top of the function (UCC C89 style). The versioned fabric struct is renamed to fabric_info_v to avoid a same-name/different-type collision now that both branch locals share function scope. No functional change. Signed-off-by: Tomislav Janjusic <tomislavj@nvidia.com>
11a6cc0 to
ef1dd2d
Compare
|
/build |
Address review from Sergei-Lebedev: - Resolve fabric symbols via dlsym(RTLD_DEFAULT): libnvidia-ml is already mapped (component links it and calls nvmlInit_v2), so the dedicated dlopen handle is unnecessary. Drops ucc_sysinfo_cuda_nvml_get_handle. - Replace the two identical per-symbol loader wrappers with a single UCC_NVML_SYMBOL_LOADER macro. - Restrict the legacy fabric-info API to when the versioned symbol is absent: if the versioned API is present it is authoritative, so a runtime error from it no longer falls back to the legacy call. No functional change on drivers that expose the versioned API. Signed-off-by: Tomislav Janjusic <tomislavj@nvidia.com>
|
/build |
|
@Sergei-Lebedev done - and I verified that this fix actually works. addressed all three in the latest commit: RTLD_DEFAULT: dropped the dlopen/handle helper; libnvidia-ml is already loaded (we link it + call nvmlInit_v2), so we just dlsym(RTLD_DEFAULT, ...). How I tested No hard dependency — confirms the symbol is resolved by name, not linked: $ nm -D --undefined-only libucc_sysinfo_cuda.so | grep -i GpuFabricInfo NVML symbol nvmlDeviceGetGpuFabricInfoV is unavailable ... |
What
This PR avoids a hard runtime dependency on newer NVML fabric-info symbols in the CUDA sysinfo component.
Specifically,
nvmlDeviceGetGpuFabricInfoVand the legacynvmlDeviceGetGpuFabricInfopath are now resolved lazily withdlsym()before use.Why ?
HPC SDK users can build UCC/HPC-X with newer CUDA/NVML headers but run on systems with older NVIDIA drivers. In that case,
libucc_sysinfo_cuda.socould fail to load with:undefined symbol: nvmlDeviceGetGpuFabricInfoVThat symbol is only available in newer
libnvidia-ml.so.1versions, so directly referencing it raises the effective runtime driver requirement even when fabric metadata is optional.How ?
The CUDA sysinfo fabric query now uses a small runtime resolver for optional NVML fabric APIs. If the versioned fabric-info symbol is available, UCC uses it and preserves partition ID support. If it is unavailable, UCC falls back to the legacy fabric-info API when present. If neither symbol exists, fabric metadata remains unset and UCC continues without failing library load.
Testing
Tested before/after with CUDA 12.9.1 and NVML 555 at build time, then switched runtime NVML to R525.60.13.
Before this PR:
config.hdefinedHAVE_NVML_GPU_FABRIC_INFO_V.readelf -Ws libucc_sysinfo_cuda.so | grep nvmlDeviceGetGpuFabricInfoshowed an undefined relocation fornvmlDeviceGetGpuFabricInfoV.ldd -r libucc_sysinfo_cuda.sofailed with:undefined symbol: nvmlDeviceGetGpuFabricInfoVAfter this PR:
readelfandnm -Dshow no dynamic dependency onnvmlDeviceGetGpuFabricInfo*.ldd -r libucc_sysinfo_cuda.soreports no undefined fabric-info symbols.