[Swift-commit] r3979 - in SwiftApps/SwiftR/Swift: R exec

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Jan 17 15:22:52 CST 2011


Author: wilde
Date: 2011-01-17 15:22:52 -0600 (Mon, 17 Jan 2011)
New Revision: 3979

Modified:
   SwiftApps/SwiftR/Swift/R/Swift.R
   SwiftApps/SwiftR/Swift/exec/rserver.swift
   SwiftApps/SwiftR/Swift/exec/start-swift
Log:
changed ack to request fifo from app() to fprintf(). Added first perf test. Improvements to start-swift.

Modified: SwiftApps/SwiftR/Swift/R/Swift.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Swift.R	2011-01-17 20:35:11 UTC (rev 3978)
+++ SwiftApps/SwiftR/Swift/R/Swift.R	2011-01-17 21:22:52 UTC (rev 3979)
@@ -273,6 +273,37 @@
   }
 }
 
+# Performance tests
+
+swiftTest_6.1 <- function(delay,ncalls)
+{
+  options(swift.initialexpr="initVar3 <<- 123; initVar4 <<- 100");
+
+  timed <- function(delay) { Sys.sleep(delay); delay }
+
+  args=list(delay)
+  arglist = rep(list(args),ncalls)
+
+  cat("\nTest of swiftapply(delay,arglist)\n")
+
+  startTime = proc.time()[["elapsed"]]
+  swiftres = swiftapply(timed,arglist)
+  endTime = proc.time()[["elapsed"]]
+  runTime <- endTime - startTime
+
+  cat("\n\n ===> Total elapsed unit test time = ",runTime," seconds.\n\n") 
+
+  cat("Swift result:\n")
+  print(swiftres[[1]])
+
+  if(identical(delay,swiftres[[1]])) {
+    cat("\n==> test 6.1 passed\n")
+  } else {
+    cat("\n==> test 6.1 FAILED !!!!!\n")
+  }
+
+}
+
 runAllSwiftTests <- function()
 {
 

Modified: SwiftApps/SwiftR/Swift/exec/rserver.swift
===================================================================
--- SwiftApps/SwiftR/Swift/exec/rserver.swift	2011-01-17 20:35:11 UTC (rev 3978)
+++ SwiftApps/SwiftR/Swift/exec/rserver.swift	2011-01-17 21:22:52 UTC (rev 3979)
@@ -52,7 +52,7 @@
   # FIXME: read swiftserver dir via @args
 
   dir = readData(requestPipeName); # Reads direct from this local pipe. Assumes Swift started in right dir.
-  trace("rserver: got dir", dir);
+  # trace("rserver: got dir", dir);
 
   external wait[];
   wait = apply(dir);
@@ -64,6 +64,8 @@
   #  want: tracef("%k completed\n", "my/responsepipe.fifo", wait);
   #  %k waits for wait to be fully closed; then sends formatted string to specified file(doing open, write, close).
 
-  ack(wait);
+  // ack(wait);
 
+  fprintf(resultPipeName, "%kdone\n", wait);
+
 } until (done);

Modified: SwiftApps/SwiftR/Swift/exec/start-swift
===================================================================
--- SwiftApps/SwiftR/Swift/exec/start-swift	2011-01-17 20:35:11 UTC (rev 3978)
+++ SwiftApps/SwiftR/Swift/exec/start-swift	2011-01-17 21:22:52 UTC (rev 3979)
@@ -48,7 +48,7 @@
        # fixme:send worker.pl to remote host via stdin or scp.
        ssh $host /bin/sh -c \'"mkdir -p $LOGDIR"\'
        scp $SWIFTBIN/worker.pl $host:$LOGDIR
-       ssh $host '/bin/sh -c '\'"WORKER_LOGGING_ENABLED=true $LOGDIR/worker.pl $CONTACT $ID $LOGDIR $IDLETIMEOUT 2>&1 & echo PID=\$!"\'  >remotepid.$host </dev/null &
+       ssh $host '/bin/sh -c '\'"WORKER_LOGGING_LEVEL=$workerLogging $LOGDIR/worker.pl $CONTACT $ID $LOGDIR $IDLETIMEOUT 2>&1 & echo PID=\$!"\'  >remotepid.$host </dev/null &
        sshpids="$sshpids $!"
   done
 
@@ -74,7 +74,7 @@
 #PBS -o $HOME
 #PBS -e $HOME
 $queueDirective
-WORKER_LOGGING_ENABLED=true # FIXME: parameterize; fix w PBS -v
+export WORKER_LOGGING_LEVEL=$workerLogging # FIXME: parameterize; fix w PBS -v
 #cd / && /usr/bin/perl $SWIFTBIN/worker.pl $CONTACT SwiftR-workers $HOME/.globus/coasters $IDLETIMEOUT
 HOST=\$(echo $CONTACT | sed -e 's,^http://,,' -e 's/:.*//')
 PORT=\$(echo $CONTACT | sed -e 's,^.*:,,')
@@ -112,7 +112,7 @@
 #PBS -o $HOME
 #PBS -e $HOME
   $queueDirective
-  WORKER_LOGGING_ENABLED=true # FIXME: parameterize; fix w PBS -v
+  export WORKER_LOGGING_LEVEL=$workerLogging # FIXME: parameterize; fix w PBS -v
   HOST=\$(echo $CONTACT | sed -e 's,^http://,,' -e 's/:.*//')
   PORT=\$(echo $CONTACT | sed -e 's,^.*:,,')
   CONTACT=http://localhost:\$PORT
@@ -143,8 +143,6 @@
 
 # FIXME: for big systems like Ranger, need to use ssh_tree to avoid socket FD exhastion?
 
