Showing posts with label cloud computing. Show all posts
Showing posts with label cloud computing. Show all posts

Wednesday, March 22, 2017

AWS EC2, Bitfusion

I came to realize that Bitfusion built its business on AWS marketplace.
While our computers today are often extremely fast, most applications aren’t optimized for the hardware platform they are running on. Bitfusion, which debuted in May 2015 at TechCrunch Disrupt NY, wanted to automate all of this for developers. The company was founded by three former Intel employees in Austin, with a $1.45 million seed funding.
They have 3 business model: Software, appliance (with hardware accelerators), and the accelerated RackSpace Cloud. Why aren’t you going after large-scale enterprises? Large enterprises can build their own hardware and have the skills to do this for their specialized applications.
GPUs can speed up training times, but managing both the infrastructure and software for GPUs creates huge productivity challenges. Bitfusion provides a GPU virtualization and application management platform that accelerates applications and training time with no code changes, and makes it easy to efficiently manage production GPU clusters with high availability, team multi-tenancy, and parallel job execution.

Getting Started Video

  1. create key pair
  2. use Bitfusion Ubuntu 14 TensorFlow AMI.
  3. Region: Oregon. Instance: t2.small. Security: have 8888 port open. Key pair
  4. wait for ready. use “connect” button to get required commands like chmod and ssh -i.
  5. open new browser window with public DNS, plus port :8888 for jupyter. Password is instance ID. I don’t know the difference between DNS and IP right now. It seems http://<Public IP>:8888 also works.
  6. Then you see the 6 familar tensorflow/udacity notebooks
A script version of “getting started” is here.
After ssh link:
scp -i /path/to/your/pem/file path/to/file ubuntu@public_ip_address:~/.  # transfer files from local
python ~/tensorflow/tensorflow/models/image/mnist/convolutional.py
python ~/tensorflow/tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py --num_gpus=4

price schema

  • Using a t2.nano, t2.micro, or t2.small? No Bitfusion software fee. Only AWS charges: 0.023/hr
  • Using a p2.8xlarge, p2.16xlarge, m4.16xlarge, x1.16xlarge, x1.32xlarge, i2.4xlarge, i2.8xlarge, or d2.8xlarge? $0.297/hour is your new, lower Bitfusion software fee.
  • g2.2xlarge is 0.65*1.1 = 0.715/hr
AWS recently announced their next generation GPU P2 instances. This new generation provides up to 16 NVIDIA K80 GPUs, 64 vCPUs and 732 GiB of host memory. In previous releases of our Bitfusion Tensorflow AMI, we included updated NVIDIA drivers, the CUDA toolkit, and CUDNN support, allowing you to tap into these new powerful instances.
By the way, their recent blog posts did a good job smoothing you on TensorFlow.

Monday, March 20, 2017

AWS Elastic Compute Cloud


Amazon Elastic Compute Cloud (EC2) is the Amazon Web Service you use to create and run virtual machines in the cloud. Each virtual machine is called instance.
AMI (Amazon Machine Images) contains all the environment files and drivers for you to train on a GPU. It has cuDNN, TensorFlow with GPU support, Python 3, and all the other packages required for this course.

launch an instance

In other words, create a virtual machine on the cloud. AMIs are prebuilt virtual environment. Community AMIs are free. Marketplace AMIs are charged or free to try. I come to realize the target customers are power-hungry, storage-hungry users.
Steps:
  1. create AWS account
  2. EC2 Dashboard -> create instance -> launch instance -> Choose an Amazon Machine Image (AMI) -> Community AMIs -> search for “udacity-dl”
  3. filter by “GPU instances” -> g2.2xlarge -> Review and launch
  4. edit storage -> 32 GB. This is the space to hold the datasets.
  5. edit security groups -> create a new security group -> Security group name: jupyter -> Add rule: Custom TCP rule, Port Range: 8888, Anywhere: Source -> Review and launch
  6. launch -> launch without a key pair
  7. Note on the EC2 On-Demand Pricing page. For US West(Oregon), the base price for g2.2xlarge is $0.65 per hour. The running instances will be charged until you click “stop” (shutdown). The storage will be charged until you click “terminate” (delete).
  8. set AWS Billing Alarms and budget to avoid high-piling bills due to forgetting to turn off the instances.
  9. GPU EC2 limit increase request takes 2 or 3 days, which is painfully slow.
  10. Alternatively, I try to use “Free tier” instance which is specified here: Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type - ami-0b33d91d -> t2.micro (free tier eligible) -> launch -> create a new key pair -> MyKeyPair -> Download KeyPair. It is recommended that the keypair is stored in the .ssh folder by mv ~/Downloads/MyKeyPair.pem ~/.ssh/MyKeyPair.pem
  11. After launching your instance, it’s time to connect to it. Restrict permissions to your private SSH key by chmod 400 ~/.ssh/mykeypair.pem
  12. use ssh to connect: ssh -i ~/.ssh/MyKeyPair.pem ec2-user@{IPv4 Public IP}
  13. this virtual machine is too simple to do useful tasks. It only preinstalls simple things: python 2.7,pip 6.1.1. And it seems that you are not allowed to install new things or upgrade. I don’t find it particularly useful so far.
If the udacity AMI instance can be successfully created and initialized, the connection will be ssh udacity@{IPv4 Public IP}. Default password is “udacity”. Test the instance by:
git clone https://github.com/udacity/deep-learning.git
cd deep-learning/intro-to-tensorflow/
source activate dl
jupyter notebook

Launch a WordPress Website

  1. EC2 dashboard -> launch instance -> AWS marketplace, search”wordpress” -> WordPress powered by Bitnami -> continue
  2. t2.micro(free tier eligible) -> Next -> Next, Add Tag -> Key: Name, Value: WordPress -> next -> review and launch -> launch -> launch without a key pair
  3. view instance. Wait until “Instance State: running, Status Checks: checks passed. Then copy and paste “IPv4 Public IP” to a new browser window to see the magic. Permalink: http://54.89.220.149/
  4. Go back to instances. Actions-> Instance settings -> get system log. Scroll down and find the password: 6LyeomW7L1F3
  5. Go back to WordPress site and log in by username: user, and password. Customize the site as you wish.

Register a Domain name

steps:
  1. Click here to open the Elastic IP part of the EC2 console in a new window and click “Allocate New Address” 34.205.189.152
  2. Elastic IP address (EIP) will be charged for $ 0.005/hr unless it is connected to running instances.
  3. Actions-> Associate Address -> Instance: your instance
  4. buy a domain name. I already bought one at google domain, which is equivalent to Amazone Route 53.
  5. The trick is that I not only need to go to google domain to redirect my domain name to the EIP, but also go to Blogspot setting page to check all the redirecting.