No GPUs found in a machine definitely with GPUs

the error is below:

stderr: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/test_utils/scripts/test_scrip โ”‚
stderr: โ”‚ t.py:336 in <module>                                                                             โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   333                                                                                            โ”‚
stderr: โ”‚   334                                                                                            โ”‚
stderr: โ”‚   335 if __name__ == "__main__":                                                                 โ”‚
stderr: โ”‚ โฑ 336 โ”‚   main()                                                                                 โ”‚
stderr: โ”‚   337                                                                                            โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/test_utils/scripts/test_scrip โ”‚
stderr: โ”‚ t.py:305 in main                                                                                 โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   302                                                                                            โ”‚
stderr: โ”‚   303                                                                                            โ”‚
stderr: โ”‚   304 def main():                                                                                โ”‚
stderr: โ”‚ โฑ 305 โ”‚   accelerator = Accelerator()                                                            โ”‚
stderr: โ”‚   306 โ”‚   state = accelerator.state                                                              โ”‚
stderr: โ”‚   307 โ”‚   if state.local_process_index == 0:                                                     โ”‚
stderr: โ”‚   308 โ”‚   โ”‚   print("**Initialization**")                                                        โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/accelerator.py:323 in         โ”‚
stderr: โ”‚ __init__                                                                                         โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    320 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.init_handler = handler                                       โ”‚
stderr: โ”‚    321 โ”‚   โ”‚                                                                                     โ”‚
stderr: โ”‚    322 โ”‚   โ”‚   kwargs = self.init_handler.to_kwargs() if self.init_handler is not None else {}   โ”‚
stderr: โ”‚ โฑ  323 โ”‚   โ”‚   self.state = AcceleratorState(                                                    โ”‚
stderr: โ”‚    324 โ”‚   โ”‚   โ”‚   mixed_precision=mixed_precision,                                              โ”‚
stderr: โ”‚    325 โ”‚   โ”‚   โ”‚   cpu=cpu,                                                                      โ”‚
stderr: โ”‚    326 โ”‚   โ”‚   โ”‚   dynamo_backend=dynamo_backend,                                                โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/state.py:162 in __init__      โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   159 โ”‚   โ”‚   โ”‚   elif int(os.environ.get("LOCAL_RANK", -1)) != -1 and not cpu:                  โ”‚
stderr: โ”‚   160 โ”‚   โ”‚   โ”‚   โ”‚   self.distributed_type = DistributedType.MULTI_GPU                          โ”‚
stderr: โ”‚   161 โ”‚   โ”‚   โ”‚   โ”‚   if not torch.distributed.is_initialized():                                 โ”‚
stderr: โ”‚ โฑ 162 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   torch.distributed.init_process_group(backend="nccl", **kwargs)         โ”‚
stderr: โ”‚   163 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.backend = "nccl"                                                  โ”‚
stderr: โ”‚   164 โ”‚   โ”‚   โ”‚   โ”‚   self.num_processes = torch.distributed.get_world_size()                    โ”‚
stderr: โ”‚   165 โ”‚   โ”‚   โ”‚   โ”‚   self.process_index = torch.distributed.get_rank()                          โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py:76 โ”‚
stderr: โ”‚ 1 in init_process_group                                                                          โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    758 โ”‚   โ”‚   โ”‚   # different systems (e.g. RPC) in case the store is multi-tenant.             โ”‚
stderr: โ”‚    759 โ”‚   โ”‚   โ”‚   store = PrefixStore("default_pg", store)                                      โ”‚
stderr: โ”‚    760 โ”‚   โ”‚                                                                                     โ”‚
stderr: โ”‚ โฑ  761 โ”‚   โ”‚   default_pg = _new_process_group_helper(                                           โ”‚
stderr: โ”‚    762 โ”‚   โ”‚   โ”‚   world_size,                                                                   โ”‚
stderr: โ”‚    763 โ”‚   โ”‚   โ”‚   rank,                                                                         โ”‚
stderr: โ”‚    764 โ”‚   โ”‚   โ”‚   [],                                                                           โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py:89 โ”‚
stderr: โ”‚ 7 in _new_process_group_helper                                                                   โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    894 โ”‚   โ”‚   โ”‚   โ”‚   pg_options.is_high_priority_stream = False                                โ”‚
stderr: โ”‚    895 โ”‚   โ”‚   โ”‚   โ”‚   pg_options._timeout = timeout                                             โ”‚
stderr: โ”‚    896 โ”‚   โ”‚   โ”‚                                                                                 โ”‚
stderr: โ”‚ โฑ  897 โ”‚   โ”‚   โ”‚   pg = ProcessGroupNCCL(prefix_store, group_rank, group_size, pg_options)       โ”‚
stderr: โ”‚    898 โ”‚   โ”‚   โ”‚   # In debug mode and if GLOO is available, wrap in a wrapper PG that           โ”‚
stderr: โ”‚    899 โ”‚   โ”‚   โ”‚   # enables enhanced collective checking for debugability.                      โ”‚
stderr: โ”‚    900 โ”‚   โ”‚   โ”‚   if get_debug_level() == DebugLevel.DETAIL:                                    โ”‚
stderr: โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
stderr: RuntimeError: ProcessGroupNCCL is only supported with GPUs, no GPUs found!
stderr: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/test_utils/scripts/test_scrip โ”‚
stderr: โ”‚ t.py:336 in <module>                                                                             โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   333                                                                                            โ”‚
stderr: โ”‚   334                                                                                            โ”‚
stderr: โ”‚   335 if __name__ == "__main__":                                                                 โ”‚
stderr: โ”‚ โฑ 336 โ”‚   main()                                                                                 โ”‚
stderr: โ”‚   337                                                                                            โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/test_utils/scripts/test_scrip โ”‚
stderr: โ”‚ t.py:305 in main                                                                                 โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   302                                                                                            โ”‚
stderr: โ”‚   303                                                                                            โ”‚
stderr: โ”‚   304 def main():                                                                                โ”‚
stderr: โ”‚ โฑ 305 โ”‚   accelerator = Accelerator()                                                            โ”‚
stderr: โ”‚   306 โ”‚   state = accelerator.state                                                              โ”‚
stderr: โ”‚   307 โ”‚   if state.local_process_index == 0:                                                     โ”‚
stderr: โ”‚   308 โ”‚   โ”‚   print("**Initialization**")                                                        โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/accelerator.py:323 in         โ”‚
stderr: โ”‚ __init__                                                                                         โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    320 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.init_handler = handler                                       โ”‚
stderr: โ”‚    321 โ”‚   โ”‚                                                                                     โ”‚
stderr: โ”‚    322 โ”‚   โ”‚   kwargs = self.init_handler.to_kwargs() if self.init_handler is not None else {}   โ”‚
stderr: โ”‚ โฑ  323 โ”‚   โ”‚   self.state = AcceleratorState(                                                    โ”‚
stderr: โ”‚    324 โ”‚   โ”‚   โ”‚   mixed_precision=mixed_precision,                                              โ”‚
stderr: โ”‚    325 โ”‚   โ”‚   โ”‚   cpu=cpu,                                                                      โ”‚
stderr: โ”‚    326 โ”‚   โ”‚   โ”‚   dynamo_backend=dynamo_backend,                                                โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/accelerate/state.py:162 in __init__      โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚   159 โ”‚   โ”‚   โ”‚   elif int(os.environ.get("LOCAL_RANK", -1)) != -1 and not cpu:                  โ”‚
stderr: โ”‚   160 โ”‚   โ”‚   โ”‚   โ”‚   self.distributed_type = DistributedType.MULTI_GPU                          โ”‚
stderr: โ”‚   161 โ”‚   โ”‚   โ”‚   โ”‚   if not torch.distributed.is_initialized():                                 โ”‚
stderr: โ”‚ โฑ 162 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   torch.distributed.init_process_group(backend="nccl", **kwargs)         โ”‚
stderr: โ”‚   163 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.backend = "nccl"                                                  โ”‚
stderr: โ”‚   164 โ”‚   โ”‚   โ”‚   โ”‚   self.num_processes = torch.distributed.get_world_size()                    โ”‚
stderr: โ”‚   165 โ”‚   โ”‚   โ”‚   โ”‚   self.process_index = torch.distributed.get_rank()                          โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py:76 โ”‚
stderr: โ”‚ 1 in init_process_group                                                                          โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    758 โ”‚   โ”‚   โ”‚   # different systems (e.g. RPC) in case the store is multi-tenant.             โ”‚
stderr: โ”‚    759 โ”‚   โ”‚   โ”‚   store = PrefixStore("default_pg", store)                                      โ”‚
stderr: โ”‚    760 โ”‚   โ”‚                                                                                     โ”‚
stderr: โ”‚ โฑ  761 โ”‚   โ”‚   default_pg = _new_process_group_helper(                                           โ”‚
stderr: โ”‚    762 โ”‚   โ”‚   โ”‚   world_size,                                                                   โ”‚
stderr: โ”‚    763 โ”‚   โ”‚   โ”‚   rank,                                                                         โ”‚
stderr: โ”‚    764 โ”‚   โ”‚   โ”‚   [],                                                                           โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚ /home/chenzhixuan/anaconda3/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py:89 โ”‚
stderr: โ”‚ 7 in _new_process_group_helper                                                                   โ”‚
stderr: โ”‚                                                                                                  โ”‚
stderr: โ”‚    894 โ”‚   โ”‚   โ”‚   โ”‚   pg_options.is_high_priority_stream = False                                โ”‚
stderr: โ”‚    895 โ”‚   โ”‚   โ”‚   โ”‚   pg_options._timeout = timeout                                             โ”‚
stderr: โ”‚    896 โ”‚   โ”‚   โ”‚                                                                                 โ”‚
stderr: โ”‚ โฑ  897 โ”‚   โ”‚   โ”‚   pg = ProcessGroupNCCL(prefix_store, group_rank, group_size, pg_options)       โ”‚
stderr: โ”‚    898 โ”‚   โ”‚   โ”‚   # In debug mode and if GLOO is available, wrap in a wrapper PG that           โ”‚
stderr: โ”‚    899 โ”‚   โ”‚   โ”‚   # enables enhanced collective checking for debugability.                      โ”‚
stderr: โ”‚    900 โ”‚   โ”‚   โ”‚   if get_debug_level() == DebugLevel.DETAIL:                                    โ”‚
stderr: โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
stderr: RuntimeError: ProcessGroupNCCL is only supported with GPUs, no GPUs found!

but my config is multi-GPU distributed mode:

- `Accelerate` version: 0.16.0
- Platform: Linux-5.15.0-58-generic-x86_64-with-glibc2.31
- Python version: 3.9.13
- Numpy version: 1.21.5
- PyTorch version (GPU?): 1.13.0+cu116 (True)
- `Accelerate` default config:
        - compute_environment: LOCAL_MACHINE
        - distributed_type: MULTI_GPU
        - mixed_precision: fp16
        - use_cpu: False
        - dynamo_backend: NO
        - num_processes: 2
        - machine_rank: 0
        - num_machines: 1
        - gpu_ids: [0,1]
        - rdzv_backend: static
        - same_network: True
        - main_training_function: main
        - deepspeed_config: {}
        - fsdp_config: {}
        - megatron_lm_config: {}
        - downcast_bf16: no

Iโ€™m having the same problem. I use the following test-script:

from accelerate import Accelerator
import torch


if __name__ == "__main__":
    print("Cuda support:", torch.cuda.is_available(),":", torch.cuda.device_count(), "devices")
    accelerator = Accelerator()
    print(accelerator.state)

Started without accelerate, the output is

Cuda support: True : 8 devices
Distributed environment: NO
Num processes: 1
Process index: 0
Local process index: 0
Device: cuda
Mixed precision type: no

Started with accelerate launch test.py, torch.cuda.is_available() returns false:

Cuda support: False : 0 devices
Distributed environment: NO
Num processes: 1
Process index: 0
Local process index: 0
Device: cpu
Mixed precision type: no

The reason seems to be that after creating a subprocess (e.g. in line 397 of accelerate/commands/launch.py), calling torch.cuda.is_available() from the subprocess is not working. Am I missing something?

I havenโ€™t figure it out :joy:

What is accelerate envโ€™s output currently?

- `Accelerate` version: 0.17.1
- Platform: Linux-5.4.0-65-generic-x86_64-with-glibc2.31
- Python version: 3.9.16
- Numpy version: 1.23.5
- PyTorch version (GPU?): 1.12.1 (True)
- `Accelerate` default config:
        - compute_environment: LOCAL_MACHINE
        - distributed_type: NO
        - mixed_precision: no
        - use_cpu: False
        - num_processes: 1
        - machine_rank: 0
        - num_machines: 1
        - gpu_ids: [3,4,5]
        - rdzv_backend: static
        - same_network: True
        - main_training_function: main
        - deepspeed_config: {}
        - fsdp_config: {}
        - megatron_lm_config: {}
        - downcast_bf16: no
        - tpu_use_cluster: False
        - tpu_use_sudo: False
        - dynamo_config: {}

Sorry, I updated accelerate in the meantime. It is line 574 now in launch.py

Hi, do you have any suggestion? Any help would be appreciated

Can you open an issue on our github for this and I can take a look? Please ensure to follow all the bits we ask for on there :slight_smile: Sign in to GitHub ยท GitHub

I did my best: :slight_smile: https://github.com/huggingface/accelerate/issues/1260

Apparently if thereโ€™s a mismatch in the cuda version, accelerate env will output False for a setup with gpu, so just a head up for everyone

1 Like