Skip to content

Instantly share code, notes, and snippets.

@thelahunginjeet
Last active August 29, 2015 13:57
Show Gist options
  • Save thelahunginjeet/9840652 to your computer and use it in GitHub Desktop.
Save thelahunginjeet/9840652 to your computer and use it in GitHub Desktop.
LSF example of a serial python job, with a virtual environment
#!/bin/bash
#
#BSUB -o pyjob.%J.out
#BSUB -e pyjob.%J.err
#BSUB -n 1
# do stuff
source ~/venv/bin/activate
python -c "import pyica; import sys; print(sys.version); from numpy.random import randn; x = randn(); print '%f' %x"
# Notes:
# -%J adds the job number to the error/output files
# -this job is purely serial, so -n is ignored anyway
# -submit with bsub < ./python_job.sh
# -source command makes sure to activate the virtual environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment