⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpirun.pg_v2

📁 Path MPICH-V for MPICH the MPI Implementation
💻 PG_V2
字号:
#! /bin/sh##  MPICH-V2#  Copyright (C) 2002, 2003 Groupe Cluster et Grid, LRI, Universite de Paris Sud###  This file is part of MPICH-V2.##  MPICH-V2 is free software; you can redistribute it and/or modify#  it under the terms of the GNU General Public License as published by#  the Free Software Foundation; either version 2 of the License, or#  (at your option) any later version.##  MPICH-V2 is distributed in the hope that it will be useful,#  but WITHOUT ANY WARRANTY; without even the implied warranty of#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#  GNU General Public License for more details.##  You should have received a copy of the GNU General Public License#  along with MPICH-V2; if not, write to the Free Software#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA##  $Id: mpirun.pg_v2,v 1.1.1.1 2004/01/30 15:49:38 lemarini Exp $## This file is used to generate a xw-style procgroup file#external_allocate_cmd=""if [ -z "$argsset" ] ; then    mpirundir=`echo $0 | grep sed 's%/[^/][^/]*$%%'`    if [ -d "$mpirundir" ] ; then	. $mpirundir/mpirun.args    else	. mpirun.args    fifi#This function cuts the machine line into its argument and analyses them# depending on the flags set during arguments settingscutMachine() {    if [ -z "$machineString" ] ; then return ; fi    IFS=":"    set -- $machineString    hostName=$1    nprocs=$2    if [ -z "$nprocs" ] ; then nprocs="1" ; fi    capabilities=$3    if [ -n "$capabilities" ]; then	dc=`expr $capabilities : '.*\(&\||\).*'`	IFS="$dc"	set -- $capabilities	pel=$1	pcs=$2	if [ "$pel" = "+1" ] ; then pel=$pel_default ; fi	if [ "$pel" -ne "-1" -a "$pel" -le 1024 ] ; then	    echo "port $pel is reserved to privileged user, set to $pel_default"	    pel=$pel_default	fi	if [ "$pcs" = "+1" ] ; then pcs=$pcs_default ; fi	if [ "$pcs" -ne "-1" -a "$pcs" -le 1024 ] ; then	    echo "port $pcs is reserved to privileged user, set to $pcs_default"	    pcs=$pcs_default	fi		    	if [ "$dc" = "|" ] ; then dc="0" ; else dc="1" ; fi    else	if [ "$useExplicitELonly" -ne "1" ]; then	    pel=$pel_default	else	    pel="-1"	fi	if [ "$useExplicitCSonly" -ne "1" ]; then	    pcs=$pcs_default	else	    pcs="-1"	fi	dc="1"    fi}. ${MPIRUN_HOME}/mpirun.v2batch    # A bug in the GNU head causes "head -08 filename" to generate a bogus    # error message (it interprets 0xxx as octal).  Add 0 to the number    # as an easy way to eliminate any leading zeros.np2=`expr $npTotal + 0`if [ $nolocal = 0 -o $curarch -gt 1 ] ; then    machineavail=`cat $machineFile | \		sed -e '/^#/d' -e 's/#.*$//g' | head -${npTotal} | \		tr '\012' ' '`else    if [ $np2 -gt 1 -o $nolocal = 1 ] ; then            # Remove host from the list of available machines....	    # Thanks to Bjarne Herland for modification to 	    # remove EXACTLY the host machine (eg., bar and not bark)#	    machineavail=`cat $machineFile | sed -e '/^#/d' -e 's/#.*$//g' | \#		grep -v "^$MPI_HOST\([ -\.:]\)" | head -${np2} | tr '\012' ' '`		machineavail=`cat $machineFile | \		sed -e '/^#/d' -e 's/#.*$//g' -e "/^$MPI_HOST:/d" \		    -e "/^$MPI_HOST *\$/d" | head -${npTotal} | tr '\012' ' '`    else	machineavail=""    fifi    #    # The following enhancement thanks to Rick Niles of Scyld    # Remove exclude machines from list    if [ -n "$EXCLUDE" ] ; then	excludelist=`echo $EXCLUDE | sed 's/:/ /g'`	for exclude in $excludelist; do          newlist=""          for machine in $machineavail; do	    if [ "$machine" != "$exclude" ]; then 		newlist="$newlist $machine"	    fi          done	  machineavail=$newlist       done    fi    # Check for ALL_CPUS: this works fine also if there are capabilities    if [ -n "$ALL_CPUS" ]; then        np2=0	for machine in $machineavail; do	    smpcntpresent=`echo $machine | grep :`	    if [ -n "$smpcntpresent" ] ; then		num=`echo $machine | cut -f 2 -d:` 		np2=`expr $np2 + $num`	    else		np2=`expr $np2 + 1`	    fi	done    fi        #    # One final refinement.  We could make each job start with    # different processors with code like    #r=`date +%S`    #r=`expr 1 + $r / 10`    #m1=`echo $machineavail | cut -c $r- -d ' '`    #r=`expr $r - 1`    #m2=`echo $machineavail | cut -c 1-$r -d ' '`    #machineavail="$m1 $m2"    #    # Get the machine list for the job    # KeepHost suggested by Marc A. Viredaz; allows the same machine    # to be listed multiple times in the machines file.    # This will loop around the machines list until it    # finds enough machines (the nfound is used to detect infinite loops)    # Allow the host to be used if it is the only system found    #    KeepHost=0    loopcnt=0        procFound=0    nodeIdx=1    while [ "$procFound" -lt $np2 ] ; do        nfound=0        for machineString in $machineavail ; do	    # Split off the number of processors and the capabilities, if present	    cutMachine	    machinelist="$machinelist $hostName"	    eventLoggerPortList="$eventLoggerPortList $pel"	    dualCapabilityList="$dualCapabilityList $dc"	    checkpointServerPortList="$checkpointServerPortList $pcs"	    nprocuselist="$nprocuselist $nprocs"	    procFound=`expr $procFound + $nprocs`	    nfound=`expr $nfound + $nprocs`	    	    nodeIdx=`expr $nodeIdx + 1`            if [ $procFound -ge $np2 ] ; then break ; fi        done        nnodes=`expr $nodeIdx - 1`        loopcnt=`expr $loopcnt + 1`        # After the first time, we may have found no hosts BUT now        # allow KeepHost.          if [ $nfound = 0 -a $loopcnt -gt 1 ] ; then	    echo "Could not find enough machines for architecture $arch"	    exit 1        fi    done    curarch=`expr $curarch + 1`    procFound=0    nolocal=1    # At last, we take the available machines    nfound=0    usedNodes=4    security=""    IFS=" "    totalNodes=`expr $nodeIdx + $xwSecurityMargin`    completeMachineList=`sed -e '/^#/d' -e 's/#.*$//g' $machineFile \		     | head -${totalNodes} | tail -${xwSecurityMargin} | tr '\012' ' '`    for machine in $completeMachineList ; do	nfound=`expr $nfound + 1`	if [ "$nfound" -le "$usedNodes" ] ; then continue ; fi	if [ "$nfound" -gt "$totalNodes" ] ; then break ; fi	machineString="$machine"	security="$security $hostName:$nprocs:$pel:$pcs:$dc"    done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -