Monday, October 21, 2013

Making Numpy work in PBS scripts on a cluster

I work on a computing cluster that uses the environmental modules (module from the command line) to simplify access to versioned software like Numpy.

To make Numpy work from a simple ssh session, I had to load modules in the proper order. For me this was:

module add python/2.7.3
module add atlas/3.8.3
module add suitesparse/20110224

module add numpy/1.5.1

I dropped this in my .bashrc so it's always on.

During interactive sessions, Numpy will work if you make sure your .bashrc gets sourced at the beginning of the session. I forget how I did that.

When submitting PBS scripts, I have no access to the module command. To figure out what was going on, I ran some diagnostic scripts with redirected output so I could see what was going on, e.g.:

./ &> out.txt

My out.txt file said something about how could not be found. In an interactive session, I found out my Python path and my linked library paths:


Then I took the output from those things and put them before the Numpy-including script in that bash script that the PBS script calls:

#! /bin/bash
echo Importing library stuff...
export PYTHONPATH=output_from_what_was_before
export LD_LIBRARY_PATH=output_from_what_was_before

Now I can run scripts that have Numpy in PBS!