Platform: Google Cloud Platform (GCP)

This how-to post was also posted in the Fastai2 and new course thread, but it seemed more appropriate here in the GCP Platform thread.

Please note that fastai 2 requires torch-1.6.0 and torchvision-0.7.0. The cuda drivers on the platform image are 10.1 and too old for torch-1.6.0. There are no pytorch images in the deeplearning-platform-release family with 10.2 or 11 cuda drivers. However the 10.2 drivers can be updated per @micstan

Here are the steps I followed to setup the GCP image with the new release and the book:

Follow the old GCP setup guide here: http://course19.fast.ai/start_gcp.html

Open a terminal. I use Putty

Login to terminal: gcloud compute ssh --zone “us-central1-b” “jupyter@fastai-4” – -L 8080:localhost:8080

Install 10.2 cuda

wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run

Install fastai 2, fastcore and fastbook

cd tutorials
mv fastai fastai.old
git clone --recurse-submodules https://github.com/fastai/fastai
pip install -e “fastai[dev]”
git clone --recurse-submodules https://github.com/fastai/fastcore
cd fastcore
pip install -e “.[dev]”
cd …
git clone https://github.com/fastai/fastbook.git
cd fastbook
pip install -r requirements.txt
cd …

Check to see if pytorch and cuda are happy

python -c ‘import torch; print(torch.__version__); print(torch.version.cuda); print(torch.cuda.is_available()); print(torch.cuda.current_device())’

Test a few notebooks in the course and the fastbook folders

Launch local browser: http://localhost:8080/tree/tutorials

Verify the notebooks run

Run notebook from: http://localhost:8080/tree/tutorials/fastai/dev_nbs/course
Run notebook from: http://localhost:8080/notebooks/tutorials/fastbook/

Run a notebook with training to make sure the gpu is being used by looking at the training times for the epochs and checking out the sm and mem columns output from nvdia-smi dmon

nvidia-smi dmon

Perhaps others will have a more elegant solution, but for something quick to get started I haven’t run into any issues running fastai v2 and notebooks on GCP this way.

Cheers and many thanks for all the stellar work on the course, book and API! Mark

6 Likes