-
Notifications
You must be signed in to change notification settings - Fork 49
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
Make autodE compatible with Windows and change parallel process handling #202
Conversation
Fix tests so that they work on windows
it looks like the CI test where XTB calculations are run (pytest_codecov) are failing because there isn't sufficient memory on the runner. Don't understand why 16 GB is being required because Config.n_cores should be set to 1 before each test 😕 (tests/conftest.py). Nevertheless, I think the memory check should be on the total rather than the available, and let the OS deal with the consequences! |
also looks like the linting is failing because black hasn't been run. if you follow the dev install instructions and install pre-commit it'll do it without having to think about it! |
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.
Looking great – have added some thoughts
Thanks for the review! Is there anything I could locally check about the XTB test? I haven't modified anything in the conftest.py file, so not sure why it is not working. I used available memory because the OS is bound to consume some amount of memory at all times, so requesting the total amount of memory (by Orca or any other software) would increase the chances of crash. Is there any harm in using available memory, if it is available from psutil? |
Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com>
Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com>
I imagine it was broken before this PR and I just didn't spot it. If you find out why that would be awesome!
I don't think either the total or available memory is the right number because what you really want is the maximum amount that can be allocated to the calculation without kicking crucial stuff out of memory. I'd however be pretty strongly in favour of having it as the total because the available memory makes the chances that a calculation raising that runtime error non-deterministic... which would be super annoying. Say, If the OS could re-jig things and make it possible to run the calc. e.g. if I happen to have a load of tabs open in my browser and try to run something locally I'd rather they were kicked out than my calculation failing. |
…imeout for windows
The config should be picklable now, and the original format has been left unchanged. The pytest-codecov for patch is failing because of the parts of code that do not run on the main process. Not sure if it can be fixed. |
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 got more comments – sorry. only suggestions really though. looks awesome overall 🚀
…ing (#202) * make autode compatible with windows: replace multiprocessing with joblib and loky * remove comment autode/utils.py * check total memory in utils * use loky for parallel processing * loky context is used for better handling of parallelisation * fixes for timeout wrapper in POSIX * use class instances instead of class attributes for Config * pass parent Config state into child processes * keep default timeout wrapper, also add new wrapper * separate parallelisation scheme for windows, restore default for linux/mac * fix test_config_in_worker_proc for posix * codecov on windows * add tests for config copy * change config implementation for updating in worker process * add context manager for temporary config, minor fix in experimental timeout for windows * add tests for context manager * use bash for installing xtb in CI runner * add tests for cleanup after timeout * exclude setup.py from codecov * make config picklable and easily readable * add test and minor fixes * move xtb install script to .github/scripts * use temporary_config for test_utils.py * update changelog and contributor list * resolve conflicts with v1.4.0 Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com>
* Ignore doc paths for code CI (duartegroup#235) * Ignore doc paths for code CI * Update PR template * Add "ERROR" level to logging (duartegroup#231) * add ERROR level to logging * update docs for logging * update tests for logging * update changelog * Fix parsing Qchem v6 output (duartegroup#234) * Fix parsing Qchem v6 output * Fix units for values div mul (duartegroup#242) * Fix units for div mul * Update changelog * Update workflow (duartegroup#244) * Fix xtb opt with cartesian coordinates (duartegroup#247) * Fix xtb opt with cartesian coordinates * Update changelog [skip actions] * Remove hessian conversion on normal mode calculation (duartegroup#243) * Ensure no unit conversion in hessian * Use a copy for value and valuearray * Raise exception on value `to` with inplace * Add missed changelog updates * Template for v1.4.0 (duartegroup#203) * Make autodE compatible with Windows and change parallel process handling (duartegroup#202) * make autode compatible with windows: replace multiprocessing with joblib and loky * remove comment autode/utils.py * check total memory in utils * use loky for parallel processing * loky context is used for better handling of parallelisation * fixes for timeout wrapper in POSIX * use class instances instead of class attributes for Config * pass parent Config state into child processes * keep default timeout wrapper, also add new wrapper * separate parallelisation scheme for windows, restore default for linux/mac * fix test_config_in_worker_proc for posix * codecov on windows * add tests for config copy * change config implementation for updating in worker process * add context manager for temporary config, minor fix in experimental timeout for windows * add tests for context manager * use bash for installing xtb in CI runner * add tests for cleanup after timeout * exclude setup.py from codecov * make config picklable and easily readable * add test and minor fixes * move xtb install script to .github/scripts * use temporary_config for test_utils.py * update changelog and contributor list * resolve conflicts with v1.4.0 Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com> * update docs (duartegroup#229) * update docs for windows installation and temporary_config * update docs for windows installation and temporary_config * minor edit Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com> * Autouse tempoary_config (duartegroup#236) * minor fixes --------- Co-authored-by: Tom Young <39765193+t-young31@users.noreply.github.com>
Major change: multiprocessing library replaced with
concurrent.futures
for Linux/macOS andloky
for Windowsconcurrent.futures
hasProcessPoolExecutor
with slightly different argument names, but uses multiprocessing backend, so there should be no difference in behaviour__main__
etc.;loky
solves many of those issuesMinor change: timeout decorator in
autode/utils.py
is reimplemented with a switch for WindowsConfig.use_experimental_timeout = True
will use a reusable process pool fromloky
to implement timeoutOther changes
Tests on Windows: all success
TODO: