Skip to content

Instantly share code, notes, and snippets.

@trungnt13
Last active October 20, 2016 16:07
Show Gist options
  • Save trungnt13/a3310dac982b8b5a4ab7 to your computer and use it in GitHub Desktop.
Save trungnt13/a3310dac982b8b5a4ab7 to your computer and use it in GitHub Desktop.
Step-by-step
# Loading the modules (these commands shuold be ran everytime you logged in)
module purge
module load StdEnv
module load gcc/4.8.2
module load git/1.9.2
module load python-env
module load cuda/7.0
module load boost/1.58
module load openblas
# first
pip install virtualenv --user
# add this line to ~/.bashrc
export PATH=$PATH:/homeappl/home/[your_account_name]/.local/bin
# reload .bashrc
source ~/.bashrc
# Now create python virtual environment
cd /path/to/your/python/environment
virtualenv [name_of_environment] --no-site-packages
# activate your environment
source /path/to/your/python/environment/[name_of_environment]/bin/activate
# install python packages (just copy paste next line)
pip install numpy; pip install scipy; pip install matplotlib; pip install ipython[all]; pip install pandas; pip install sympy; pip install nose; pip install pycuda; pip install theano
# to deactivate (back to system python)
deactivate
````````````````````````````````````````````````````````````````
How to run theano python script on GPU server
````````````````````````````````````````````````````````````````
# create example.slurm
````````````````````File: example.slurm``````````````````````
#!/bin/bash
#SBATCH -N 1
#SBATCH -p gpu
#SBATCH -t 00:05:00
#SBATCH -J gpuinfo
#SBATCH -o gpuinfo.out.%j
#SBATCH -e gpuinfo.out.%j
#SBATCH --gres=gpu:2
#SBATCH --exclusive
#SBATCH
source $HOME/a7dea06c655dcec82784/modules # this line for reload the modules I wrote at the beginning
source $HOME/.env/ai/bin/activate # activate environment you created
# run your script
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python $HOME/src/test.py
deactivate
``````````````````````````End file````````````````````````````
# submit code to GPU server
sbatch example.slurm
# the report will be saved at the same folder
cat gpuinfo.out.6979937 [the number is id of report]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment