-
-
Notifications
You must be signed in to change notification settings - Fork 563
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 jax
& odes
optional
#3163
Make jax
& odes
optional
#3163
Conversation
6498835
to
fe5f37d
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #3163 +/- ##
========================================
Coverage 99.71% 99.71%
========================================
Files 248 248
Lines 18761 18764 +3
========================================
+ Hits 18707 18710 +3
Misses 54 54
☔ View full report in Codecov by Sentry. |
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.
Thanks, @arjxn-py! This would also require updating the docs and getting rid of -
Lines 295 to 341 in 02c56a2
def install_jax(arguments=None): # pragma: no cover | |
""" | |
Install compatible versions of jax, jaxlib. | |
Command Line Interface:: | |
$ pybamm_install_jax | |
| optional arguments: | |
| -h, --help show help message | |
| -f, --force force install compatible versions of jax and jaxlib | |
""" | |
parser = argparse.ArgumentParser(description="Install jax and jaxlib") | |
parser.add_argument( | |
"-f", | |
"--force", | |
action="store_true", | |
help="force install compatible versions of" | |
f" jax ({JAX_VERSION}) and jaxlib ({JAXLIB_VERSION})", | |
) | |
args = parser.parse_args(arguments) | |
if system() == "Windows": | |
raise NotImplementedError("Jax is not available on Windows") | |
# Raise an error if jax and jaxlib are already installed, but incompatible | |
# and --force is not set | |
elif importlib.util.find_spec("jax") is not None: | |
if not args.force and not is_jax_compatible(): | |
raise ValueError( | |
"Jax is already installed but the installed version of jax or jaxlib is" | |
" not supported by PyBaMM. \nYou can force install compatible versions" | |
f" of jax ({JAX_VERSION}) and jaxlib ({JAXLIB_VERSION}) using the" | |
" following command: \npybamm_install_jax --force" | |
) | |
subprocess.check_call( | |
[ | |
sys.executable, | |
"-m", | |
"pip", | |
"install", | |
f"jax=={JAX_VERSION}", | |
f"jaxlib=={JAXLIB_VERSION}", | |
] | |
) |
from both, code and docs.
@Saransh-cpp do we also want to deprecate |
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.
Great work, thanks @arjxn-py! Some comments below.
dd10a60
to
cb49480
Compare
Co-authored-by: Saransh Chopra <[email protected]>
d029faa
to
31f81d4
Compare
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.
Nitpicking 🙂
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.
Thanks, @arjxn-py!
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #3146
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
$ python run-tests.py --doctest
You can run unit and doctests together at once, using
$ python run-tests.py --quick
.Further checks: