save as /etc/profile.d/mpi.sh

TODO: create csh variant

# Script to set environment variables for MPI implementations

# The location of the MPI implementation is found by querying if the RPM is installed,
# searching for the mpicc command in the file list, extracting
# the path from it and testing if it exists in real life.

find_dir() {
        dir=`rpm -ql $1 | awk -F/bin/mpicc '/mpicc$/ {print $1}'`
        if [ "x$dir" != "x" ]
        then
                if [ -d $dir -a -f $dir/bin/mpicc ]
                then
                        echo $dir
                fi
        fi
}

find_version() {
        version=`rpm -q $1 | grep -v "is not installed" | awk -F- '{print $2}'`
        if [ "x$version" != "x" ]
        then
                echo $version
        fi
}

MPI_MPICH_PATH=`find_dir mpich`                 ## /opt/mpich-1.2.7p1
MPI_MPICH_VERSION=`find_version mpich`          ## 1.2.7p1

MPI_MPICH2_PATH=`find_dir mpich2`               ## /opt/mpich2-1.0.3
MPI_MPICH2_VERSION=`find_version mpich2`        ## 1.0.3

MPI_OPENMPI_PATH=`find_dir openmpi`             ## /opt/openmpi-1.0.1
MPI_OPENMPI_VERSION=`find_version openmpi`      ## 1.0.1

MPI_LAM_6_PATH=`find_dir "lam-6*"`              ## /usr
MPI_LAM_6_VERSION=`find_version "lam-6*"`       ## 6.5.9-1

MPI_LAM_7_PATH=`find_dir "lam-7*"`              ## /opt/lam-7.1.2
MPI_LAM_7_VERSION=`find_version "lam-7*"`       ## 7.1.2


export MPI_MPICH_PATH MPI_MPICH_VERSION MPI_MPICH2_PATH MPI_MPICH2_VERSION \
MPI_OPENMPI_PATH MPI_OPENMPI_VERSION MPI_LAM_PATH MPI_LAM_VERSION

-- RichardDeJong - 20 Jun 2006

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2006-06-20 - unknown
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LCG All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback