1

How can I tell Apache httpd which version of MPI to use?

I'm trying to run a Django web application under Apache httpd, and some of our pages make MPI calls with mpi4py. The problem is that I get an ImportError when a page tries to import MPI.

ImportError: libmpi.so.1: cannot open shared object file: No such file or directory

The server has both OpenMPI and MPICH installed, and in a user shell, I had to type module load openmpi/gnu before I could use mpi4py. For example, this would fail with an error loading the library:

python -c "from mpi4py import MPI"

I solved that for user shells by creating a /etc/profile.d/openmpi.sh file with this line:

module load openmpi/gnu

Unfortunately, it sounds like the apache user doesn't load the global profile, so I still have the ImportError in my pages. I tried loading the module at the end of /etc/sysconfig/httpd:

. /etc/profile.d/modules.sh
module load openmpi/gnu

Unfortunately, I still get the ImportError. If I comment out the import and check os.environ['PATH'] it looks like the openmpi module has not been loaded, so the shell that loads the Apache service must not be the same as the shell that runs the Apache service.

I also tried making changes in /etc/bashrc, but that doesn't seem to affect the apache user, either.

We're running Apache 2.2.3 on a Scyld Beowulf cluster with CentOS 5.9.

Don Kirkby
  • 1,354
  • 3
  • 11
  • 23

0 Answers0