[Ocfs2-tools-devel] [PATCH 1/4] Ocfs2-test: Add openmpi support by setup.sh

Tristan Ye tristan.ye at oracle.com
Thu Sep 11 03:49:06 PDT 2008


We'd better use mpirun to get the MPI_BIN_PATH to
make it become all mpi products compatible.as we know
lamboot did not exist in openmpi.

When getting its MPI_BIN_PATH,should be depended on its
installtion type:
1.Installation from tarball,use 'make install' can install
  mpi binaries under /usr/bin
2.Installation from rpm package,it will be installed under
  /usr/lib64/openmpi/1.2.5-gcc/bin,and you will be asked to
  add this into PATH variable by writting this into startup script
  in .bashrc etc.so here we use 'rpm -ql openmpi' to get such path.

Btw,fix a minor bug at the last line of setup.sh
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 programs/python_common/setup.sh |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/programs/python_common/setup.sh b/programs/python_common/setup.sh
index e69a435..21f77f1 100755
--- a/programs/python_common/setup.sh
+++ b/programs/python_common/setup.sh
@@ -22,12 +22,20 @@ if [ $# -ne 1 ]; then
    echo -e 'Usage: $0 <DESTDIR>';
    exit 1;
 fi;
-LAMBOOT=`which lamboot`
-if [ -f ${LAMBOOT} ]; then
-   MPIDIR=`dirname ${LAMBOOT}`
+
+MPIRUN=`which mpirun`
+RC=$?
+if [ "$RC" != "0" ];then
+	MPIRUN=`rpm -ql openmpi|grep bin|grep mpirun`
+	MPIDIR=`dirname ${MPIRUN}`
 else
-   MPIDIR=/usr/bin
-fi;
+	if [ -f ${MPIRUN} ];then
+		MPIDIR=`dirname ${MPIRUN}`
+	else
+		MPIDIR=/usr/bin
+	fi
+fi
+
 BINDIR=${1}/bin
 sed "s;<DESTDIR>;${1};g" ${BINDIR}/config_py.skel >  ${BINDIR}/config.py
 mv ${BINDIR}/config.py  ${BINDIR}/config_py.skel
@@ -36,4 +44,4 @@ sed "s;<MPIDIR>;${MPIDIR};g" ${BINDIR}/config_py.skel >  ${BINDIR}/config.py
 sed "s;<DESTDIR>;${1};g" ${BINDIR}/config_shell.skel >  ${BINDIR}/config.sh
 mv ${BINDIR}/config.sh ${BINDIR}/config_shell.skel
 sed "s;<MPIDIR>;${MPIDIR};g" ${BINDIR}/config_shell.skel >  ${BINDIR}/config.sh
-rm -f ${BINDIR}/config_py.skel ${MPIDIR}/config_shell.skel
+rm -f ${BINDIR}/config_py.skel ${BINDIR}/config_shell.skel
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list