Using the Jupyter image¶
For convenience, Leafcloud offers a pre-built image with Nvidia CUDA and CuDNN, TensorFlow and PyTorch and Jupyter Notebook pre-installed.
Launching the instance¶
To start an instance using this image, go to the instance view of the dashboard.
- Press Launch instance
- in the Source tab select "Image" and the boot source
- select the
ubuntu-pytorch-tensorflow-jupyterimage - set the volume size to 40GB
- as the flavor select any gpu flavor, starting with
eg1. - Select a network, to give the instance a public IP address use the
externalnetwork - Select a key pair, this should will be used to
SSHinto the machine - Select a security group that exposes the
8888port - Press "Launch Instance"
Open Jupyter Notebook¶
In the instances view, copy the IP address of your new instance.
Obtaining the Jupyter Notebook token¶
From a terminal SSH into the instance:
Near the bottom of the output of the above command will be a line simila to:
Copy this url and open it in a web browser.This is your Jupyter Notebook server!
Validating the installation¶
To validate that the machine is using a GPU you can create a new notebook and run the following
For TensorFlow¶
import tensorflow as tf
if tf.test.gpu_device_name():
print('Default GPU Device:{}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")
This should output something like:
For PyTorch¶
import torch
torch.cuda.is_available()
torch.cuda.device_count()
torch.cuda.current_device()
torch.cuda.device(0)
torch.cuda.get_device_name(0)
This should output something like: