IPython notebooks require the following sort of magic command to display graphics via matplotlib. One usually puts this at the top of one's worksheet. You can omit this (or simply skip running this cell during a runtime session) if you don't need graphics.
%matplotlib inline
The code Simmons is going to run below uses DUlib. This installs the latest version released on Github. Alternatively, you might want just pip install DUlib
.
!pip install git+https://github.com/sj-simmons/DUlib.git@v0.9
We only use the pycuda package to see exactly which flavor of gpu we are using. It is likely a Tesla T4 with 16GB of VRAM, so feel free to skip running this cell.
!pip install pycuda
The next code block requires pycuda.
from du.utils import print_devices
print_devices()
Next, we upload a file that holds the code we want to run. (This requires that you allow third party cookies.)
from google.colab import files
uploaded = files.upload()
Check if mnist got uploaded:
%ls
Run the program. This trains and tests a convolutional model on MNIST data.
%run mnist -graph 1 -verb 3
We see above that, with the overhead of evaluating on test data and graphing, training took just over 3 minutes. For comparison, let us train with no graphing (which leads to any test data being ignored during training).
%run mnist