Neuroglycerin / neukrill-net-work

NDSB competition repository for scripting, note taking and writing submissions.
MIT License
0 stars 0 forks source link

Use Amazon cloud GPU #12

Closed gngdb closed 9 years ago

gngdb commented 9 years ago

Train a model with the Amazon cloud services and you get this achievement!

matt-graham commented 9 years ago

Instructions written by Kez on getting an Amazon EC2 GPU instance up and running for a pylearn2 model. Some of libraries and environment variables dependencies will be a bit different here


  1. use the AMI: ubuntu-trusty-14.04-amd64-server-20141125 (ami-898dd9b9) - it should say (HVM)
  2. follow this setup bash script to configure the environment

    chmod 400 first.pem
    ssh -v -i first.pem ubuntu@public_dsn  # copypaste public_dsn from AWS EC2 console
    
    sudo apt-get update
    sudo apt-get -y dist-upgrade
    sudo apt-get install -y gcc g++ gfortran build-essential git wget linux-image-generic libopenblas-dev python-dev python-pip python-nose python-numpy python-scipy python-matplotlib
    sudo pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
    sudo wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
    sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
    sudo apt-get update
    sudo apt-get install -y cuda
    echo -e "\nexport PATH=/usr/local/cuda-6.5/bin:$PATH\n\nexport LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64" >> ~/.bashrc
    sudo ldconfig /usr/local/cuda-6.5/lib64 #more reliable: last answer of http://askubuntu.com/questions/210884/setting-ld-library-path-for-cuda
    sudo reboot
    
    chmod 400 first.pem
    ssh -v -i first.pem ubuntu@publicdsn
    
    cd /usr/local/cuda-6.5/samples/1_Utilities/deviceQuery
    sudo make
    ./deviceQuery
    echo -e "\n[global]\nfloatX=float32\ndevice=gpu\nmode=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[blas]ldflags=\n\n[cuda]\nroot=/usr/local/cuda-6.5" >> ~/.theanorc
    
    cd ~
    git clone git://github.com/lisa-lab/pylearn2.git
    cd pylearn2
    sudo python setup.py install
    cd ~
    
    sudo pip install pandas
    
    echo "\nexport DATA_DIR=~/data\nexport EXPERIMENTS_DIR=~/experiments" >> ~/.bashrc
    source ~/.bashrc
  3. add any extra environment vars as required e.g. DATA_DIR, PYLEARN2_DATA_PATH
  4. if installing theano, pylearn2 with sudo, you need to sudo python. However, we lose the environment vars in sudo default so the call becomes sudo -E python etc.py ...
  5. convert the datasets offline and scp them over
  6. adjust the test.py script to handle this data without the pipeline cruft
  7. source .bashrc updates the environment in the current shell after editing .bashrc file