Changeset 3776 in /cluster/svnroot


Ignore:
Timestamp:
Jul 28, 2012 10:22:21 PM (8 years ago)
Author:
skylar
Message:

merging in new machines file generation (#480)

Location:
bccd-ng/trunk
Files:
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • bccd-ng/trunk

  • bccd-ng/trunk/trees/bin/bccd-snarfhosts

    r3244 r3776  
    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|sed -e "s%^${DIR}%%g")
     81        # Make sure my hostname is included
     82        if echo ${NODES} | grep -qv $(hostname); then
     83                NODES="$(hostname) ${NODES}"
     84        fi
     85elif [[ ${STAGE} = "LIBERATED" ]]; then
    6286        DIR=/bccd/home/meta/nodes/
    63         NODES=`find $DIR -type f -cmin -2 -exec basename {} \;|grep -v node000`
    64         NODES="node000 $NODES"
     87        NODES=$(find ${DIR} -type f -cmin -2 -exec basename {} \;)
     88        # Make sure node000 is included
     89        if echo ${NODES} | grep -qv node000; then
     90                NODES="node000 ${NODES}"
     91        fi
    6592fi
    6693# Verify lock file is ours before continuing
    67 if test `head -1 $FILE.lock` -ne $$; then
     94if [[ $(head -1 ${FILE}.lock) -ne $$ ]]; then
    6895        exit
    6996fi
    7097
    71 for n in $NODES;do
     98for n in ${NODES};do
    7299        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'`
     100                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')
    74101                RC=$?
    75102                if test ${RC} -ne 0; then
     
    78105                        exit ${RC}
    79106                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
    89107       
    90                 if test $HAVE_OPENMPI -eq 0 || test "$MPI" = "openmpi"; then
     108                if [[ ${HAVE_MPI} = "openmpi"
     109                        || ${MPI} = "openmpi" ]]; then
    91110                        echo "$n slots=$CPUCOUNT" >> $FILE
    92                 elif test $HAVE_MPICH2 -eq 0 || test "$MPI" = "mpich2"; then
     111                elif [[ ${HAVE_MPI} = "mpich2"
     112                        || ${MPI} = "mpich2" ]]; then
    93113                        echo "$n:$CPUCOUNT" >> $FILE
    94                 elif test $HAVE_LAM -eq 0 || test "$MPI" = "lam"; then
     114                elif [[ ${HAVE_MPI} = "mpich2"
     115                        || ${MPI} = "lam" ]]; then
    95116                        echo "$n cpu=$CPUCOUNT" >> $FILE
    96117                else
     
    102123done
    103124
    104 /bin/bccd-genc3 $C3CONF $FILE
    105 
    106 rm -f $FILE.lock
     125/bin/bccd-genc3 ${C3CONF} ${FILE}
  • bccd-ng/trunk/trees/usr/local/etc/modules-remote/mpich2/1.4.1

    r3437 r3776  
    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/trunk/trees/usr/local/etc/modules/mpich2/1.4.1

    r3676 r3776  
    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/trunk/trees/usr/local/etc/modules/openmpi/1.4.5

    r3673 r3776  
    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.