-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update build scripts to always run tests for all MXNet engine types #71
base: v0.x.x
Are you sure you want to change the base?
Changes from all commits
0aa2462
62e2506
201fe10
9370ffd
38c3e08
c8d44c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,50 @@ endif | |
download-mnist: $C/script/download-mnist | ||
$(call exec,sh $(if $V,,-x) $^,$(MNIST_DATA_DIR),$^) | ||
|
||
# helper template to define targets for per-engine test runs | ||
# | ||
# Params: | ||
# $1 = path to executable that runs tests | ||
# $2 = name of MXNet engine to use | ||
define test_with_engine | ||
$(1).stamp: $(1)-$(2).stamp | ||
|
||
$(1)-$(2).stamp: $1 | ||
$(call exec,MXNET_ENGINE_TYPE=$2 $1,$1,$2) | ||
$Vtouch $$@ | ||
endef | ||
|
||
# helper function to generate targets for per-engine test runs | ||
# | ||
# Params: | ||
# $1 = path to executable that runs tests | ||
define run_test_with_engines | ||
$(foreach engine,$(TEST_MXNET_ENGINES),\ | ||
$(eval $(call test_with_engine,$1,$(engine)))) | ||
|
||
$(1).stamp: | ||
$Vtouch $$@ # override default implementation | ||
endef | ||
|
||
define run_test_with_dependency | ||
$(foreach engine,$(TEST_MXNET_ENGINES),\ | ||
$(eval $(1)-$(engine).stamp: $2)) | ||
endef | ||
|
||
# extra build dependencies for integration tests | ||
$O/test-mxnet: override LDFLAGS += -lz | ||
$O/test-mxnet: override DFLAGS += -debug=MXNetHandleManualFree | ||
|
||
# extra runtime dependencies for integration tests | ||
$O/test-mxnet.stamp: override ITFLAGS += $(MNIST_DATA_DIR) | ||
$O/test-mxnet.stamp: download-mnist | ||
$(eval $(call run_test_with_dependency,$O/test-mxnet,\ | ||
override ITFLAGS += $(MNIST_DATA_DIR))) | ||
$(eval $(call run_test_with_dependency,$O/test-mxnet,\ | ||
download-mnist)) | ||
|
||
# run integration tests with all specified engines | ||
$(eval $(call run_test_with_engines,$O/test-mxnet)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A weird behaviour: right now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, it looks like the |
||
|
||
$O/%unittests: override LDFLAGS += -lz | ||
|
||
# run unittests with all specified engines | ||
$(eval $(call run_test_with_engines,$O/allunittests)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTOH this works just fine, with no re-running of unittests after they have been successfully run once. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
INTEGRATIONTEST := integrationtest | ||
|
||
TEST_MXNET_ENGINES ?= NaiveEngine ThreadedEngine ThreadedEnginePerDevice | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One small note here: it should not be possible that the
... then obviously, nothing runs. But there should be a failure in this case (which doesn't happen right now). Any thoughts on the best way to implement this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why there should be a failure. Because with empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jens-mueller-sociomantic right now they are not ADDITIONAL targets. Of course, we could make it so. It just means that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps define the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nemanja-boric-sociomantic I'm not sure it really fixes the issue, because the problem is precisely if the user overrides the variable to set it to empty (a phony target won't solve that). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I was talking nonsense. Hm... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a way of defining default to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH I think this is overthinking things. If someone sets the field to empty that's their problem ... |
||
|
||
MXNET_ENGINE_TYPE ?= NaiveEngine | ||
export MXNET_ENGINE_TYPE | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced that this is working. The output of
make -p
gives e.g.:(where
~
is expanded;-) but the integration tests (and download script) both use the default value of this parameter, despite it being set in myConfig.local.mak
.That said, this might be something other than how this
Build.mak
is written.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just validated with current v0.x.x, where things are working w.r.t. running
test-mxnet
, but not in terms of where the download script places things (which appears to be an existingBuild.mak
bug). So there seems to be some problem with how this override is being handled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it's because the custom rule implemented in
test_with_engine
is missing the details used in the default makd integration test run:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, I can easily add
$$(_test_drt_opts) $$(ITFLAGS)
to the call implemented here inBuild.mak
, but note that this is supposed to work for unittests as well as integration tests and there are no similar settings in vanilla makd where unittests are concerned.@leandro-lucarella-sociomantic @nemanja-boric-sociomantic any advice/thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_test_drt_opts
are common, I think, but unittests versus integration-tests should useUTFLAGS
versusITFLAGS
respectively. I guess I could define a function to work out (based on the full target name) which options should be used. But it really feels like this is starting to turn into a nasty code duplication between how thisBuild.mak
is doing things, versus how makd is doing things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, my feeling is you have reached the level of the complexity where we should consider supporting this as a makd feature. @leandro-lucarella-sociomantic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree, this looks like it needs makd support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is what level of makd support, though. It's not clear to me that it needs to be at the level of actually supporting the feature needed here (i.e. running tests multiple times for different environment settings). It might suffice to provide make functions to run the tests associated with a particular
.stamp
target (so that create a custom recipe without having to do a complete re-duplication of what makd already does).@leandro-lucarella-sociomantic any thoughts? (Including "Drop this for now and get on with more actionable items" :-P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leandro-lucarella-sociomantic your input is needed here :-)