Skip to content
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

Switchable numpy backends #80

Merged
merged 58 commits into from
Sep 21, 2024
Merged

Switchable numpy backends #80

merged 58 commits into from
Sep 21, 2024

Conversation

obackhouse
Copy link
Contributor

@obackhouse obackhouse commented Sep 14, 2024

Adds a ebcc.backends module which allows the numpy module to be switched. This is specified by the BACKEND variable, reading the EBCC_BACKEND environment variable at import time.

Currently available backends:

  • numpy
  • tensorflow
  • cupy
  • jax
  • ctf

Unless you're using a numpy backend, not all features are guaranteed to be functional. I've ensured that at the very least CC calculations on simple ansatzes are supported. jax and tensorflow have simple unit tests. ctf may currently only support RCC. I am fine with this as these are experimental features.

Other changes:

  • DIIS object is now a custom implementation
  • Lots of changes to the way the array API is interacted with to make sure functionality can be delegated to a backend with needing to do hacky patching
  • The einsum contraction functions are now handled better and there are some flags to customised them. Could do with some benchmarking.
  • Space masking is mostly done by slices now, with warnings for disjoint spaces. This is no loss of functionality since orbital spaces can be reordered to make the spaces contiguous.

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

Attention: Patch coverage is 82.13287% with 831 lines in your changes missing coverage. Please review.

Project coverage is 88.61%. Comparing base (2d2a692) to head (6cbcc8c).
Report is 60 commits behind head on master.

Files with missing lines Patch % Lines
ebcc/codegen/UCCD.py 72.70% 128 Missing ⚠️
ebcc/codegen/RDFCCD.py 50.27% 92 Missing ⚠️
ebcc/backend/_ctf.py 0.00% 82 Missing ⚠️
ebcc/codegen/RDFCCSD.py 83.60% 82 Missing ⚠️
ebcc/codegen/RCC2.py 82.99% 75 Missing ⚠️
ebcc/codegen/GCC2.py 73.55% 73 Missing ⚠️
ebcc/codegen/RDFCC2.py 83.99% 65 Missing ⚠️
ebcc/backend/__init__.py 22.36% 53 Missing and 6 partials ⚠️
ebcc/codegen/RCCD.py 77.29% 42 Missing ⚠️
ebcc/codegen/GCCD.py 70.92% 41 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #80      +/-   ##
==========================================
- Coverage   88.79%   88.61%   -0.18%     
==========================================
  Files          88       94       +6     
  Lines      114148   114474     +326     
  Branches      898      954      +56     
==========================================
+ Hits       101353   101439      +86     
- Misses      12603    12832     +229     
- Partials      192      203      +11     
Flag Coverage Δ
88.61% <82.13%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@obackhouse obackhouse merged commit 3508eb5 into master Sep 21, 2024
6 checks passed
@obackhouse obackhouse deleted the numpy_switch branch September 21, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant