Collaborators: Harry Jiang, Zixian (Sunnie) Ma and Prabhjot Singh Rai.
- Visit AWS website here and login via your IAM username and password.
- Under find services, search
EC2
. - Click on
Running Instances
. You should see a dashboard with all the instances. We are interested inp2.xlarge
(instance ID:i-0d97a15182c8f6a45
). Select it and click onActions
in the top bar, thenInstance State
and thenStart
orStop
.
VERY IMPORTANT: Please stop the instance after your work
On the same EC2 page, when you have selected the particular instance, towards the bottom there is Description
tab. Under this, you will find Public DNS (IPv4)
. It should be something like ec2-54-212-67-222.us-west-2.compute.amazonaws.com
(might change whenever we restart the instance). This is required to ssh and view the notebook on the web browser.
- From your terminal, run the command
ssh USER@public-dns-ipv4
. For examplessh prabhjot@ec2-54-212-67-222.us-west-2.compute.amazonaws.com
. You should be successfully logged in. - Run the command
passwd
if you are logging in for the first time to change VM password for your user.
Since there are multiple users accessing the same machine and we want to share the already installed libraries (PyTorch, CUDA etc) among all of us, we would need to do some basic setup for the same.
vim ~/.profile
to edit the profile for the user.- Append the following line after the last line in the file, then save and quit.
export PATH=/home/ubuntu/anaconda3/envs/pytorch_p36/bin:/home/ubuntu/anaconda3/bin/:/home/ubuntu/bin:/home/ubuntu/.local/bin:/home/ubuntu/anaconda3/bin/:/usr/local/cuda/bin:/usr/local/bin:/opt/aws/bin:/usr/local/mpi/bin:/usr/local/cuda/bin:/usr/local/bin:/opt/aws/bin:/home/ubuntu/src/cntk/bin:/usr/local/mpi/bin:/usr/local/cuda/bin:/usr/local/bin:/opt/aws/bin:/usr/local/mpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$PATH
source ~/.profile
to restart the profile.
This is required to access the port directly on public IP of our instance.
- At your home directory, run
jupyter notebook --generate-config
. vim ~/.jupyter/jupyter_notebook_config.py
- Append the following lines towards the end of the file, then save and quit.
c.NotebookApp.kernel_spec_manager_class = 'environment_kernels.EnvironmentKernelSpecManager' c.NotebookApp.iopub_data_rate_limit = 10000000000 c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False
- Finally, run the command
jupyter notebook password
to setup password for your notebook.
Steps 1 and 2 describe the best way to setup github access to your VM user (via ssh).
- Let's begin with creating a new ssh key pair. Run the command
ssh-keygen -t rsa -C "YOUR_EMAIL_ADDRESS"
to create a new ssh keygen. Highly recommended to set a password when prompted for this key since three of us are sharing a single machine. - Add this new created ssh key to your Github Account. Replicate the steps 1 to 8 in this article.
- That's all! Now we are all set to clone the repository. In your home directory,
git clone git@github.com:raiprabh/brain-age.git
to clone the repository. You'll be asked your ssh key password you entered while creating your key. - If everything went great, you should see
brain-age
in your home directory.
- Make sure to activate the right virtual environment prior running the instance. Run the command
source /home/ubuntu/anaconda3/bin//activate pytorch_p36
to activate pytorch with CUDA python environment. - Change directory to root of project (
cd ~/brain-age
). - Run
jupyter notebook
. It should show the port on which the notebook is running (this might also change, since three of us may be working parallely on different ports). - In your web browser, open
public-dns-ipv4:PORT
to open up the jupyter notebook. For exampleec2-54-212-67-222.us-west-2.compute.amazonaws.com:8888
. Enter your notebook password when prompted. - Grab a coffee and start coding!
Please note that we shouldn't save the data in the home directory as our machine has only 3 gb left. Instead, move to /shared
directory and download all the data there. We have added a new volume of around 150gb dedicated to this folder for our data and weights. Following are the datasets which have been already downloaded in the /shared
directory