Ref: Amazon EC2 实例类型html
搭建网站:MediaWikipython
压力测试:Siegenginx
压力指标:内存使用;IO状况;Package状况;CPU使用状况;shell
Web服务器,使用M4 or C3。ubuntu
DB服务器,使用R4。服务器
实例的建立,请见:[AWS] Introductory Course & S3 Bucket网络
Putty on Windows须要将密钥转换下,导入再保存为.ppk文件。框架
Nvidia:CUDAssh
Khronos Group:OpenCL机器学习
Microsoft:DirectCompute
G3系列,Tesla M60
P2系列,Tesla K80
Launch Linux with other configure.
经过脚本预安装nginx。
Amazon 提供的带有 GPU 的 EC2 实例有三种,分别是 P2 系列,P3 系列(高配)和 G3 系列(图形处理)。
P2 实例适用于通用 GPU 计算应用程序,特点以下:
通常帐户中 P2,P3,G3 系列实例的限制数目都是 0。
须要专门向 amazon 申请才能得到使用资格。申请页面在这里: http://aws.amazon.com/contact-us/ec2-request
能够在这个页面(http://aws.amazon.com/contact-us/ec2-request) 提交工单,申请改变某种实例的限制数目。
肯定了 EC2 实例的系列和型号而且确认本身帐户下这种实例的限制数目大于 0 以后,就能够选择适合深度学习用的虚拟机镜像了(Deep Learning Amazon Machine Images, 后面简称 DLAMI)。
DLAMI 其实就是包含了操做系统、显卡驱动以及深度学习须要的各类软件环境的一个安装盘。用安装盘(DLAMI)在机器(EC2 实例)上安装系统。
用 Anaconda 安装了各个深度学习框架,每一个框架单独在一个 Python 的虚拟环境中,互不干扰。
* 各个 DL 框架是分离的,而且很是容易切换;
各个框架经过源码安装,都装在同一个环境中,没有划分虚拟环境。
* 适合于那些须要改框架源码的人
以上两种支持以下几种深度学习框架:• Apache MXNet • Caffe • Caffe2 • CNTK • Keras • PyTorch • TensorFlow • Theano • Torch
没有安装深度学习框架,只安装了 NVIDIA CUDA 和其余依赖程序。你须要本身安装 Python 的各类模块,机器学习的框架等等。
* 适合于那些 fork 了某个深度学习项目,作了改进,并想本身构建最新版本的人。
方便起见,咱们选择 Deep Learning AMI (Ubuntu) with Conda 这个虚拟机镜像。
p2.xlarge 须要的最小存储是 75G(系统安装以后大约是 50G,包括系统自带的一些样例代码,各类框架的软件等),因此这里咱们直接按照默认配置,75G。
ssh 登陆以后会显示以下画面,告诉你如何进入各类机器学习框架的虚拟 Python 环境。
============================================================================= __| __|_ ) _| ( / Deep Learning AMI (Ubuntu) Version 12.0 ___|\___|___| ============================================================================= Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-1062-aws x86_64v) Please use one of the following commands to start the required environment with the framework of your choice: for MXNet(+Keras2) with Python3 (CUDA 9.0 and Intel MKL-DNN) _______________________________ source activate mxnet_p36 for MXNet(+Keras2) with Python2 (CUDA 9.0 and Intel MKL-DNN) _______________________________ source activate mxnet_p27 for TensorFlow(+Keras2) with Python3 (CUDA 9.0 and Intel MKL-DNN) _____________________ source activate tensorflow_p36 for TensorFlow(+Keras2) with Python2 (CUDA 9.0 and Intel MKL-DNN) _____________________ source activate tensorflow_p27 for Theano(+Keras2) with Python3 (CUDA 9.0) _______________________________________________ source activate theano_p36 for Theano(+Keras2) with Python2 (CUDA 9.0) _______________________________________________ source activate theano_p27 for PyTorch with Python3 (CUDA 9.0 and Intel MKL) ________________________________________ source activate pytorch_p36 for PyTorch with Python2 (CUDA 9.0 and Intel MKL) ________________________________________ source activate pytorch_p27 for CNTK(+Keras2) with Python3 (CUDA 9.0 and Intel MKL-DNN) _________________________________ source activate cntk_p36 for CNTK(+Keras2) with Python2 (CUDA 9.0 and Intel MKL-DNN) _________________________________ source activate cntk_p27 for Caffe2 with Python2 (CUDA 9.0) ________________________________________________________ source activate caffe2_p27 for Caffe with Python2 (CUDA 8.0) __________________________________________________________ source activate caffe_p27 for Caffe with Python3 (CUDA 8.0) __________________________________________________________ source activate caffe_p35 for Chainer with Python2 (CUDA 9.0 and Intel iDeep) ______________________________________ source activate chainer_p27 for Chainer with Python3 (CUDA 9.0 and Intel iDeep) ______________________________________ source activate chainer_p36 for base Python2 (CUDA 9.0) __________________________________________________________________ source activate python2 for base Python3 (CUDA 9.0) __________________________________________________________________ source activate python3 Official Conda User Guide: https://conda.io/docs/user-guide/index.html AWS Deep Learning AMI Homepage: https://aws.amazon.com/machine-learning/amis/ Developer Guide and Release Notes: https://docs.aws.amazon.com/dlami/latest/devguide/what-is-dlami.html Support: https://forums.aws.amazon.com/forum.jspa?forumID=263 ============================================================================= * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 38 packages can be updated. 0 updates are security updates.
因此,根据上面的提示信息能够看出,不一样机器学习框架都被安装成了一个 Python 虚拟环境,想进入某个虚拟环境,例如 tensorflow Python 3.6 环境,只需执行:
source activate tensorflow_p36
退出某个虚拟环境:
source deactivate
nvidia-smi
# 每两秒运行一次,刷新数据
watch -n 2 nvidia-smi
首先进入 tensorflow_p36
环境.
source activate tensorflow_p36
首次执行大约须要 1 分钟时间,安装 tensorflow-gpu。
这里貌似 Amazon 的 AMI 有个问题,上面自动安装 tensorflow 模块以后,运行 python 程序却报告找不到 tensorflow。须要手动再安装一次:
pip install tensorflow-gpu
程序打包在文件 cnn_cifar.tgz
中,上传到 EC2 实例:
scp cnn_cifar.tgz awsp2:/home/ubuntu/
运行过程当中或者运行结束以后,能够把数据打包以后经过 scp 命令传回本地。
End.