Giter Club home page Giter Club logo

snu_cs_m2177.004300's Introduction

Hands on Labs for SNU Deep Learning M2177.004300, 2018 Spring semester

This document aims to Deep learning infrastructure setup and MNIST practice. Lecture slides are in Github.

For Azure credit, please contact your TA

Topic

Cloud setup / GPU Instance creation and connection / MNIST example

Cloud setup

1. Microsoft ID creation for Azure service

2. Azure Subscription

3. Introduction to Azure

GPU Instance creation

4. Linux GPU Virtual Machine creation on Azure (Data Science Virtual Machine)

5. VM connect and GUI environment (Remote desktop client)

6. Connect to Jupyter Hub

7. GPU/CPU comparison

8. Using Python(Option)

MNIST example

9. MNIST with Tensorflow

1. Microsoft ID creation for Azure connect

(Skip if you already have Microsoft account)

First of all, Microsoft ID is required to access Azure. Visit Account creation pageand create Microsoft ID with any of your exising email address.

Microsoft Account Page

Click 'Sign in with Microsoft'

Microsoft Account Creation

Click 'Create One'

Once you complete the registration, please summit your email address to your TA to receive subscription.

2. Check Azure subscription

Welcome to Azure, cloud service of Microsoft. Your TA already have invited you to your subscription for this class. We will verify your subscription first. Please go to Azure Portal

Please click 'Subscriptions' menu at left bottom. Subscription Button

By clicking your subscription name, you can mornitor your credit balance. Please remind that your credit is limited and you're liable to manage your own credit for this class.

If you have experienced Azure before this class, you may see other subscriptions. You MUST use subscription from your TA, otherwise the other subscription will charge you, while the subscription from TA doesn't cost you at all.

3. Azure 101

Congraturations. Now you're permitted to utilize various Azure resources Azure. Azure Portal is web dashboard to use and monitor such services.

Favorite provides easy access for your frequent usage. You can create own dashboard to monitor your resources. Visit Azure Portal Introduction and get more information.

4. Linux GPU Virtual Machine (Data Science Virtual Machine)

Deploy Virtual Machine with GPU at Azure Data Center. In Azure, user can deploy virtual machine with Windows OS or Linux OS. For Deep learning purpose, Microsoft provides Data Science VM including various toolkits within its image. User or researcher can save significant time to setup number of toolkits such as,

Anaconda Python 2.7, 3.5 / Microsoft R Open / Jupyter Notebook Server / Jupyter Notebook Hub / Visual Studio Code / Atom / Vim / Git / Tensorflow / Caffe & Caffe2 / Torch / Keras / CUDA

Click 'Create a resource' at left top. Type 'data science virtual machine' at search bar. Some options will be seen. Choose Data Science Virtual Machine for Linux(Ubuntu).

vmcreation

Click 'Create' at bottom and go to the next step.

  1. Basics

At this blade, you can set basic parameters for your virtual machine.

  • Name is an identifier in your Azure dashboard to distinguish your current virtual machine. In this exercise, we will use 'MyFirstVM'.
  • VM Disk Type: Select HDD
  • User Name: user account to log in your ubuntu OS. Please memorise carefully.
  • Authentication type: Two ways are possible. SSH / Password. In this exercise, choose Password and keep it well. More than 3 different category among upper/lower/number/special character is needed and at least 12 bytes. When you forget your password, you can reset at Azure Portal - reset password menu.
  • Subscription: Make sure your subscription comes from TA
  • Resource Group: logical group to manage your various resources. Choose 'create new' and put 'MyFirstRG'.
  • Location: Not all the region has GPU machines. Select 'East US' for GPU access.

VM Basic

  1. Size

Here, you can choose VM option for various performance and purpose. Azure provides range of different VM.

Compute Type: Select GPU

Now you will see number of GPU instances. (If you don't have any options here, please go to previous step and make sure your chosen Region). Select NC6, and click 'Select' at bottom. NC VM has compute special GPU chipset for machine learning. ND stands for fast interence. NV stands for visual processing. Please visit Nvidia's webpage for more information.

  1. Settings

This section is to set advanced settings, however, keep 'default' and click 'OK' at bottom.

  • Availability Set is a logical grouping capability that you can use in Azure to ensure that the VM resources you place within it are isolated from each other when they are deployed within an Azure datacenter.
  • Virtual Network and Subnet are your own private network in the cloud.
  • Public IP address gives static public IP for VM.
  • Network Security Group contains a list of security rules that allow or deny network traffic to resources connected to Azure Virtual Networks (VNet).
  1. Create

You will see the summarization of your first VM. Click checkbox and 'create' button. Once you finish all the process, you will monitor your deployment at right top alert menu.

5. VM connect and GUI client

In few minutes, you will have your first VM and icon at your dashboard. Click the icon and take a look for a while.

runningvm

By clicking icon, detail information displays. At top, there is button for control VM - Restart, Start and Stop. Your VM's public IP is at mid point. At bottom, several monitoring stats are provided. Click 'Connect' at top.

You can use preferred tools to access VM, such as Putty, Bash Shell. Here we will use Cloud Shell in Azure Portal.

CloudShell

Click icon '>_' at right top at Azure portal. Choose Bash Shell, and create storage where Shell commands will be saved. You can execute Shell scripts at Azure portal.

ssh Your User Name@Your public IP address

(You can see it by clicking 'Connect' button at top.)


VM management tip to save your credit

GPU Instance highly costs and your credit is limited. When you're not using your GPU machine, make sure STOP your machine. Cloud environment allows you to pay as you go. Azure charges your credit minute-based calculation. Therefore, you can prevent unintended and unnecessary expenditure by stopping and restarting your machine.


Warning for Linux Virtual Machine on Azure

Do not save any of your data at temporary disk (/dev/sdb1) on Azure virtual machine. The disk is logical drive to save temporary files from OS provisioning. Reboot of VM may result in initialization at this place. (D drive at Windows machine, too)


GUI Client

DSVM provides easy GUI setup. Only installation of client application, X2Go is needed.

Run X2Go client and setup for your VM.

X2go

  • Session > New Session
  • Host: your VM's public IP address
  • Login: your user name set at Azure portal
  • SSH Port: 22
  • Session Type: XFCE

Click the session box, and put your password.

Ubuntu


Ubuntu Update (optional)

Go to your terminal at Ubuntu.

sudo apt-get update ## update package index

sudo apt-get upgrade ## upgrade all installed package

conda update conda ## Anaconda update


6. Connect to Jupyter Hub

When DSVM runs, only internet access is required to connect Jupyter Hub at DSVM. 8000 port is pre-configured.

https://VM's_PublicIP:8000
Put it at your browser. Certificate issue will be raised. Use advanced setting by browser.

ID/PW of Jupyter Hub are reflected those at your VM.

Click Start MyServer.


ipynb file exchange at your server

Azure VM has several security options at default. The easiest way to upload and download file is to use Jupyter Hub with your web browser.

7. CPU/GPU performance comparison

To understand why Machine Learning requires GPU, let's execute simple python code below. Through this process, we can check the status of your environment.

At Jupyter Hub

File > New Notebook > Python 3

Copy and paste code below and Run

Simple Python code for comparison CPU/GPU

8. Python version (optional)

DSVM contains two different version of Python at each path.

Python 2.7 - /anaconda/bin

source /anaconda/bin/activate root

Python 3.5 - /anaconda/envs/py35/bin

source /anaconda/bin/activate py35

9. MNIST example

MNIST.ipynb

snu_cs_m2177.004300's People

Contributors

baemins avatar

Watchers

James Cloos avatar Sunghyeon Jo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.