home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / cray / 349 < prev    next >
Encoding:
Text File  |  1993-01-21  |  11.5 KB  |  406 lines

  1. Newsgroups: comp.unix.cray
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!ggawboy
  3. From: ggawboy@magnus.acs.ohio-state.edu (Galen F Gawboy)
  4. Subject: Re: Where do you put the home directories!
  5. Message-ID: <1993Jan22.010906.14303@magnus.acs.ohio-state.edu>
  6. Sender: news@magnus.acs.ohio-state.edu
  7. Nntp-Posting-Host: bottom.magnus.acs.ohio-state.edu
  8. Organization: The Ohio State University
  9. References: <1993Jan21.172943.19698@chpc.utexas.edu> <1993Jan21.191239.14872@Virginia.EDU>
  10. Date: Fri, 22 Jan 1993 01:09:06 GMT
  11. Lines: 393
  12.  
  13. In article <1993Jan21.191239.14872@Virginia.EDU> skg2v@Virginia.EDU ("Sharad Gandhi") writes:
  14. >When I was working on PSC Cray Y/MP. I was able to come up with
  15. >a different jobfile to run jobs on CRAY without telnet'ing and
  16. >ftp'ing from your local machine. The primary requirement is
  17. >that your local machine should support remote command such as
  18. >rsh, rcp etc. If it does then do following:
  19. >
  20. >1. open a .rhosts file on your local machine and add the
  21. >following line:
  22. >
  23. >pscymp.psc.edu <your-user-id-on-cray>
  24. >
  25. >2. open a .rhosts file in your cray account with the following
  26. >line:
  27. >
  28. ><address of your local machine> <your user id on local machine>
  29. >
  30. >4. to run submit job on cray:
  31. >
  32. >rcp a.nqs <cra-id>@pscymp.psc.edu:<directory> 
  33. >rsh pscymp.psc.edu -l <cray-id> <job-submit-command> a.nqs
  34. >
  35. >See if it works and help you in saving your time.
  36. >
  37. >sharad
  38.  
  39.  Or better yet you may want to use craysub. This script will also send you
  40. an email message on your home machine when the job is done. It requires the
  41. existance of a crayqueues file which varies from site to site. For example if
  42. you often use use two queues, fourmegb and universe the crayqueues file would
  43. be:
  44.  
  45. cat> crayqueues <<\eof
  46. LOCALNAME QNAME  MEM  CPU
  47. fourmegb  fourmeg 4Mw 5000
  48. universe  universe 32Mw 26000
  49. eof
  50.  
  51. It also requires the existence of a .temparms file, which specifies the 
  52. pathnames on the cray. A sample .parms file is:
  53.  
  54. cat > .parms <<\ eof
  55. #
  56. #  Variables used on the cray.
  57. #
  58. set -ka
  59. PATH=/where/my/executables/live ; export PATH
  60. TEMPPATH=/where/my/huge/intermediate/files/will/be
  61. FORTOUT=$TEMPPATH/$$.out
  62. export TEMPPATH FORTOUT 
  63. #
  64. #  Test for and create,if necessary, various directories used
  65. #  on the cray.
  66. #
  67. if test -d $TEMPPATH
  68. then
  69.     :            # some times you might want to clean this directory.
  70. else
  71.     mkdir $TEMPPATH
  72. fi
  73. cd $TEMPPATH
  74. set +v
  75. eof
  76.  
  77. The usage would be
  78.  
  79. m4 jcl | craysub -b .parms -q universe -r bj -o bj.out -T 12000 -M 22Mw
  80.  
  81.   The jcl file would be the same jcl you would use on for your typical job.
  82.  
  83.   The shell script was originally written by Eric Stahlberg. It has since
  84. been modified by Bob Zellmer, Gary Kedziora, and to an extremely minor extent
  85. myself. Hope someone finds this helpful.
  86.  
  87. -Regards
  88.  
  89. Galen
  90.  
  91. (snip here) 8-<--------------------------------------------------------------
  92. #! /bin/sh
  93. #
  94. # created 1/4/89 Eric Stahlberg
  95. # updated 20/nov/90 Eric Stahlberg
  96. #
  97. # This is an experimental script to modify a given
  98. # shell script to be able to run under NQS on the OSC Cray
  99. #
  100. # Various shell variables set
  101. crayuser=$CRAYUSER      # cray userid
  102. craypass=$CRAYPASS      # cray passwd
  103. jobname=$USER           # job name -- default to sun userid
  104. cpulim="T 20"           # time limit -- default to 20 sec
  105. timeset=0               # flag indicating explicit time set
  106. memlim="m 2Mw"          # memory limit
  107. memset=0                # flag indicating explicit memory set
  108. nqslog=NQS.LOG$$        # default to keep login output
  109. scriptfile=NQS.OUT$$    # script output run through nasa
  110. sunfile=`pwd`/'$QSUB_REQID' # default file name
  111. setopt=akx              # default set options
  112. beforefile=/dev/null    # file to include as first executed by NQS
  113. afterfile=/dev/null     # file to include as last processed by NQS
  114. frontend=`hostname`.mps.ohio-state.edu
  115. device=`tty`
  116. nqsstream=nqs.$$
  117. craysubtmp=/tmp/craysub$$
  118. queuelist=/usr/local/localadm/bin/crayqueues
  119. #
  120. if [ -n "$QUEUEFILE" ] ; then
  121.    qfile=$QUEUEFILE
  122. else
  123.    qfile=$queuelist
  124. fi
  125. #
  126. # Notice that the queue will specified to express by default on the time
  127. # Variables CRAYUSER CRAYPASS are set by the user and exported.
  128. # USER is a shell system variable.
  129. #
  130. # preprocess command line
  131. lineopts="$*"
  132. set -- `getopt edfnzZs:l:u:p:r:t:T:m:M:o:q:a:b:c $lineopts`
  133. if [ $? != 0 ] ; then
  134.    echo "Incorrect options specified"
  135.    exit 1
  136. fi
  137. for opt in $* ; do
  138.     case "$opt"
  139.     in
  140.     -d | -e | -f | -n | -z | -Z | -c ) shift 1;;
  141.     -s | -l | -u | -p | -r | -t | -m | -T | -M ) shift 2 ;;
  142.     -o | -q | -a | -b ) shift 2 ;;
  143.     -- ) shift ; break;;
  144.     esac
  145. done
  146. #
  147. # check for suffix .m4 on files to run macro preprocessor
  148. # from /usr/5bin
  149. if [ -f $1.m4 ] ; then
  150.   /usr/5bin/m4 $1.m4 >> $craysubtmp
  151. else
  152.   if [ `expr "$1" : ".*\.m4" ` -ne 0 ] ; then
  153.      /usr/5bin/m4 $1 >> $craysubtmp
  154.   else
  155.      cat $1 > $craysubtmp
  156.   fi
  157. fi
  158. defaults=`egrep '#craysub' $craysubtmp | head -1 |cut -c9-`
  159. lineopts=" $CRAYOPTS $defaults $lineopts"
  160. echo craysub  $lineopts
  161. # check various flags
  162. set -- `getopt edfnZzs:l:u:p:r:t:T:m:M:o:q:a:b:c $lineopts`
  163. if [ $? != 0 ] ; then
  164.    echo "usage error"
  165.    exit 1
  166. fi
  167. #
  168. for opt in $* ; do
  169.     case "$opt"
  170.     in
  171.         -c ) colparms=yes;
  172.              if [ ! -f $HOME/.colparms ] ; then
  173.                echo " No .colparms file in " $HOME
  174.                exit  1
  175.              fi
  176.              shift ;;
  177.         -d ) nqslog=/dev/null; shift ;;
  178.         -e ) echocode=yes; shift;;
  179.         -f ) delfortout=yes; shift;;
  180.         -n ) dest=">/dev/null"; shift ;;
  181.         -Z ) if [ "$zapme" != "yes" ] ; then
  182.                 zapme="yes"
  183.              else
  184.                 zapme="no"
  185.              fi
  186.              shift;;
  187.         -z ) if [ "$mailme" != "yes" ] ; then
  188.                 mailme="yes"
  189.              else
  190.                 mailme="no"
  191.              fi
  192.              shift;;
  193.         -a ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  194.               echo "specify last execute file. "
  195.               exit 1
  196.             else
  197.               if [ `expr "$2" : "/.*"` -eq 0 ] ; then
  198.                 afterfile=`pwd`/$2
  199.               else
  200.                 afterfile=$2
  201.               fi ;
  202.              fi ; shift 2;;
  203.         -b ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  204.               echo "specify first execute file. "
  205.               exit 1
  206.             else
  207.               if [ `expr "$2" : "/.*"` -eq 0 ] ; then
  208.                 beforefile=`pwd`/$2
  209.               else
  210.                 beforefile=$2
  211.               fi
  212.              fi ; shift 2;;
  213.         -s ) if [ `expr "$2" : "-.*` -ne 0 ] ; then
  214.                echo "specify set parms"
  215.                exit 1
  216.              else
  217.                setopt="$2"
  218.              fi ;  shift 2;;
  219.    -u | -l ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  220.               echo "specify cray userid. "
  221.               exit 1
  222.             else
  223.               crayuser="$2"
  224.             fi ; shift 2;;
  225.         -p) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  226.               echo "specify cray password."
  227.               exit 1
  228.             else
  229.               craypass="$2"
  230.             fi ; shift 2;;
  231.         -r ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  232.               echo "specify cray jobname."
  233.               exit 1
  234.             else
  235.               jobname="$2"
  236.             fi ; shift 2 ;;
  237.         -T ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  238.               echo "specify cray cputime. "
  239.               exit 1
  240.             else
  241.               if [ `expr "$2" : "[0-9]*"` -eq 0 ] ; then
  242.                  echo "Invalid time specification."
  243.                  exit 1
  244.               else
  245.                    timeset=1
  246.                    cpulim="T $2"
  247.               fi
  248.             fi ; shift 2;;
  249.         -t ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  250.               echo "specify cray per process cputime. "
  251.               exit 1
  252.             else
  253.               if [ `expr "$2" : "[0-9]*"` -eq 0 ] ; then
  254.                  echo "Invalid time specification."
  255.                  exit 1
  256.               else
  257.                    timeset=1
  258.                    cpulim="t $2"
  259.               fi
  260.             fi ; shift 2;;
  261.         -M ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  262.               echo "specify cray memory limit. "
  263.               exit 1
  264.             else
  265.               if [ `expr "$2" : "[0-9]*.*"` -eq 0 ] ; then
  266.                  echo "Invalid memory specification."
  267.                  exit 1
  268.               else
  269.                    memset=1
  270.                    memlim="M $2"
  271.               fi
  272.             fi; shift 2;;
  273.         -m ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  274.               echo "specify cray per process memory limit. "
  275.               exit 1
  276.             else
  277.               if [ `expr "$2" : "[0-9]*.*"` -eq 0 ] ; then
  278.                  echo "Invalid memory specification."
  279.                  exit 1
  280.               else
  281.                    memlim="m $2"
  282.                    memset=1
  283.               fi
  284.             fi; shift 2;;
  285.         -o ) if [ `expr "$2" : "-.*"` -ne 0 ] ; then
  286.               echo "specify output file. "
  287.               exit 1
  288.             else
  289.               if [ `expr "$2" : "/.*"` -eq 0 ] ; then
  290.                 sunfile=`pwd`/$2
  291.               else
  292.                 sunfile=$2
  293.               fi
  294.             fi ; shift 2;;
  295.          -q ) if [ `egrep -c "$2" $qfile` -eq 0 ] ; then
  296.                 echo "Invalid queue specification"
  297.                 exit 1
  298.               else
  299.                qinfo=`egrep "$2" $qfile | head -1 `
  300.                qname=`echo $qinfo | cut -f2 -d" "`
  301.                if [ $memset -eq 0 ] ; then
  302.                  memlim=`echo $qinfo | cut -f3 -d" "`
  303.                  memlim="m $memlim"
  304.                fi
  305.                if [ $timeset -eq 0 ] ; then
  306.                  cpulim=`echo $qinfo | cut -f4 -d" "`
  307.                  cpulim="t $cpulim"
  308.                fi
  309.               fi
  310.               shift 2 ;;
  311.         -- ) shift; break
  312.       esac
  313. done
  314. echo "# user=$crayuser pw=$craypass
  315. #QSUB-r $jobname
  316. #QSUB-eo
  317. #QSUB-l$cpulim
  318. #QSUB-l$memlim" > $nqsstream
  319. if [ -n "$qname" ] ; then
  320.   echo "#QSUB-q $qname" >> $nqsstream
  321. fi
  322. echo "#QSUB-o $nqslog
  323. #QSUB-nr" >> $nqsstream
  324. # insert pre execute file
  325. cat $beforefile >> $nqsstream
  326. # execute .colparms if necessary
  327. if [ "$colparms" = "yes" ] ; then
  328. #  echo ".colparms" >> $nqsstream
  329. cat $HOME/.colparms >> $nqsstream
  330. fi
  331. #echo "(
  332. echo "sh <<\EOF--sh--craysub 2>&1 | nasa >> $scriptfile
  333. ja
  334. date
  335. logname
  336. hostname
  337. echo \" \$QSUB_REQID queue info cpulim=$cpulim memlim=$memlim \"  " >> $nqsstrea
  338. m
  339. #
  340. if [ -n "$setopt" ] ; then
  341.  echo "set -$setopt " >> $nqsstream
  342. fi
  343. # place commands into jobstream
  344.   cat $craysubtmp >> $nqsstream
  345.   rm $craysubtmp
  346. #
  347. if [ -n "$setopt" ] ; then
  348.  echo "set +$setopt" >> $nqsstream
  349. fi
  350. echo "ja -st
  351. EOF--sh--craysub
  352. #) 2>&1 | nasa >> $scriptfile
  353. echo " " >> $scriptfile
  354. cat \$FORTOUT >> $scriptfile
  355. mv $scriptfile \$FORTOUT" >> $nqsstream
  356. #
  357. #
  358. echo "cat >ftp.xfer <<ENDFTP
  359. user $USER $SUNPASS
  360. status
  361. put \$FORTOUT $sunfile
  362. bye
  363. ENDFTP
  364. ftp -n $frontend < ftp.xfer
  365. rm ftp.xfer " >> $nqsstream
  366. #
  367. #
  368. # remove $FORTOUT if requested
  369. if [ "$delfortout" = "yes" ] ; then
  370.   echo "rm \$FORTOUT" >> $nqsstream
  371. fi
  372. #
  373. # insert post execute file in jobstream
  374. cat $afterfile >> $nqsstream
  375. # check for mailback response
  376. if [ "$mailme" = "yes" ] ; then
  377. cat >> $nqsstream <<ENDMAIL
  378.  echo " OSCA JOB $jobname [\$QSUB_REQID]
  379. returned to file $sunfile" | \
  380.  mail  $USER@$frontend
  381. ENDMAIL
  382. fi
  383. # check for zap response to job completion
  384. if [ "$zapme" = "yes" ] ; then
  385. cat >> $nqsstream <<ENDZAP
  386.   remsh $frontend -l $USER \
  387.   "echo ^G +++ [\$QSUB_REQID] $jobname complete. +++ > $device "
  388. ENDZAP
  389. fi
  390. #
  391. if [ "$echocode" = "yes" ] ; then
  392. cat $nqsstream
  393. rm $nqsstream
  394. else
  395.  eval echo "Submitting job to the cray" $dest
  396.  eval rcp $nqsstream $CRAYUSER@osca.osc.edu:$nqsstream
  397.  eval rsh osca -l $CRAYUSER -n qsub $nqsstream $dest
  398.  eval rsh osca -l $CRAYUSER -n rm $nqsstream
  399.  eval echo "Job submitted"   $dest
  400.  rm $nqsstream
  401. fi
  402.  
  403.  
  404.  
  405.  
  406.