-echo def make-sge-submit-file
-
 make-sge-submit-file()
 {
   if [ $queue != NONE ]; then
@@ -177,7 +175,7 @@
 $queueDirective
 $projectDirective
 
-# $ -v WORKER_LOGGING_LEVEL=NONE
+# $ -v WORKER_LOGGING_LEVEL=$workerLogging
 
 # Ranger Site-specific:
 # $ -pe 16way 256
@@ -225,13 +223,6 @@
   echo Started workers from batch job $(cat $jobidfile)
 }
 
-usage()
-{
-  echo >&2 "usage: $0 -c cores -h 'host1 ... hostN' -n nodes -q queue -s server -p parallelJobs -t walltime"
-  echo >&2 "  valid servers: local, ssh, pbs, pbsf (for firewalled worker nodes), sge"
-  echo >&2 "  defaults:  cores=2 nodes=1 queue=none server=local parallelJobs=10 walltime=00:30:00 (hh:mm:ss)"
-}
-
 verify-is-one-of()
 {
   argname=$1
@@ -271,6 +262,40 @@
   fi
 }
 
+usage()
+{
+  cat <<END
+ 
+   usage: start-swift -s server -n nodes -c cores \\
+                      -h 'host1 ... hostN' -q queue -p throttle -t walltime \\
+                      -m mode -r rcmd -A project -e parallelEnvironment
+
+   Argument    Default     Valid Values
+
+   -A project              site-specific
+   -c cores    2,4,5       >= 1 (default is: local 2; ssh 4; cluster 8)
+   -e parEnv               site specific, SGE only
+   -h hosts    1           list of hosts, quoted as one argument, space separated
+   -m workmode node        node: start one worker for all slots on a node; slot (one worker on each slot)
+   -n nodes    1
+   -p throttle 10          >= 1
+   -q queue                site speific (PBS, SGE)
+   -r rcmd     ssh         site specific, SGE only, typically ssh. qrsh for siraf cluster
+   -s server   local       local, pbs, sge, ssh, pbsf (for firewalled worker nodes)
+   -t time     00:30:00    hh:mm:ss, for PBS and SGE only
+   -w wkloglvl NONE        NONE, ERROR, WARN, INFO, DEBUG, TRACE
+
+    Examples:
+
+    Local:  start-swift -c 4
+    ssh:    start-swift -s ssh -c 8 -h "crush stomp thwomp"
+    PBS:    start-swift -s pbs -c 8 -n 4 -A CI-87654 -q short -t "02:00:00"
+    SGE:    start-swift -s sge -c 8 -n 4 -A CI-87654 -q short -t "02:00:00" -m node -e smp
+    siraf:  start-swift -s sge -c 8 -n 4 -A CI-87654 -q bigmem.q -t "02:00:00" -m node -e shm -r qrsh
+
+END
+}
+
 # main script
 
 tmp=${SWIFTR_TMP:-/tmp}
@@ -283,14 +308,16 @@
 queue=short
 #throttleOneCore="-0.001"  FIXME: Remove
 #throttleOneCore="0.00"    FIXME: Remove
-localcores=5
 cores=0
-defaultCores=4
+defaultLocalCores=2
+defaultSshCores=4
+defaultClusterCores=8
 throttle=10
 hosts=no-hosts-specified
 queue=NONE
 project=NONE
 parEnv=NONE
+workerLogging=ERROR
 
 rcmd=ssh      # rcmd: ssh (typical) or qrsh (eg for siraf with node login restrictions)
 workmode=slot # slot: start one worker on each slot; node: start one worker for all slots on a node
@@ -309,13 +336,12 @@
     -r) rcmd=$2; verify-is-one-of rcmd $rcmd ssh qrsh; shift ;;
     -s) server=$2; verify-is-one-of server $server local ssh pbs pbsf sge; shift ;;
     -t) time=$2; verify-not-null time $time; shift ;;
+    -w) workerLogging=$2; verify-is-one-of workerLoggingLevel $workerLogging NONE ERROR WARN INFO DEBUG TRACE; shift ;;
     *)  usage; exit 1 ;;
   esac
   shift
 done
 
-echo project=$project cores=$cores nodes=$nodes queue=$queue server=$server throttle=$throttle
-
 SWIFTRBIN=$(cd $(dirname $0); pwd)
 SWIFTBIN=$SWIFTRBIN/../swift/bin  # This depends on ~/SwiftR/Swift/swift being a symlink to swift in RLibrary/Swift
 
@@ -346,13 +372,20 @@
 
 if [ $server = local ]; then
 
+  if [ $cores -eq 0 ]; then
+    cores=$defaultLocalCores
+  fi
+  echo project=$project cores=$cores nodes=$nodes queue=$queue server=$server throttle=$throttle
+
+
   source $SWIFTRBIN/configure-server-local $cores
 
 elif [ $server = ssh ]; then
 
   if [ $cores -eq 0 ]; then
-    cores=$defaultRemoteCores
+    cores=$defaultSshCores
   fi
+  echo project=$project cores=$cores nodes=$nodes queue=$queue server=$server throttle=$throttle
 
   source $SWIFTRBIN/configure-server-ssh $cores $time
 
@@ -384,6 +417,11 @@
 
 elif [ \( $server = pbs \) -o \( $server = pbsf \) -o \( $server = sge \) ]; then
 
+  if [ $cores -eq 0 ]; then
+    cores=$defaultClusterCores
+  fi
+  echo project=$project cores=$cores nodes=$nodes queue=$queue server=$server throttle=$throttle
+
   source $SWIFTRBIN/configure-server-${server} $cores
 
   jobidfile=${out/stdouterr/jobid}




More information about the Swift-commit mailing list