As we work on setting up our environments, I found this quite useful:
To check that torch is using a GPU:
In [1]: import torch
In [2]: torch.cuda.current_device()
Out[2]: 0
In [3]: torch.cuda.device(0)
Out[3]: <torch.cuda.device at 0x7f2132913c50>
In [4]: torch.cuda.device_count()
Out[4]: 1
In [5]: torch.cuda.get_device_name(0)
Out[5]: 'Tesla K80'
To check that keras is using a GPU:
import tensorflow as tf
tf.Session(config=tf.ConfigProto(log_device_placement=True))
and check the jupyter logs for device info.
One could argue that ‘seeing’ a GPU is not really telling us that it is being used in training, but I think that here this is equivalent. Once a library sees the GPU, we are all set.
That is an interesting question and would be interesting to research. I do not have an answer myself.
I use nvidia-smi -l to see what my GPU is up to but this only gives you basic information. I think that newer versions of keras started preallocating all the GPU memory, so it doesn’t tell you much, but with torch you can see how much GPU memory is utilized by your process, that can be quite handy.
There are also more considerations that go into the batch size, so making it a heuristic to always stick as many training examples into a batch might not be ideal. Still, I think for this purpose - to have a cursory glance at model size in GPU given batch size and other parameters - nvida-smi seems to work quite nicely for torch at least based on my 2 hrs or so of experience with torch thus far
Yes that was a refreshing change with PyTorch. Keras (and I think it is tinkering down from Tensorflow backend) would grab the entire GPU memory by default and you would not know what is the actual usage.
Also, Tensorflow’s default setting is allocating full GPU memory during the run. Hence, with Keras and TF as backend, you’re most likely to see ~100% memory being allocated. This default behavior can be changed by @jeremy’s tip here (Tip: Clear tensorflow GPU memory).
PyTorch is nicer on this aspect. Allocating just enough memory as it needs.
Can someone let me know their modules and driver versions…
I have downloaded them thrice but they are always incompatible as reported by the installer.(cuda)
Choose your OS, Architecture (x86_64 mostly) and you will get the file to download.
For Pytorch installation go to pytorch.org Most likely you might want the Cuda 8.0
Finally for fast.ai, you will git clone https://github.com/fastai/fastai.git. But since it will be updated with new material before each class, you will need to do a git pull each time.
These are very general pointers. Hope they are useful.