[mlpack-svn] r15267 - mlpack/conf/jenkins-conf/benchmark

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jun 19 17:04:21 EDT 2013


Author: marcus
Date: 2013-06-19 17:04:21 -0400 (Wed, 19 Jun 2013)
New Revision: 15267

Modified:
   mlpack/conf/jenkins-conf/benchmark/benchmark.py
Log:
Add options support.

Modified: mlpack/conf/jenkins-conf/benchmark/benchmark.py
===================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark.py	2013-06-19 21:02:27 UTC (rev 15266)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark.py	2013-06-19 21:04:21 UTC (rev 15267)
@@ -24,6 +24,69 @@
 
 from optparse import OptionParser
 
+def SystemInformation():
+	# Show system informations.
+	Log.Info('CPU Model: ' + SystemInfo.GetCPUModel())
+	Log.Info('Distribution: ' + SystemInfo.GetDistribution())
+	Log.Info('Platform: ' + SystemInfo.GetPlatform())
+	Log.Info('Memory: ' + SystemInfo.GetMemory())
+	Log.Info('CPU Cores: ' + SystemInfo.GetCPUCores())
+
+def Main():
+	# Read Config.
+	config = Parser('config.yaml')
+
+	# Iterate through all libraries.
+	libraryMapping = config.GetConfigLibraryMethods()
+	while libraryMapping:	
+
+		# Iterate through all methods.
+		methodMapping = config.GetConfigMethod(libraryMapping.methods)			
+		while methodMapping and libraryMapping:
+
+			# Load script.
+			module = Loader.ImportModuleFromPath(methodMapping.script)
+			methodCall = getattr(module, methodMapping.methodName)
+
+			for dataset in methodMapping.datasets:
+
+				#! TEMPORARY
+				# Create table.
+				table = []
+				# set table header.
+				header = ['', libraryMapping.libraryName, 'matlab', 'shougun']
+				table.append(header)		
+
+				Log.Info('Options: ' + (dataset["options"] if dataset["options"] != '' else 'None'))
+
+				for files in dataset["files"]:
+
+					row = ['-'] * 4;
+					# Get dataset name.
+					row[0] = os.path.splitext(os.path.basename(files))[0]
+
+					Log.Info('Dataset: ' + row[0])
+
+					time = 0
+					for num in range(methodMapping.iteration):
+						instance = methodCall(files, verbose=False)
+						time += instance.RunMethod(dataset["options"]);
+
+						# Call the destructor.
+						del instance
+
+					# Set time.
+					row[1] = time / methodMapping.iteration
+					table.append(row)
+
+				# Show results in a table.
+				Log.Notice('')
+				Log.PrintTable(table)
+				Log.Notice('')
+
+			methodMapping = config.GetConfigMethod(libraryMapping.methods)
+		libraryMapping = config.GetConfigLibraryMethods()
+
 if __name__ == '__main__':
 	parser = OptionParser(usage="usage: %prog [options] filename")
 	parser.add_option("-t", "--test", action="store", dest="config",
@@ -35,57 +98,5 @@
 		config = Parser(options.config)
 		config.CheckConfig()
 	else:
-		# Read Config.
-		config = Parser('config.yaml')
-
-		# Show system informations.
-		Log.Info('CPU Model: ' + SystemInfo.GetCPUModel())
-		Log.Info('Distribution: ' + SystemInfo.GetDistribution())
-		Log.Info('Platform: ' + SystemInfo.GetPlatform())
-		Log.Info('Memory: ' + SystemInfo.GetMemory())
-		Log.Info('CPU Cores: ' + SystemInfo.GetCPUCores())
-
-		# Iterate through all libraries.
-		libAttr = config.GetConfigLibraryMethods()
-		while libAttr:		
-			# Iterate through all methods.
-			methAttr = config.GetConfigMethod(libAttr.methods)			
-			while methAttr and libAttr:
-				if methAttr.run:
-
-					# Create table.
-					table = []
-					# set table header.
-					header = ['', libAttr.libraryName, 'matlab', 'shougun']
-					table.append(header)
-
-					# Load script.
-					module = Loader.ImportModuleFromPath(methAttr.script)
-					methodCall = getattr(module, methAttr.methodName)
-
-					# Perform method on dataset.
-					for dataset in methAttr.dataset:
-						row = ['-'] * 4;
-						# Get dataset name.
-						row[0] = os.path.splitext(os.path.basename(dataset))[0]
-
-						# Perform PCA.
-						Log.Info('Dataset: ' + row[0])
-						time = 0
-						for num in range(methAttr.iteration):
-							instance = methodCall(dataset)
-							time += instance.RunMethod();
-
-							# Delete instance and call the destructor.
-							del instance
-							
-						# Set time.
-						row[1] = time / methAttr.iteration
-						table.append(row)
-					
-					# Show results in a table.
-					Log.Notice('')
-					Log.PrintTable(table)
-
-				methAttr = config.GetConfigMethod(libAttr.methods)
-			libAttr = config.GetConfigLibraryMethods()
\ No newline at end of file
+		SystemInformation()
+		Main()
\ No newline at end of file




More information about the mlpack-svn mailing list