pytorch - ✅(Solved) Fix [distributed] ProcessGroupMPI: cudaAwareMpiCheck() does not support Cray MPICH GPU-aware MPI [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#178191Fetched 2026-04-08 01:21:14
View on GitHub
Comments
1
Participants
2
Timeline
34
Reactions
0
Participants
Timeline (top)
mentioned ×13subscribed ×13referenced ×4labeled ×2

Fix Action

Fix / Workaround

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 48 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-63 Vendor ID: AuthenticAMD Model name: AMD EPYC 7543P 32-Core Processor CPU family: 25 Model: 1 Thread(s) per core: 2 Core(s) per socket: 32 Socket(s): 1 Stepping: 1 BogoMIPS: 5589.99 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin brs arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm debug_swap verw_clear clear_cpu_buf_vm ibpb_exit_to_user Virtualization: AMD-V L1d cache: 1 MiB (32 instances) L1i cache: 1 MiB (32 instances) L2 cache: 16 MiB (32 instances) L3 cache: 256 MiB (8 instances) NUMA node(s): 4 NUMA node0 CPU(s): 0-7,32-39 NUMA node1 CPU(s): 8-15,40-47 NUMA node2 CPU(s): 16-23,48-55 NUMA node3 CPU(s): 24-31,56-63 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; Safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsa: Mitigation; Clear CPU buffers Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

PR fix notes

PR #178323: Add CUDA-aware detection for Cray MPICH

Description (problem / solution / changelog)

Fixes #178191

Summary: Currently, cudaAwareMpiCheck() only detects CUDA-aware MPI through Open MPI's MPIX_CUDA_AWARE_SUPPORT. This means Cray MPICH environments (common on HPE/Cray supercomputers like ALCF's Polaris) are not recognized as CUDA-aware, causing PyTorch to fall back to CPU transfers for MPI operations even when GPU-direct support is available. This PR adds a #elif branch that checks for MPIX_GPU_SUPPORT_CUDA (a Cray MPICH compile-time define) and the MPICH_GPU_SUPPORT_ENABLED environment variable at runtime, matching the existing pattern used for Open MPI detection.

Testing: Built and tested on ALCF Polaris (Cray MPICH, NVIDIA A100s). Before this fix, cudaAwareMpiCheck() returned false; after, it correctly returns true and GPU-direct MPI operations work as expected. The new code is in a #elif preprocessor branch, it only compiles when MPIX_GPU_SUPPORT_CUDA is defined and MPIX_CUDA_AWARE_SUPPORT is not. Existing Open MPI behavior is completely unchanged.

Changed files

  • torch/csrc/distributed/c10d/ProcessGroupMPI.cpp (modified, +9/-1)
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

cudaAwareMpiCheck() does not recognize Cray MPICH as CUDA-aware even when it is properly configured. The function only checks for MPIX_CUDA_AWARE_SUPPORT via MPIX_Query_cuda_support(), which is an OpenMPI-specific API. On Cray MPICH systems this symbol is not defined, so the function always falls through to return false in the #else branch, regardless of runtime configuration. Cray MPICH uses a different mechanism: MPIX_GPU_SUPPORT_CUDA is defined in mpi.h as a GPU type identifier, and GPU-aware communication is enabled at runtime via MPICH_GPU_SUPPORT_ENABLED=1. Neither of these is handled by the current code. This completely blocks the use of PyTorch DDP with the MPI backend on GPU systems running Cray MPICH, which is the standard MPI on many large HPC clusters including Polaris at ALCF (Argonne National Laboratory), where I encountered this issue in my research.

Versions

Collecting environment information... PyTorch version: 2.8.0 Is debug build: False CUDA used to build PyTorch: 12.9 ROCM used to build PyTorch: N/A

OS: SUSE Linux Enterprise Server 15 SP6 (x86_64) GCC version: (SUSE Linux) 14.3.0 Clang version: 7.0.1 (tags/RELEASE_701/final 349238) CMake version: version 4.1.2 Libc version: glibc-2.38

Python version: 3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 14:45:31) [GCC 13.3.0] (64-bit runtime) Python platform: Linux-6.4.0-150600.23.73-default-x86_64-with-glibc2.38 Is CUDA available: True CUDA runtime version: 12.9.86 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA A100-SXM4-40GB GPU 1: NVIDIA A100-SXM4-40GB GPU 2: NVIDIA A100-SXM4-40GB GPU 3: NVIDIA A100-SXM4-40GB

