Testing GPU Setup

This topic includes some code samples common deep learning libraries to help test whether the new workspace is able to leverage GPUs as expected.

Pytorch

!pip3 install torch
from torch import cuda
assert cuda.is_available()
assert cuda.device_count() > 0
print(cuda.get_device_name(cuda.current_device()))

Tensorflow

!pip3 install tensorflow-gpu==1.13.1
from tensorflow.python.client import device_lib
assert 'GPU' in str(device_lib.list_local_devices())
device_lib.list_local_devices()

Keras

!pip3 install keras
from keras import backend
assert len(backend.tensorflow_backend._get_available_gpus()) > 0
print(backend.tensorflow_backend._get_available_gpus())