verify_cuda_pytorch.py 541 B

123456789101112
  1. import torch
  2. if torch.cuda.is_available():
  3. print("CUDA is available")
  4. print("CUDA version: {}".format(torch.version.cuda))
  5. print("PyTorch version: {}".format(torch.__version__))
  6. print("cuDNN version: {}".format(torch.backends.cudnn.version()))
  7. print("Number of CUDA devices: {}".format(torch.cuda.device_count()))
  8. print("Current CUDA device: {}".format(torch.cuda.current_device()))
  9. print("Device name: {}".format(torch.cuda.get_device_name(torch.cuda.current_device())))
  10. else:
  11. print("CUDA is not available")