Nvidia driver version: 570.124.06 cuDNN version: Could not collect Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True Caching allocator config: N/A

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 48 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-63 Vendor ID: AuthenticAMD Model name: AMD EPYC 7543P 32-Core Processor CPU family: 25 Model: 1 Thread(s) per core: 2 Core(s) per socket: 32 Socket(s): 1 Stepping: 1 BogoMIPS: 5589.99 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin brs arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm debug_swap verw_clear clear_cpu_buf_vm ibpb_exit_to_user Virtualization: AMD-V L1d cache: 1 MiB (32 instances) L1i cache: 1 MiB (32 instances) L2 cache: 16 MiB (32 instances) L3 cache: 256 MiB (8 instances) NUMA node(s): 4 NUMA node0 CPU(s): 0-7,32-39 NUMA node1 CPU(s): 8-15,40-47 NUMA node2 CPU(s): 16-23,48-55 NUMA node3 CPU(s): 24-31,56-63 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; Safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsa: Mitigation; Clear CPU buffers Vulnerability Tsx async abort: Not affected Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Versions of relevant libraries: [pip3] gpytorch==1.14.2 [pip3] numpy==2.2.6 [pip3] numpyro==0.19.0 [pip3] nvidia-cudnn-frontend==1.15.0 [pip3] onnx==1.19.0 [pip3] onnx-ir==0.1.11 [pip3] onnx-tf==1.6.0 [pip3] onnxruntime-gpu==1.23.0 [pip3] onnxscript==0.3.1 [pip3] optree==0.17.0 [pip3] pytorch-lightning==2.5.5 [pip3] torch==2.8.0 [pip3] torch_cluster==1.6.3+pt28cu129 [pip3] torch-geometric==2.7.0 [pip3] torch_memory_saver==0.0.8 [pip3] torch_scatter==2.1.2+pt28cu129 [pip3] torch_sparse==0.6.18+pt28cu129 [pip3] torch_spline_conv==1.2.2+pt28cu129 [pip3] torch-tb-profiler==0.4.3 [pip3] torchao==0.9.0 [pip3] torchaudio==2.8.0 [pip3] torchdata==0.11.0 [pip3] torchinfo==1.8.0 [pip3] torchmetrics==1.8.2 [pip3] torchvision==0.23.0a0+824e8c8 [pip3] torchviz==0.0.3 [pip3] triton==3.5.0 [conda] gpytorch 1.14.2 pypi_0 pypi [conda] magma-cuda126 2.6.1 1 pytorch [conda] mkl 2024.2.2 ha770c72_17 conda-forge [conda] mkl-include 2025.2.0 hf2ce2f3_629 conda-forge [conda] numpy 2.2.6 pypi_0 pypi [conda] numpyro 0.19.0 pypi_0 pypi [conda] nvidia-cudnn-frontend 1.15.0 pypi_0 pypi [conda] optree 0.17.0 pypi_0 pypi [conda] pytorch-lightning 2.5.5 pypi_0 pypi [conda] tbb 2021.13.0 hb60516a_3 conda-forge [conda] torch 2.8.0 pypi_0 pypi [conda] torch-cluster 1.6.3+pt28cu129 pypi_0 pypi [conda] torch-geometric 2.7.0 pypi_0 pypi [conda] torch-memory-saver 0.0.8 pypi_0 pypi [conda] torch-scatter 2.1.2+pt28cu129 pypi_0 pypi [conda] torch-sparse 0.6.18+pt28cu129 pypi_0 pypi [conda] torch-spline-conv 1.2.2+pt28cu129 pypi_0 pypi [conda] torch-tb-profiler 0.4.3 pypi_0 pypi [conda] torchao 0.9.0 pypi_0 pypi [conda] torchaudio 2.8.0 pypi_0 pypi [conda] torchdata 0.11.0 pypi_0 pypi [conda] torchinfo 1.8.0 pypi_0 pypi [conda] torchmetrics 1.8.2 pypi_0 pypi [conda] torchvision 0.23.0a0+824e8c8 pypi_0 pypi [conda] torchviz 0.0.3 pypi_0 pypi [conda] triton 3.5.0 pypi_0 pypi

cc @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @pragupta @msaroufim @dcci @aditvenk @xmfan

extent analysis

Fix Plan

To fix the issue, we need to modify the cudaAwareMpiCheck() function to handle Cray MPICH. We can do this by checking for the MPIX_GPU_SUPPORT_CUDA symbol and the MPICH_GPU_SUPPORT_ENABLED environment variable.

Step 1: Modify the cudaAwareMpiCheck() function

import os
import ctypes

def cudaAwareMpiCheck():
    # Check for OpenMPI
    if hasattr(ctypes.CDLL(None), 'MPIX_Query_cuda_support'):
        # ... existing OpenMPI check code ...
    # Check for Cray MPICH
    elif 'MPICH_GPU_SUPPORT_ENABLED' in os.environ and os.environ['MPICH_GPU_SUPPORT_ENABLED'] == '1':
        return True
    # ... existing fallback code ...

Step 2: Set the MPICH_GPU_SUPPORT_ENABLED environment variable

Before running your PyTorch DDP application, set the MPICH_GPU_SUPPORT_ENABLED environment variable to 1:

export MPICH_GPU_SUPPORT_ENABLED=1

Verification

To verify that the fix worked, run your PyTorch DDP application with the modified cudaAwareMpiCheck() function and the MPICH_GPU_SUPPORT_ENABLED environment variable set. If the application runs successfully with GPU acceleration, the fix is working.

Extra Tips

  • Make sure to set the MPICH_GPU_SUPPORT_ENABLED environment variable before running your application.
  • If you are using a batch script or a job scheduler, ensure that the environment variable is set in the script or job configuration.
  • You can also consider adding a check for the MPIX_GPU_SUPPORT_CUDA symbol in the cudaAwareMpiCheck() function to handle other MPI implementations that may use this symbol.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING