From 201fe10c613b0f527f979176aed5a5df7dfc223c Mon Sep 17 00:00:00 2001 From: Joseph Rushton Wakeling Date: Thu, 21 Jun 2018 19:17:35 +0200 Subject: [PATCH] squash! Update build scripts to always run tests for all MXNet engine types --- Build.mak | 32 ++++++++++++++++++++++---------- Config.mak | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Build.mak b/Build.mak index 040373d..8db80de 100644 --- a/Build.mak +++ b/Build.mak @@ -15,22 +15,34 @@ download-mnist: $C/script/download-mnist # helper function to run tests run_test = $(call exec,MXNET_ENGINE_TYPE=$2 $1,$1,$2) +# helper template to define targets for per-engine test runs +define run_test_with_engine +$(1).stamp: $(1)-$(2).stamp + +$(1)-$(2).stamp: $1 + $(call exec,MXNET_ENGINE_TYPE=$2 $1,$1,$2) +endef + +# helper function to generate targets for per-engine test runs +test_with_engines = $(foreach engine,$2,\ + $(eval $(call run_test_with_engine,$1,$(engine)))) + # extra build dependencies for integration tests $O/test-mxnet: override LDFLAGS += -lz $O/test-mxnet: override DFLAGS += -debug=MXNetHandleManualFree +# run integration tests with all specified engines +$(eval $(call test_with_engines,$O/test-mxnet,$(TEST_MXNET_ENGINES))) + # extra runtime dependencies for integration tests $O/test-mxnet.stamp: override ITFLAGS += $(MNIST_DATA_DIR) -$O/test-mxnet.stamp: $O/test-mxnet download-mnist - $(call run_test,$<,NaiveEngine) - $(call run_test,$<,ThreadedEngine) - $(call run_test,$<,ThreadedEnginePerDevice) - $Vtouch $@ +$O/test-mxnet.stamp: download-mnist + $Vtouch $@ # override default implementation $O/%unittests: override LDFLAGS += -lz -$O/allunittests.stamp: $O/allunittests - $(call run_test,$<,NaiveEngine) - $(call run_test,$<,ThreadedEngine) - $(call run_test,$<,ThreadedEnginePerDevice) - $Vtouch $@ +# run unittests with all specified engines +$(eval $(call test_with_engines,$O/allunittests,$(TEST_MXNET_ENGINES))) + +$O/allunittests.stamp: + $Vtouch $@ # override default implementation diff --git a/Config.mak b/Config.mak index eef5205..20dfec8 100644 --- a/Config.mak +++ b/Config.mak @@ -1,5 +1,7 @@ INTEGRATIONTEST := integrationtest +TEST_MXNET_ENGINES ?= NaiveEngine ThreadedEngine ThreadedEnginePerDevice + MXNET_ENGINE_TYPE ?= NaiveEngine export MXNET_ENGINE_TYPE