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

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Sep 13 11:23:56 EDT 2013


Author: marcus
Date: Fri Sep 13 11:23:56 2013
New Revision: 15770

Log:
Add information about the python version.

Modified:
   mlpack/conf/jenkins-conf/benchmark/Makefile

Modified: mlpack/conf/jenkins-conf/benchmark/Makefile
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/Makefile	(original)
+++ mlpack/conf/jenkins-conf/benchmark/Makefile	Fri Sep 13 11:23:56 2013
@@ -1,7 +1,23 @@
-PYTHON_BIN := $(shell which python3.3)
-PYTHON_VERSION := $(shell expr `$(PYTHON_BIN) -c 'import sys; print(sys.version[:3])'` \>= 2.7)
-YAML_INSTALLED := $(shell $(PYTHON_BIN) -c 'import sys, yaml;' 2>&1)
+# Locate the python bin.
+PYTHON_BIN := $(shell which python3.2)
+ifndef PYTHON_BIN
+  PYTHON_BIN := $(shell which python)
+endif
+
+ifdef PYTHON_BIN
+# Get the python version.
+ifeq ($(shell expr `$(PYTHON_BIN) -c 'import sys; print(sys.version[:3])'` \>= 3.2)	, 1)
+  PYTHON_VERSION := 1
+endif
+
+# Check if yaml is installed.
+YAML_CHECK := $(shell $(PYTHON_BIN) -c 'import sys, yaml;' 2>&1)
+ifndef YAML_CHECK
+  YAML_INSTALLED := 1
+endif
+endif
 
+# Specify the benchmark settings.
 CONFIG := config.yaml
 BENCHMARKDDIR := benchmark
 LOG:=False
@@ -19,19 +35,21 @@
 export MS_PRINT_BIN=/usr/bin/ms_print
 export VALGRIND_BIN=/usr/bin/valgrind
 
-ifeq ($(PYTHON_VERSION), 0)
-	$(error Python version 2.7 required which was not found)
-endif
-
-# This is empty unless there was a problem.
-ifdef YAML_INSTALLED
-	$(error Python 'yaml' module was not found)
-endif
+# Color settings.
+NO_COLOR=\033[0m
+ERROR_COLOR=\x1b[31;01m
+WARN_COLOR=\x1b[33;01m
 
 .PHONY: help test run memory scripts reports
 
-help:
-	@echo "$(YAML_INSTALLED)"
+help: .check .help
+test: .check .test
+run: .check .run
+memory: .check .memory
+reports: .check .reports
+scripts: .scripts
+
+.help:
 	@echo "Usage: make [option] [CONFIG=..]"
 	@echo "options:"
 	@echo "  help               Show this info."
@@ -45,19 +63,37 @@
 	@echo "  scripts            Compile the java files for the weka methods."
 	@echo "  reports [CONFIG]   Create the reports. Default '$(CONFIG)'."
 
-test:
+.check:
+ifndef YAML_INSTALLED
+	@echo "$(ERROR_COLOR)[ERROR]$(NO_COLOR) The python 'yaml' module was not \
+	found please install the yaml module to start the benchmark script."
+	@exit 1
+endif
+
+ifndef PYTHON_BIN
+	@echo "$(ERROR_COLOR)[ERROR]$(NO_COLOR) Python not found please install \
+	python to start the benchmark script."
+	@exit 1
+else
+ifndef PYTHON_VERSION
+	@echo "$(WARN_COLOR)[WARN]$(NO_COLOR) The benchmark script requires \
+	python3.2+ to run properly."
+endif
+endif
+
+.test:
 	$(PYTHON_BIN) $(BENCHMARKDDIR)/test_config.py -c $(CONFIG)
 
-run:
+.run:
 	$(PYTHON_BIN) $(BENCHMARKDDIR)/run_benchmark.py -c $(CONFIG) -b $(BLOCK) -l $(LOG)
 
-memory:
+.memory:
 	$(PYTHON_BIN) $(BENCHMARKDDIR)/memory_benchmark.py -c $(CONFIG) -b $(BLOCK) -l $(LOG)
 
-reports:
+.reports:
 	$(PYTHON_BIN) $(BENCHMARKDDIR)/make_reports.py -c $(CONFIG)
 
-scripts:
+.scripts:
 	# Compile the java files for the weka methods.
 	javac -cp $(shell echo $(WEKA_CLASSPATH)) -d methods/weka methods/weka/src/*.java
 	# Compile the shogun K-Means (with initial centroids) Clustering method.



More information about the mlpack-svn mailing list