[Swift-commit] r4086 - in SwiftApps/SwiftR: Swift/R mxtests/swift

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Feb 11 15:07:52 CST 2011


Author: tga
Date: 2011-02-11 15:07:52 -0600 (Fri, 11 Feb 2011)
New Revision: 4086

Modified:
   SwiftApps/SwiftR/Swift/R/Bench.R
   SwiftApps/SwiftR/Swift/R/TestFramework.R
   SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
   SwiftApps/SwiftR/mxtests/swift/MakeTests.R
Log:
Continued improvements to performance testing 


Modified: SwiftApps/SwiftR/Swift/R/Bench.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Bench.R	2011-02-11 16:36:08 UTC (rev 4085)
+++ SwiftApps/SwiftR/Swift/R/Bench.R	2011-02-11 21:07:52 UTC (rev 4086)
@@ -34,35 +34,57 @@
 
 }
 
-id <- function () { return (1) }
+id <- function () { 
+    swiftLapply(rep(list(1), 100), 
+                    function (x) {x}) 
+}
 
 mkPerfTest <- function() {
     # Have an initial test that will block until
     # resources are ready
     warmUpGroup <- makeTestGroup(
         name="Wait for server to start",
-        tests=list(mkTest(id)))
+        tests=rep(list(mkTest(id)), 5))
 
     perfTestGroup1 <- makeParamTestGroup( 
         name="1 - basic performance test",
         f=sleeper,
         allargs=list(
-            list(1, 10),
-            list(1, 20),
-            list(1, 50),
-            list(1, 100),
-            list(2, 10),
-            list(2, 20),
-            list(2, 50),
-            list(2, 100),
-            list(3, 10),
-            list(3, 20),
-            list(3, 50),
-            list(3, 100),
-            list(4, 10),
-            list(4, 20),
-            list(4, 50),
-            list(4, 100)))
+            list(1, 8),
+            list(1, 16),
+            list(1, 32),
+            list(1, 48),
+            list(1, 64),
+            list(1, 96),
+            list(1, 128),
+            list(2, 8),
+            list(2, 16),
+            list(2, 32),
+            list(2, 48),
+            list(2, 64),
+            list(2, 96),
+            list(2, 128),
+            list(3, 8),
+            list(3, 16),
+            list(3, 32),
+            list(3, 48),
+            list(3, 64),
+            list(3, 96),
+            list(3, 128),
+            list(4, 8),
+            list(4, 16),
+            list(4, 32),
+            list(4, 48),
+            list(4, 64),
+            list(4, 96),
+            list(4, 128),
+            list(5, 8),
+            list(5, 16),
+            list(5, 32),
+            list(5, 48),
+            list(5, 64),
+            list(5, 96),
+            list(5, 128)))
     swiftTestSuite <- list(
             setup=function () { initSwiftTestOptions();
                                swiftInit() }, # swiftInit controlled via options
@@ -70,6 +92,7 @@
             teardown=function () { swiftShutdown() })
     return (swiftTestSuite)
 }
+
 doPerfTest <- function () {
     runTestSuite(mkPerfTest())
 }

Modified: SwiftApps/SwiftR/Swift/R/TestFramework.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-11 16:36:08 UTC (rev 4085)
+++ SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-11 21:07:52 UTC (rev 4086)
@@ -45,7 +45,7 @@
     return (makeTestGroup(name, tests, setup, teardown))
 }
 
