A Vagrantfile to provision a gpu instance installed tensorflow-gpu on EC2
This Vagrantfile gives you an easy way to launch a gpu instance installed tensorflow-gpu. Information for the instance which will be launched is blow.
- CUDA: v8.0
- cuDNN: v5.1
- Python: 3.4
- Tensorflow(GPU): v12.1
- OS: Ubuntu 14.04
- instance_type: g2.2xlarge
- region: np-northeast-1
- ami: ami-3995e55e
If you want to change the region, please find an appropriate ami for your region and instance_type from here. If you want to change the version of python, CUDA or cuDNN, please find an appropriate tensorflow-gpu from here.
Vagrant and a few configurations of AWS are required.
vagrant-aws is a vagrant plugin to allow Vagrant to control and provision machines in EC2 and VPC. When Vagrant is already installed, you can install it like blow.
$ vagrant plugin install vagrant-aws
After creating them, please set them to
ssh.private_key_path in the Vagrantfile, whose roles are explained at vagrant-aws's README. Please use a security group to allow SSH access. If you want to use jupyter notebook and tensorboard, I recommend you to allow TCP 8888 and TCP 6006 ports.
$ git clone https://github.com/shotarok/vagrant-aws-gpu-tensorflow.git $ cd vagrant-aws-gpu-tensorflow # Configure aws environment variables $ export AWS_ACCESS_KEY_ID=... $ export AWS_SECRET_ACCESS_KEY=... # Set your own aws.keypair_name, aws.security_groups and # ssh.private_key_path by your favorite editor $ vi Vagrantfile # Launch and provision an gpu instance # (it will take some time) $ VAGRANT_LOG=info vagrant up --provider=aws # Connect to the instance $ vagrant ssh # Check tensorflow-gpu on the gpu instance (guest)$ python3 -c "import tensorflow" > I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally > I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally > I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally > I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally > I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally > ... # Terminate the instance $ vagrant destroy
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Create new Pull Request