Cloud Computing Series #2 — Setting Up Your Computing Engine for CUDA AI Development with GCP

Cloud computing is the delivery of on-demand computing services — from applications to storage and processing power — typically over the internet and on a pay-as-you-go basis. In the Cloud Computing Series posts, we will walk through the following topics:

  • Setup a Compute Engine on GCP
  • Setup a proper environment for AI development
  • Deploy AI applications on the Cloud

In this post, we will talk through how to create a Compute Instance with vGPU in Google Cloud Platform.


Intro to GCP

Google Cloud Platform (GCP) is a portfolio of cloud computing services that grew around the initial Google App Engine framework for hosting web applications from Google’s data centers.

Google Cloud computing services cover a vast range of options now, from the basics of storage, networking, and processing power through to natural language processing and artificial intelligence as well as standard office applications. Pretty much any service that doesn’t require you to be physically close to the computer hardware that you are using can now be delivered via the cloud.

Google Cloud Platform products tailored for Artificial intelligence & Machine Learning include but not limited to: AI Hub (beta), Cloud AutoML (beta), Cloud TPU, Cloud Machine Learning Engine, Diagflow Enterprise Edition, Cloud Natural Language, Cloud Speech-to-Text, Cloud Text-to-Speech, Cloud Translation, Cloud Vision, Cloud Video Intelligence, Cloud Inference API (alpha), and more.


Create a Compute Engine with GPUs

Registration
  1. Create a Google Account or use your personal one.
  2. Create a Google Cloud account.
  3. During the setup process, you need to provide a valid Credit Card credential.

Notes:

  • The free trial is valid for 12 months, and an initial credit of USD300.
  • For the purpose of my proof-of-concept, it should be more than enough.

Setting Up GPUs

By default, any new user is set to have 0 Quotas for GPU Computing. To increase the Quotas for GPUs, you must manually request for increasing the GPU Quota.

Login in to GCP console, then go to “IAM & Admin >> Quotas”, or simply type QUOTAS in the seach tab.

Find the Metric Tab, click None first and then select GPUs (all region); find the Location tab next to the Metric Tab, click None first and then select Global as shown below:


Select the clicked box next to Compute Engine API, and then click the EDIT QUOTAS tab above as shown below:


Finally change the quotas from 0 to 1, and fill in the Request description as shown below:

You will receive a confirming email from GCP referring to your Quotas Request. If you have received an email similar to what as shown below, you should be good to go. The feedbacks normally comes in less than 24 hours.

Notes:

Once the step above is completed, you may move on and start creating a new Compute Instance.


Create a Compute Instance

Navigate to your GCP Console, on the left Panel, find the section named Compute Engine, and click it. The section panel is shown as below:

You will need to do the folowing configuration for the instance:

  • Click CREATE INSTANCE on the top section tab
  • Give a name to the instance
  • In the Region section, choose a region that is close to you
  • In the Machine type section, since we are using this instance to do some AI heavy-lifting job such as training a Neural Network, we might need to increase RAM from 3.75GB + 1Core (n1-stantand-1) to 7.5GB +2Cores (n1-standard-2)
  • In the CPU platform and GPU (below Machine type section), click Add GPU, choose your desired GPU type
  • In the Boot disk section, choose Ubuntu 18.04, and set the storage size to whatever size you want (recommend 60GB + size)
  • In the Firewall section, select Allow HTTP and HTTPS traffic
  • Finally, click Create

Congratualations! You have successfully created a Cloud Computing VM Instance with Nvidia GPU support!


Setup Environment for AI Development

Remote Login

There are multiple ways to log in to GCP VM instance, the simplest way is to set a password for the current user, and log in with a password via SSH. You may also log in with KEY as well. The example below demonstrates how to log in to the instance with a password via SSH.

In the Compute Engine Console, select the instance you created, under the Connect Tab, click the SSH button

Type in the following commands:

$ sudo -i
$ nano /etc/ssh/sshd_config
# find the following line use Ctrl + W, and change as set below
# PasswordAuthentication yes
# PermitRootLogin yes
$ passwd root
$ service sshd restart