-analysePerf <- function (testGroupResults, nargs) {
+analysePerf <- function (testGroupResults, nargs=0) {
     # Build a list of vectors of performance results for easier analysis
     # [[1]] -> first arg
     # [[2]] -> second arg
@@ -55,17 +55,32 @@
     # $passed 
     # $time
     collated <- list()
-    for (i in 1:nargs) {
-        collated[[i]] <- unlist(lapply(testGroupResults$tests, 
-                        function(test) {test$args[[i]]}))
+    if (nargs >= 1) {
+        for (i in 1:nargs) {
+            collated[[i]] <- unlist(lapply(testGroupResults$tests, 
+                            function(test) {test$args[[i]]}))
+        }
     }
+    n <- length(testGroupResults$tests)
+
     collated$name <- unlist(lapply(testGroupResults$tests, 
                         function(test) {test$name }))
     collated$passed <-unlist(lapply(testGroupResults$tests, 
                         function(test) {test$passed }))
     collated$time <- unlist(lapply(testGroupResults$tests, 
                         function(test) {test$time }))
-    return (collated)
+    
+    # Store the pnames as vectors
+    if (!is.null(testGroupResults$perfparams)) {
+        pnames <- names(testGroupResults$perfparams)
+        if (!is.na(pnames) && length(pnames) > 0) {
+            for (i in 1:length(pnames)) {
+                collated[[pnames[[i]]]] <- rep(testGroupResults$perfparams[[i]],
+                                n)
+            }
+        }
+    }
+    return (data.frame(collated))
 }
 
 
@@ -91,13 +106,16 @@
 printTestGroup <- function (group) {
     cat("\n*** Test group ", group$name, "***\n")
     resFmt <- function(res) { 
-        if (is.null(res)) {
-            "???"
-        } else {
-            if (inherits(res, "try-error")) 
-                {paste("ERROR: '", res, "'") }
-            else
-                {if (res) "PASSED" else "FAILED"}
+            if (is.null(res)) {
+                "???"
+            } else if (inherits(res, "try-error")) {
+                    paste("ERROR: '", res, "'") 
+            } else if (identical(res, TRUE)) {
+                    "PASSED" 
+            } else if (identical(res, FALSE)) {
+                    "FAILED"
+            } else {
+                    "<data>"
             }
         }
     timeFmt <- function (time) {
@@ -119,10 +137,12 @@
 runTestSuite <- function (suite) {
     if (!is.null(suite$setup))
         suite$setup()
-    resSuite <- lapply(suite$tests, runTestGroup)
+    resSuite <- suite
+    resSuite$tests <- lapply(suite$tests, runTestGroup)
+    
     if (!is.null(suite$teardown))
         suite$teardown()
 
-    lapply(resSuite, printTestGroup)
+    lapply(resSuite$tests, printTestGroup)
     return (resSuite)
 }

Modified: SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	2011-02-11 16:36:08 UTC (rev 4085)
+++ SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	2011-02-11 21:07:52 UTC (rev 4086)
@@ -23,20 +23,8 @@
 #cat("Running on hosts:", hostnames, "\n")
 
 
-main <- function () {
-    swiftLibrary(OpenMx)
 
-    swiftSess <- swiftSetup(server="local", cores=4)
 
-    nVar <- 75
-    nObs <- 10000
-    nReps <- 1024
-
-    perfExperiment(nVar, nObs, nReps)
-    swiftShutdown(swiftSess)
-}
-
-
 bootstrapTest <- function (nVar, nObs, nReps) {
     set.seed(10)
     topModel <- buildModels(nVar, nObs, nReps)
@@ -58,16 +46,26 @@
 #                list(75, 10000, 32))
 
 testArgs <- list(
-                list(75, 1000, 4),
-                list(75, 1000, 8),
-                list(75, 1000, 16),
-                list(75, 1000, 32))
+                list(75, 100, 4),
+                list(75, 100, 8),
+                list(75, 100, 16),
+                list(75, 100, 32),
+                list(75, 100, 64),
+                list(75, 100, 128),
+                list(75, 100, 256),
+                list(75, 100, 256 + 128),
+                list(75, 100, 512),
+                list(75, 100, 786),
+                list(75, 100, 1024),
+                list(75, 100, 1024 + 512),
+                list(75, 100, 2048 )
+                )
 
-makeBootstrapTestGroup <- function (...) {
+makeBootstrapTestGroup <- function (first=1, last=length(testArgs), ...) {
     makePerfTestGroup(
             name="BootstrapParallelBigger",
             f=bootstrapTest,
-            allargs=testArgs,
+            allargs=testArgs[first:last],
             ...  )
 }
 
@@ -160,8 +158,32 @@
 
 swiftTestSuite <- makeTestSuite(
     tests=list(
-       makeBootstrapTestGroup(mode="swift", server="local", cores=2), 
-       makeBootstrapTestGroup(mode="swift", server="local", cores=4), 
-       makeBootstrapTestGroup(mode="swift", server="ssh", cores=8, hosts="nettle antares deneb"),
-       makeBootstrapTestGroup(mode="serial")
+       # 16 cores
+       makeBootstrapTestGroup(mode="swift", server="ssh", cores=2, 
+            hosts=c("nettle", "wapato", "dandelion", "cattail", 
+                "chicory", "echinacea", "amaranth", "black-cohosh"),
+            first=3, last=5),
+       # 8 cores
+       makeBootstrapTestGroup(mode="swift", server="ssh", cores=2, 
+            hosts="nettle wapato dandelion cattail", 
+            first=2, last=5),
+       makeBootstrapTestGroup(mode="swift", server="local", cores=4,
+            last=4), 
+       makeBootstrapTestGroup(mode="swift", server="local", cores=2,
+            last=4), 
+       makeBootstrapTestGroup(mode="swift", server="local", cores=1,
+            last=2), 
+       makeBootstrapTestGroup(mode="swift", server="local", cores=1,
+            last=2), 
+       makeBootstrapTestGroup(mode="serial", last=2)
        ))
+
+padsTestSuite <- makeTestSuite(
+    tests=list(
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=1, nodes=1), 
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=8, nodes=1), 
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=8, nodes=2), 
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=8, nodes=3),
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=8, nodes=4),
+       makeBootstrapTestGroup(mode="swift", server="pbs", cores=8, nodes=5)
+       ))

Modified: SwiftApps/SwiftR/mxtests/swift/MakeTests.R
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/MakeTests.R	2011-02-11 16:36:08 UTC (rev 4085)
+++ SwiftApps/SwiftR/mxtests/swift/MakeTests.R	2011-02-11 21:07:52 UTC (rev 4086)
@@ -4,9 +4,12 @@
 swiftSetup <- function (...) {
     library(Swift)
     swiftSess <- swiftInit(...)
+    # Wait to start
+    Sys.sleep(10)
     # Run some small jobs to esnure workers are started and warmed up
-    swiftLapply(rep(1, swiftSess$cores * swiftSess$nodes * 2), 
-                function (x) { x })
+    swiftapply(function (x) { x }, 
+            rep(1, swiftSess$cores * swiftSess$nodes * 2),
+            callsperbatch=1)
     return (swiftSess)
 }
 
@@ -41,6 +44,7 @@
         tg <- makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""),
             f=f,
             allargs=allargs,
+            perfparams <- params,
             setup=function() {swiftSetup(...)},
             tearDown <- swiftTearDown)
     }
@@ -48,6 +52,7 @@
         tg <- makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""),
             f=f,
             allargs=allargs,
+            perfparams <- params,
             setup=function() {sfSetup(...)},
             tearDown <- sfTearDown)
 
@@ -57,6 +62,7 @@
         tg <- makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""),
             f=f,
             allargs=allargs,
+            perfparams <- list(),
             setup=function() 
                 {try(detach(package:Swift)); try(detach(package:Snowfall))} )
     }




More information about the Swift-commit mailing list