I went through the hectic job of searching all the internet to find the right solution for creating a simple Virtual Machine to run my Python program.
I’m here to guide anyone interested to use the plethora of services provided by the Google Cloud Platform(I can’t believe that it was released in 2008)
Anyways to let’s get started,
First you will need a Gmail Account.
Then Click on this Link :https://cloud.google.com/
In there, click on TRY FREE
Log in to your G-Mail Account.
Then is a very tricky part where you’ve to setup your payment account. Use your Credit Card or Debit Card to register for it. Sometimes, they charge a meager fees 0.0001 dollars(or 2 ruppees) as just to verify your account. After verification is the time to see some money. Let’s see now, 300 dollars(Rs.21,988/-) are added to your account as free credits !!! (Smug grin :-P )
The fun stuff begins now
Setting up the VM Instance:
Next, you’ll be directed to this page where you’ll click on CREATE :
Here you can configure your Virtual Machine with any software or hardware you like. Say for deep learning a small model,Dense Net on Cifar 10 database,we can use a 2 core CPU with 8GB Memory and 1 Tesla P100 GPU. This configuration really helped me improve the speed of training in comparison with Google Colab. You can choose whichever configuration you like. Remember you shall be billed accordingly.(Initially upto 300 dollars its free,Google will not bill your card)
Now you get to choose your OS. For deep learning practices I would recommend choosing the Intel Optimized Deep Learning Image: TensorFlow with Debian Linux Image. This image replicates all the basic software thats required for creating a deep learning model like python,jupyter,pip etc. I like the fact that immediately after the install it asks us to install the NVIDIA CUDA driver for the chosen GPU. And then be sure to choose the size of the boot disk and as an SSD(gives a really small cost differance with the standard disk of 0.001 dollars).
Click on allow HTTP traffic and HTTPS traffic . And Create! There you’ve your instance up and running.
Click on SSH to get started!
You’ll notice a screen like this,
The first thing you’d want to do is, hit y for installing the nvidia driver.
Execute the following commands
sudo apt-get update
Now let’s configure the network on the cloud to allow us to run jupyter notebook.
Run the following commands
jupyter notebook –generate-config
sudo nano ~/.jupyter/jupyter_notebook_config.py
It’ll open this
c = get_config()
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 4808
Write this code as shown in the red lines window.
Then you have to press
Ctrl + O
Ctrl + X
Now create a password for your jupyter notebook by command
jupyter notebook password
Then minimize the SSH terminal window, click on instance
Click on default in Network Interfaces
Then click on firewall rules and add firewell rule
Name your firewall rule and specify target as All instances in the network
Add source IP range as 0.0.0.0
and TCP protocol as anything you like (eg.4808)
Back too the SSH terminal type this code
jupyter-notebook --no-browser --port=4808
Instead of 4808 write your own TCP protocol number.
Then go to the Chrome page and copy the external IP the one with ephemeral in brackets.
Goto a new chrome tab and paste your external IP address. then give a colon and type in your port number.
(x,y,z are integers)
Then you’ll see this screen : and you are good to go :-D
Source: Deep Learning on Medium