Now, you should be able to log in as root with a set password. On your local machine, open up a new terminal, type the following command:

Install CUDA and cuDNN

You will need to install CUDA and cuDNN support for the vGPU. I have written scripts to speed up the installation process. Follow the instructions below, and you should be good to go.

$ cd ~
$ git clone https://github.com/yqlbu/CloudComputing
$ cd CloudComputing
$ sudo chmod +x cuda_10.2_install.sh
$ sudo chmod +x cudnn_7.6.5_install.sh
$ sh cuda_10.2_install.sh
$ sh cudnn_7.6.5_install.sh

If everything sets up properly, you should be able to see the driver and CUDA toolkit installed in your VM as shown below.

Shut Down Instance

Compute Engine charges for usage based on the following price sheet. A bill is sent out at the end of each billing cycle, listing previous usage and charges. Prices on this page are listed in U.S. dollars (USD). All vCPUs, GPUs, and GB of memory are charged a minimum of 1 minute. For example, if you run your virtual machine for 30 seconds, you will be billed for 1 minute of usage. You may check out more information HERE

If you have your VM instance run 24 hours continuously, the bill will increment accordingly. Therefore, I recommend you shut down the instance at any time when you finish your AI heavy-lifting work. The shutdown process is pretty straight forward, you may do the operation in the Compute Engine Console as shown below:

Click “Stop


What’s Next

In the next post, we will install the necessary software (Jupyter, Pytorch, Tensorflow, OpenCV, etc) and dependencies as an environment for AI development. Stay tuned to my next post!


13 Replies to “Cloud Computing Series #2 — Setting Up Your Computing Engine for CUDA AI Development with GCP”

  1. It’s really very difficult in this active life to listen news on Television, therefore
    I only use internet for that reason, and obtain the latest
    information.

    My site: Buy CBD

  2. Usually I don’t read article on blogs, but I would like to say that this write-up very forced me to try and do so! Your writing style has been surprised me. Thanks, quite nice post.

  3. Hey! I simply wish to give a huge thumbs up for the good information you will have here on this post. I will probably be coming again to your weblog for extra soon.

  4. Its like you learn my mind! You seem to understand a lot about this, like you wrote the book in it or something. I believe that you simply could do with a few to drive the message house a bit, but instead of that, that is wonderful blog. A fantastic read. I’ll definitely be back.

  5. Thanks for revealing your ideas with this blog. Furthermore, a fairy tale regarding the finance institutions intentions if talking about property foreclosures is that the standard bank will not take my repayments. There is a fair bit of time in which the bank will require payments in some places. If you are too deep inside hole, they’re going to commonly desire that you pay that payment entirely. However, i am not saying that they will not take any sort of payments at all. In the event you and the traditional bank can seem to work a thing out, this foreclosure procedure may stop. However, should you continue to pass up payments beneath new plan, the foreclosures process can just pick up from where it left off.

  6. I’ve been absent for a while, but now I remember why I used to love this web site. Thanks , I抣l try and check back more frequently. How frequently you update your website?

  7. Throughout the awesome scheme of things you actually get an A with regard to hard work. Where exactly you misplaced me was in all the particulars. As it is said, details make or break the argument.. And that could not be much more true in this article. Having said that, permit me say to you what exactly did work. Your article (parts of it) is definitely really convincing which is possibly why I am making an effort in order to comment. I do not really make it a regular habit of doing that. 2nd, although I can certainly notice the leaps in reason you come up with, I am not really certain of just how you seem to unite your ideas which produce your final result. For the moment I will, no doubt subscribe to your position however trust in the foreseeable future you actually link your dots better.

  8. You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it!

  9. I will immediately grab your rss as I can’t find your e-mail subscription link or newsletter service. Do you’ve any? Please let me know in order that I could subscribe. Thanks.

  10. Hi, i think that i saw you visited my site thus i came to 搑eturn the favor?I am trying to find things to enhance my web site!I suppose its ok to use a few of your ideas!!

  11. Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say wonderful blog!

  12. ƅooқmarked!!, I like үour site!

    1. Hope you enjoyed it!

Leave a Reply