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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Feb 17 14:33:16 CST 2011


Author: tga
Date: 2011-02-17 14:33:16 -0600 (Thu, 17 Feb 2011)
New Revision: 4114

Modified:
   SwiftApps/SwiftR/Swift/R/TestFramework.R
   SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
   SwiftApps/SwiftR/mxtests/swift/MakeTests.R
Log:
Properly handle performance params.


Modified: SwiftApps/SwiftR/Swift/R/TestFramework.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-17 18:05:36 UTC (rev 4113)
+++ SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-17 20:33:16 UTC (rev 4114)
@@ -20,7 +20,7 @@
 }
 
 makeParamTestGroup <- function (name, f, allargs,
-                setup=NULL, teardown=NULL) {
+                setup=NULL, teardown=NULL, perfparams=NULL) {
 
 
     buildClosure <- function (f, args) {
@@ -39,13 +39,14 @@
         test$args <- args # Store for later analysis
         test$passed <- NULL
         test$time <- NULL
+        test$perfparams <- perfparams
         tests[[length(tests) + 1]] <- test
     }
 
     return (makeTestGroup(name, tests, setup, teardown))
 }
 
-analysePerf <- function (testGroupResults, nargs=0) {
+analysePerf <- function (testGroupResults, nargs=0, perfparams=NULL) {
     # Build a list of vectors of performance results for easier analysis
     # [[1]] -> first arg
     # [[2]] -> second arg
@@ -71,13 +72,10 @@
                         function(test) {test$time }))
     
     # 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)
-            }
+    if (!is.null(perfparams)) {
+        for (pname in perfparams) {
+            collated[[pname]] <- unlist(lapply(testGroupResults$tests, 
+                        function(test) {test$perfparams[[pname]]} ))
         }
     }
     return (collated)

Modified: SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	2011-02-17 18:05:36 UTC (rev 4113)
+++ SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	2011-02-17 20:33:16 UTC (rev 4114)
@@ -149,7 +149,8 @@
     #swiftExportAll()
     submodels <- omxLapply(1:nReps, createNewModel, 'stErrSim', template)
     cat(length(submodels), "submodels created\n")
-    names(submodels) <- imxExtractNames(submodels)
+#    names(submodels) <- imxExtractNames(submodels)
+    names(submodels) <- omxExtractNames(submodels)
     topModel at submodels <- submodels
 
     return (topModel)

Modified: SwiftApps/SwiftR/mxtests/swift/MakeTests.R
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/MakeTests.R	2011-02-17 18:05:36 UTC (rev 4113)
+++ SwiftApps/SwiftR/mxtests/swift/MakeTests.R	2011-02-17 20:33:16 UTC (rev 4114)
@@ -44,17 +44,17 @@
         tg <- makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""),
             f=f,
             allargs=allargs,
-            perfparams <- params,
+            perfparams = params,
             setup=function() {swiftSetup(...)},
-            tearDown <- swiftTearDown)
+            teardown = swiftTearDown)
     }
     else if (mode == "snowfall") {
         tg <- makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""),
             f=f,
             allargs=allargs,
-            perfparams <- params,
+            perfparams = params,
             setup=function() {sfSetup(...)},
-            tearDown <- sfTearDown)
+            teardown = sfTearDown)
 
     }
     else {
@@ -62,7 +62,7 @@
         tg <- makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""),
             f=f,
             allargs=allargs,
-            perfparams <- list(),
+            perfparams = list(),
             setup=function() 
                 {try(detach(package:Swift)); try(detach(package:Snowfall))} )
     }




More information about the Swift-commit mailing list