Mac M1 gpu not detected

I have a gpu on my pc, but it does not show up when I use,

import torch
print([torch.cuda.device(i) for i in range(torch.cuda.device_count())])

is there a further setting required to use the gpu
these are some further details regarding the gpu on my pc

Chipset Model:	Apple M1
  Type:	GPU
  Bus:	Built-In
  Total Number of Cores:	8
1 Like

The GPU on Mac is not Nvidia’s kind. It is M1 GPU designed by Apple.
You need to first set the device to mps.

See this for more details on installation and usage:
Running PyTorch on the M1 GPUtype or paste code here

2 Likes

thanks for the info, it now detects the gpu,

conda install pytorch -c pytorch-nightly
import torch
if torch.backends.mps.is_available():
    mps_device = torch.device("mps")
    x = torch.ones(1, device=mps_device)
    print(x)
else:
    print ("MPS device not found.")

which outputs,

UserWarning: The operator 'aten::nonzero' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. 
tensor([1.], device='mps:0')
1 Like

This is a UserWarning. You can ignore it for not. Most likely, some bug in the current nightly version. Don’t worry about it.

I have the same issue with current stable version. Moreover, it seems that all computations are going to be on CPU.

1 Like