RuntimeError: In getBar1SizeOfGpu when initializing torch RPC

username: UnbearableFate
cooked: <p>Hello everyone,</p>
<p>I’m encountering a runtime error while using PyTorch with the RPC backend on my system. The error message is as follows:<br>
Could anyone tell me why this problem has happened and have to solve it ? Thank you.</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "/work/personal_workspace/torchrpc_test.py", line 20, in &lt;module&gt;
    rpc.init_rpc(name= f"worker_{ompi_world_rank}", backend=BackendType.TENSORPIPE,
  File "/work/personal_workspace/venv/lib/python3.9/site-packages/torch/distributed/rpc/__init__.py", line 200, in init_rpc
    _init_rpc_backend(backend, store, name, rank, world_size, rpc_backend_options)
  File "/work/personal_workspace/venv/lib/python3.9/site-packages/torch/distributed/rpc/__init__.py", line 233, in _init_rpc_backend
    rpc_agent = backend_registry.init_backend(
  File "/work/personal_workspace/venv/lib/python3.9/site-packages/torch/distributed/rpc/backend_registry.py", line 104, in init_backend
    return backend.value.init_backend_handler(*args, **kwargs)
  File "/work/personal_workspace/venv/lib/python3.9/site-packages/torch/distributed/rpc/backend_registry.py", line 353, in _tensorpipe_init_backend_handler
    api._init_rpc_states(agent)
  File "/work/personal_workspace/venv/lib/python3.9/site-packages/torch/distributed/rpc/api.py", line 119, in _init_rpc_states
    _set_and_start_rpc_agent(agent)
RuntimeError: In getBar1SizeOfGpu at tensorpipe/channel/cuda_gdr/context_impl.cc:242 "": No such file or directory
--------------------------------------------------------------------------
</code></pre>
<p>my code is like this</p>
<pre><code class="lang-auto">import os
import torch
import torch.distributed.rpc as rpc
from torch.distributed.rpc import BackendType
ompi_world_size = int(os.getenv('OMPI_COMM_WORLD_SIZE', 0))
ompi_world_rank = int(os.getenv('OMPI_COMM_WORLD_RANK', 0))

def recv_tensor(tensors,from_rank):
    print(f"Received tensors: {tensors} from rank {from_rank}")

if __name__ == '__main__':
    print(f"world_size: {ompi_world_size}, world_rank: {ompi_world_rank}")

    options = rpc.TensorPipeRpcBackendOptions(
        num_worker_threads=16,
        #device_maps={f"worker_{i}": {0: 0} for i in range(ompi_world_size)},
        init_method=f"file:///work/personal_workspace/data/sharedfile_rpc",
        rpc_timeout=30,
    )
    rpc.init_rpc(name= f"worker_{ompi_world_rank}", backend=BackendType.TENSORPIPE,
                rank=ompi_world_rank, world_size= ompi_world_size,
                rpc_backend_options=options)
    if rpc.is_available():
        print(f"RPC is available from rank {ompi_world_rank}")
    
    tensor = torch.ones(ompi_world_rank)
    rpc.rpc_sync("worker_0", recv_tensor, args=(tensor,ompi_world_rank))

    rpc.shutdown()
</code></pre>
<p>I use mpirun to run the above code in my cluster.<br>
the enviroment is</p>
<pre><code class="lang-auto">Collecting environment information...
PyTorch version: 2.3.1+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.25.0
Libc version: glibc-2.35

Python version: 3.9.13 (main, Oct 19 2022, 17:23:07)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-100-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA H100 PCIe
Nvidia driver version: 550.90.07
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 57 bits virtual
Byte Order:                         Little Endian
CPU(s):                             48
On-line CPU(s) list:                0-47
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Xeon(R) Platinum 8468
CPU family:                         6
Model:                              143
Thread(s) per core:                 1
Core(s) per socket:                 48
Socket(s):                          1
Stepping:                           8
Frequency boost:                    enabled
CPU max MHz:                        2101.0000
CPU min MHz:                        800.0000
BogoMIPS:                           4200.00
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          2.3 MiB (48 instances)
L1i cache:                          1.5 MiB (48 instances)
L2 cache:                           96 MiB (48 instances)
L3 cache:                           105 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-47
Vulnerability Gather data sampling: 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 Retbleed:             Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] kfac_pytorch==0.4.1
[pip3] numpy==1.26.3
[pip3] torch==2.3.1
[pip3] torch-tb-profiler==0.4.3
[pip3] torchdata==0.7.1
[pip3] torchelastic==0.2.2
[pip3] torchinfo==1.5.2
[pip3] torchtext==0.18.0
[pip3] torchvision==0.18.1
[pip3] triton==2.3.1
[conda] mkl                       2022.2.1            intel_16993    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] mkl-dpcpp                 2022.2.1            intel_16993    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] mkl-service               2.4.0           py39h7634626_12    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] mkl_fft                   1.3.1           py39h1909d4f_16    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] mkl_random                1.2.2           py39h94ca54a_16    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] mkl_umath                 0.1.1           py39h0348192_26    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] numpy                     1.21.4          py39h8dc10e9_16    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] numpy-base                1.21.4          py39h97bc315_16    file:///system/apps/ubuntu/20.04-202210/oneapi/2022.3.1/conda_channel
[conda] torch                     2.0.0+cu118              pypi_0    pypi
[conda] torch-cluster             1.6.1+pt20cu118          pypi_0    pypi
[conda] torch-geometric           2.3.0                    pypi_0    pypi
[conda] torch-scatter             2.1.1+pt20cu118          pypi_0    pypi
[conda] torch-sparse              0.6.17+pt20cu118          pypi_0    pypi
[conda] torch-spline-conv         1.2.2+pt20cu118          pypi_0    pypi
[conda] torchaudio                2.0.1+cu118              pypi_0    pypi
[conda] torchvision               0.15.1+cu118             pypi_0    pypi
[conda] triton                    2.0.0                    pypi_0    pypi

</code></pre>

username: Aravinda_kumar
cooked: <p>I ran into a similar issue. Did you solve the problem?</p>

username: UnbearableFate
cooked: <p>Not yet, I also have asked this question at some other paltform.<br>
If there is any progress, I will update this post promptly.</p>

username: Aravinda_kumar
cooked: <p>Weird. I ran the same script in a different machine and it ran perfectly. I tried this with both machines having both different and similar conda environments. In both cases, running the script in the new machine worked while old machine failed.</p>

username: UnbearableFate
cooked: <p>Same to me, torch.RPC works well on another server with Nvidia Driver Version: 535.183.01   CUDA Version: 12.2, torch 2.2.2+cu121, but failed on the<br>
By the way, as expected, the above error will not occur when using the CPU-only version of torch. Until the problem is solved, maybe I will continue my work using the CPU-only version of torch.</p>