-
Notifications
You must be signed in to change notification settings - Fork 66
BUG: Re-evaluate BatchSimulate
backends
#955
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
Comments
Hi @asoplata , I agree with everything you've mentioned regarding the testing and using |
It's arguably hacky, but we could also try using |
Thanks @samadpls , yes most of these |
Thank you for the clarification! I will ensure it is useful and maintainable for future development. If you need any changes, please let me know. I'm happy to improve the structure and functionality. |
This sound like a good issue to start with, I'll look into |
BatchSimulate
testingBatchSimulate
backends
@ntolley @dylansdaniels I've updated the body of this issue to reflect that there are currently undocumented issues and bugs with the |
Update:
It turns out that
BatchSimulate
does not currently work in its entirety, for most of its listed available backends. This situation needs to be addressed before we improveBatchSimulate
's testing (the original point of this issue). On my machine, if I execute ourBatchSimulate
example ( https://github.com/jonescompneurolab/hnn-core/blob/master/examples/howto/plot_batch_simulate.py ) but change the backends, I get the following:backend='loky'
: Succeeds. The default, and the only backend that works out-of-the-box.backend='dask'
: Partially succeeds, but needs considerable code changes in order to do so (which are currently undocumented). The usage in this PR ( https://github.com/jonescompneurolab/hnn-core/pull/1009/files#diff-257f4367bd17cccc84c603209300a970cc3f42f629fb2e3048e7d88e4afaf6fbR357-R384 ) works for me, but:pip install "dask[distributed]"
because we have nosetup.py
recipe for installing Dask,Dask.Client
object.backend='multiprocessing'
: Fails. I get an endless series ofRuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase
and it does not appear to start the simulations at all. You can easily test this one by running ( https://github.com/jonescompneurolab/hnn-core/blob/master/examples/howto/plot_batch_simulate.py ) and merely changing thebackend
.backend='threading'
: Fails. At least one simulation is successfully begun, and I'm able to see someTrial 1: 30.0 ms...
etc. output, but the program quickly crashes with a segfault. I'm unfamiliar with thethreading
module of the standard-library, including whether it depends on hardware-threading, which I would assume it does not. I think use of this library should still be usable on my Apple M4 chip (which does not support simultaneous multi-threading aka hardware-threading, as opposed to software-threading), but I could be wrong about that.In the meantime, it may be prudent to change the documentation for
BatchSimulate
such that it indicates that onlyloky
is currently fully supported. We could then re-add documentation about the other backends in future versions once we know they work and test. This is relevant for our public API, whichBatchSimulate
also needs to be added to, which it wasn't when it was added: it is listed in our Examples ( https://jonescompneurolab.github.io/hnn-core/stable/auto_examples/howto/plot_batch_simulate.html#sphx-glr-auto-examples-howto-plot-batch-simulate-py ) but currently NOT listed in our public API ( https://jonescompneurolab.github.io/hnn-core/stable/api.html ).Original Issue follows:
Currently, testing of
BatchSimulate
is very incomplete.Importantly, as @ntolley pointed out here ENH: Refactor
BatchSimulate
Example and Improve Documentation #857 (comment) , we need a way to test that theloky
backend not only creates multiple workers, but actually uses the multiple parallel workers, in parallel. I think we may have to actually useloky
directly in our tests for this (see ENH: RefactorBatchSimulate
Example and Improve Documentation #857 (comment) ).The
threading
backend only has a single test, themultiprocessing
anddask
backends are not tested at all.Much of the testing is parameter
TypeError
testing, which is not testingBatchSimulate
's functionality so much as it is testing_validate_type
and_check_option
. I hate to say it, but I think many of these tests can be removed. Relatedly, I will make an issue for introducing typing and type-checking for the codebase as a whole. I'm fine with leaving these tests in until we get more formal type-checking implemented, however.Relatedly, we should consider dropping the 'multiprocessing' backend as an option, since it has quirks in Joblib and, judging from joblib's documentation, is effectively replaced by
loky
(see https://joblib.readthedocs.io/en/stable/parallel.html#old-multiprocessing-backend ).The text was updated successfully, but these errors were encountered: