Skip to content

Parallel Joblib Process Entries#3933

Merged
mkhorton merged 9 commits intomaterialsproject:masterfrom
CompRhys:joblib-process-entries
Aug 2, 2024
Merged

Parallel Joblib Process Entries#3933
mkhorton merged 9 commits intomaterialsproject:masterfrom
CompRhys:joblib-process-entries

Conversation

@CompRhys
Copy link
Copy Markdown
Contributor

@CompRhys CompRhys commented Jul 17, 2024

Summary

Adds the option to use joblib to apply corrections in parallel, this depended on materialyzeai/monty#691 which was linked to #3898. Opening this PR incase maintainers think it's a useful addition to the code.

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

@mkhorton mkhorton enabled auto-merge (squash) July 25, 2024 14:03
@mkhorton
Copy link
Copy Markdown
Member

Thanks @CompRhys for the PR. Wondering if we should add n_workers to the pymatgen config yaml? If pymatgen is doing processing in parallel in different aspects of the code, might be good to be able to set the correct parallelization centrally

@CompRhys
Copy link
Copy Markdown
Contributor Author

Regarding default for n_workers i'm not opposed but I would always want to have it be controllable at the function call and it would be best to make that update in a separate PR imo.

Re test failures I have been using this method and works very great for me on 3.12. I don't see these pickle errors when running local tests so not sure which object is responsible. I will try take a look at the weekend.

@CompRhys
Copy link
Copy Markdown
Contributor Author

Cannot replicate the error locally even building a py39 venv.

Traceback (most recent call last):
  File "/home/runner/micromamba/envs/pmg/lib/python3.12/site-packages/joblib/externals/loky/process_executor.py", line 426, in _process_worker
    call_item = call_queue.get(block=True, timeout=timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pmg/lib/python3.12/multiprocessing/queues.py", line 122, in get
    return _ForkingPickler.loads(res)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/micromamba/envs/pmg/lib/python3.12/site-packages/monty/design_patterns.py", line 84, in __new__
    inst = klass(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
TypeError: GasCorrection.__init__() missing 1 required positional argument: 'config_file'

@mkhorton mkhorton merged commit 976942c into materialsproject:master Aug 2, 2024
@janosh janosh added enhancement A new feature or improvement to an existing one mixing-schemes About mixing energies from different DFT functionals labels Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A new feature or improvement to an existing one mixing-schemes About mixing energies from different DFT functionals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants