Changeset 3773 in /cluster/svnroot


Ignore:
Timestamp:
Jul 28, 2012 2:20:36 PM (8 years ago)
Author:
skylar
Message:

generating mpi implementation specific machines files, not auto-generating anymore (#480)

Location:
bccd-ng/branches/skylar/bccd-3.1.1/trees
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/branches/skylar/bccd-3.1.1/trees/bin/bccd-snarfhosts

    r3244 r3773  
    2525. /usr/local/Modules/3.2.6/init/bash
    2626
     27function get_mpi() {
     28        MYMODULES=$(module list -p 2>&1 )
     29        if echo ${MYMODULES}|egrep -q 'openmpi'; then
     30                echo openmpi
     31                return 0
     32        elif echo ${MYMODULES}|egrep -q 'mpich2'; then
     33                echo mpich2
     34                return 0
     35        elif echo ${MYMODULES}egrep -q 'lam'; then
     36                echo lam
     37                return 0
     38        fi
     39
     40        echo "No valid MPI detected"
     41        return 1
     42}
     43
    2744set -o pipefail
    2845
    29 if ! test -z $1; then
     46HAVE_MPI=$(get_mpi)
     47
     48if [[ ! -z $1 ]]; then
    3049        FILE=$1
    3150else
    32         FILE=$HOME/machines
     51        FILE=${HOME}/machines-${HAVE_MPI}
    3352fi
    3453
    35 if test -f $FILE.lock; then
     54if [[ -f ${FILE}.lock ]]; then
    3655        exit
    3756else
    38         echo $$ > $FILE.lock
     57        echo $$ > ${FILE}.lock
    3958fi
    4059
    41 if ! test -z $2; then
     60trap "/bin/rm -f ${FILE}.lock" INT TERM EXIT ERR
     61
     62if [[ ! -z $2 ]]; then
    4263        MPI=$2
    4364fi
    4465
    45 if ! test -z $3; then
     66if [[ ! -z $3 ]]; then
    4667        C3CONF=$3
    4768else
     
    4970fi
    5071
    51 if test -f $FILE; then
    52         rm -f $FILE
     72if [[ -f ${FILE} ]]; then
     73        rm -f ${FILE}
    5374fi
    5475
    55 STAGE=`cat /etc/bccd-stage`
     76STAGE=$(cat /etc/bccd-stage)
    5677
    57 if test $STAGE = "LIVE"; then
     78if [[ ${STAGE} = "LIVE" ]]; then
    5879        DIR=/tmp/bccd/
    59         NODES=`find $DIR -mindepth 1 -maxdepth 1|grep -v \`hostname\`|sed -e "s!^$DIR!!g"`
    60         NODES="`hostname` $NODES"
    61 elif test $STAGE = "LIBERATED"; then
     80        NODES=$(find ${DIR} -mindepth 1 -maxdepth 1|grep -v \`hostname\`|sed -e "s!^${DIR}!!g")
     81        NODES="$(hostname) ${NODES}"
     82elif [[ ${STAGE} = "LIBERATED" ]]; then
    6283        DIR=/bccd/home/meta/nodes/
    63         NODES=`find $DIR -type f -cmin -2 -exec basename {} \;|grep -v node000`
    64         NODES="node000 $NODES"
     84        NODES=$(find ${DIR} -type f -cmin -2 -exec basename {} \;|grep -v node000)
     85        NODES="node000 ${NODES}"
    6586fi
    6687# Verify lock file is ours before continuing
    67 if test `head -1 $FILE.lock` -ne $$; then
     88if [[ $(head -1 ${FILE}.lock) -ne $$ ]]; then
    6889        exit
    6990fi
    7091
    71 for n in $NODES;do
     92for n in ${NODES};do
    7293        if ping -w 1 ${n} > /dev/null ; then
    73                 CPUCOUNT=`snmpget -OQv -c public -v 1 $n .1.3.6.1.4.1.2021.82.4.1.2.9.99.112.117.95.99.111.117.110.116.1|sed -e 's!"!!g'`
     94                CPUCOUNT=$(snmpget -OQv -c public -v 1 $n .1.3.6.1.4.1.2021.82.4.1.2.9.99.112.117.95.99.111.117.110.116.1|sed -e 's!"!!g')
    7495                RC=$?
    7596                if test ${RC} -ne 0; then
     
    7899                        exit ${RC}
    79100                fi
    80                 let HAVE_OPENMPI=HAVE_MPICH2=HAVE_LAM=1
    81                 if test -z $MPI; then
    82                         module list 2>&1|egrep -q '[[:space:]]openmpi\/'
    83                         HAVE_OPENMPI=$?
    84                         module list 2>&1|egrep -q '[[:space:]]mpich2\/'
    85                         HAVE_MPICH2=$?
    86                         module list 2>&1|egrep -q '[[:space:]]lam\/'
    87                         HAVE_LAM=$?
    88                 fi
    89101       
    90                 if test $HAVE_OPENMPI -eq 0 || test "$MPI" = "openmpi"; then
     102                if [[ ${HAVE_MPI} = "openmpi"
     103                        || ${MPI} = "openmpi" ]]; then
    91104                        echo "$n slots=$CPUCOUNT" >> $FILE
    92                 elif test $HAVE_MPICH2 -eq 0 || test "$MPI" = "mpich2"; then
     105                elif [[ ${HAVE_MPI} = "mpich2"
     106                        || ${MPI} = "mpich2" ]]; then
    93107                        echo "$n:$CPUCOUNT" >> $FILE
    94                 elif test $HAVE_LAM -eq 0 || test "$MPI" = "lam"; then
     108                elif [[ ${HAVE_MPI} = "mpich2"
     109                        || ${MPI} = "lam" ]]; then
    95110                        echo "$n cpu=$CPUCOUNT" >> $FILE
    96111                else
     
    102117done
    103118
    104 /bin/bccd-genc3 $C3CONF $FILE
    105 
    106 rm -f $FILE.lock
     119/bin/bccd-genc3 ${C3CONF} ${FILE}
  • bccd-ng/branches/skylar/bccd-3.1.1/trees/usr/local/etc/modules-remote/mpich2/1.4.1

    r3437 r3773  
    4747prepend-path    -d " " LDFLAGS             -L$MOD_MPICH2_DIR/lib/
    4848prepend-path    -d " " CPPFLAGS            -I$MOD_MPICH2_DIR/include/
    49 
    50 if { [catch { exec /bin/bccd-snarfhosts $env(HOME)/machines mpich2} msg] } {
    51         puts "bccd-snarfhosts failed: $::errorInfo"
    52 }
  • bccd-ng/branches/skylar/bccd-3.1.1/trees/usr/local/etc/modules/mpich2/1.4.1

    r3601 r3773  
    3737prepend-path    -d " " LDFLAGS             -L$MOD_MPICH2_DIR/lib/
    3838prepend-path    -d " " CPPFLAGS            -I$MOD_MPICH2_DIR/include/
    39 
    40 if { [catch { exec /bin/bccd-snarfhosts $env(HOME)/machines mpich2} msg] } {
    41         puts "bccd-snarfhosts failed: $::errorInfo"
    42 }
    43 
  • bccd-ng/branches/skylar/bccd-3.1.1/trees/usr/local/etc/modules/openmpi/1.4.5

    r3601 r3773  
    3737prepend-path    -d " " LDFLAGS             -L$MOD_OPENMPI_DIR/lib/
    3838prepend-path    -d " " CPPFLAGS            -I$MOD_OPENMPI_DIR/include/
    39 
    40 if { [catch { exec /bin/bccd-snarfhosts $env(HOME)/machines openmpi} msg] } {
    41         puts "bccd-snarfhosts failed: $::errorInfo"
    42 }
Note: See TracChangeset for help on using the changeset viewer.