[SCore-users] PM and GM on one system

René Storm RStorm at deltacomputer.de
Thu Nov 28 20:00:35 JST 2002


Hi Folks,

I have made a little script which schwitchs between gm and pm.
I know its not nearly perfect, but it may help you to write a better
one.
It works fine in my enviroment.

Cya Rene

################################
#!/bin/bash
# 
# start and stop gm or score with this script
#
# by Rene Storm, DeltaComputer Products GmbH
# mailto: RStorm at DeltaComputer.de
# www.deltacomputer.de
#
#
# TODO: create in your NFS directory  a bashrc_none, a bashrc_score, a
bashrc_gm were you exported the right PATH
#	eg:PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/bin:/usr/X11R6/bin:/
usr/local/bin:/opt/score/bin:/opt/score/sbin:/opt/score/mpi/mpich-1.2.0/i
386-redhat7-linux2_4/bin/:/opt/score/bin:/root/bin:/opt/score/deploy"
#	export $PATH
#	for score 
#	
#	edit the prefix-line in GM_INSTALL to the absolut Path
#


#  General # 
INITD="/etc/init.d"
NODES="node01"									# ALL the Nodes, long lines are recommended 
USERS="root " 									# Users 
NFSDIR="/home/share"

usage       () 	{ echo  "Usage: $0 [score/gm] [start/stop]"  
		  exit 0 
		}


# SCORE #
MODPATH="/lib/modules/2.4.10-2SCORE/kernel/drivers/char"  			# Place of
the PM Modules
SCOREMODULES="pm_memory pm_shmem pm_myrinet"  			# order must be right,
max 9 modules, ether shmem and myri depends on pm_memory; add
pm_ethernet_dev if myrinet was too expensiv ;o(
SCORE_SERV_PROGS="scoreboard msgbserv  pbs_server pbs_sched pbs_mom"		#
the Score Server Proggies, don't forget pm_ethernet if lowcost omni not
included
SCORE_NODE_PROGS="scoutd pbs_mom"						# the Score Client Proggies,
don't forget pm_ethernet if lowcost  

# GM #
GMPATH="/usr/local/gm-1.5.1_Linux"
MAP_ARGS="map_once.args"



start_score () {
# Master
		for MODULE in $SCOREMODULES; do
		 insmod ${MODPATH}/${MODULE}.o
		done
		
		for PROG in $SCORE_SERV_PROGS; do
		 ${INITD}/${PROG} start
		done
		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 	cat  ${NFSDIR}/bashrc_score > ${HOMEPATH}/.bashrc 
		done
	
# Slaves
		for NODE in $NODES;do
		 	 for MODULE in $SCOREMODULES; do 
		  	  rsh $NODE "/sbin/insmod ${MODPATH}/${MODULE}.o"
                	 done

                	for NPROG in $SCORE_NODE_PROGS; do   
			 rsh $NODE " ${INITD}/${NPROG} start"
			done


		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		  	rsh $NODE "cat  ${NFSDIR}/bashrc_score > ${HOMEPATH}/.bashrc" 
		done

		done
		}


		
stop_score  () { 	
# Master

		for PROG in `echo $SCORE_SERV_PROGS |  awk '{print $9 " " $8 " " $7 "
" $6 " " $5 " " $4 " " $3 " " $2 " " $1}'`; do #stop backwards
                 ${INITD}/${PROG} stop
                done 

                 rmmod  `echo $SCOREMODULES | awk '{print $9 " " $8 " "
$7 " " $6 " " $5 " " $4 " " $3 " " $2 " " $1}'` #reload backwards

		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 	cat ${NFSDIR}/bashrc_none > ${HOMEPATH}/.bashrc   
		done

# Slaves

               
		for NODE in $NODES;do

		 	for NPROG in `echo $SCORE_NODE_PROGS |  awk '{print $9 " " $8 " " $7
" " $6 " " $5 " " $4 " " $3 " " $2 " " $1}'`; do   
			 rsh $NODE " ${INITD}/${NPROG} stop"
			done

		  	  rsh $NODE /sbin/rmmod  `echo $SCOREMODULES | awk '{print $9 " "
$8 " " $7 " " $6 " " $5 " " $4 " " $3 " " $2 " " $1}'` 


		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 	rsh $NODE "cat  ${NFSDIR}/bashrc_none > ${HOMEPATH}/.bashrc"
		done

		done

		}


# GM #

start_gm    () { 

 
# Master	
		${GMPATH}/binary/GM_INSTALL				
		
		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 	cat ${NFSDIR}/bashrc_gm > ${HOMEPATH}/.bashrc   
		done		
# Slave
		for NODE in $NODES; do 
		
			rsh $NODE "/sbin/insmod ${GMPATH}/binary/sbin/gm"
		
			for USER in ${USERS};do
				HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 		rsh $NODE "cat ${NFSDIR}/bashrc_gm > ${HOMEPATH}/.bashrc"
				rsh $NODE "/bin/mkdir ${HOMEPATH}/.gmpi"
				rcp ${HOMEPATH}/.gmpi/conf ${NODE}:${HOMEPATH}/.gmpi/conf
			done
		done
		 
 # Mapper	
		sleep 2
		${GMPATH}/binary/sbin/mapper  ${GMPATH}/binary/sbin/${MAP_ARGS} 
		
		}	

stop_gm	    () { 

# Master
		 killall mapper 2>/dev/null #only used for active.args or file.args
		 rmmod gm

 		for USER in ${USERS};do
			HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 	cat  ${NFSDIR}/bashrc_none > ${HOMEPATH}/.bashrc
		done
# Slave
		
		for NODE in $NODES; do 
		
			rsh $NODE "/sbin/rmmod gm"
		
			for USER in ${USERS};do
				HOMEPATH=`grep "^${USER}" /etc/passwd | cut -d ":" -f 6`
		 		rsh $NODE "cat ${NFSDIR}/bashrc_none > ${HOMEPATH}/.bashrc"
			done
		done			  

		}




case "$1" in
	score)
		case "$2" in

			start)
			 stop_gm >/dev/null 2>/dev/null
			 sleep 2	
			 start_score
		 	 bash
			 exit 0
			 ;;

			stop)
			 stop_score
			 exit 0
			 ;;

			*)	
			 usage
			 ;;
		esac	
	exit 0
	;;

	gm)
		case "$2" in

			start)
			 stop_score >/dev/null 2>/dev/null
			 sleep 2	
			 start_gm	
			 bash
			 exit 0
			 ;;

			stop)
			 stop_gm
			 exit 0
			 ;;

			*)	
			 usage
			 ;;
		esac
	exit 0
	;;
	*)
	usage
	;;
esac


#################

> -----Ursprüngliche Nachricht-----
>Von: 	score-users-request at pccluster.org
>[mailto:score-users-request at pccluster.org] 
>Gesendet:	Donnerstag, 28. November 2002 04:00
>An:	score-users at pccluster.org
>Betreff:	SCore-users digest, Vol 1 #134 - 8 msgs
>
> << Datei: ATT00261.txt; charset = iso-2022-jp >> 



More information about the SCore-users mailing list