-
Notifications
You must be signed in to change notification settings - Fork 26
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
Dev guide #353
Draft
dpanici
wants to merge
49
commits into
master
Choose a base branch
from
dev_guide
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Dev guide #353
Changes from 25 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
94d7e43
start writing development guide for DESC explaining various aspects a…
dpanici 09bb145
add to the compute section of dev guide
dpanici 1b0e56c
make note about objectives
dpanici 602b5f7
updated guide
dpanici 98d81de
add info on optimization prob
dpanici a2a38da
start adding info on constrained opt method for equilibrium solve (ho…
dpanici 588cd64
update Dev guide
dpanici e7d1790
Merge branch 'master' into dev_guide
unalmis 360cda2
Merge branch 'master' into dev_guide
unalmis 3d944e3
Merge branch 'master' into dev_guide
dpanici 73bcd98
split dev guide into smaller notebooks
dpanici 8966db3
update compute notebook
dpanici 023eb1e
Merge branch 'master' into dev_guide
dpanici b7bb59c
update compute notes
dpanici 9ef9983
Merge branch 'master' into dev_guide
unalmis 0080140
clarify dim_f on objective creation docs
unalmis 03dc381
Merge branch 'master' into dev_guide
unalmis 9cd0cee
Merge branch 'master' into dev_guide
unalmis 861de40
Merge branch 'master' into dev_guide
unalmis b2316ca
Update part of the guides
unalmis 91cf72a
Merge branch 'master' into dev_guide
unalmis c284f6a
add missing grid info
unalmis c0232f4
fix typo
unalmis 45f7379
Merge branch 'master' into dev_guide
unalmis 60935d9
Fix tex labels of some compute funs
unalmis 0651329
Merge branch 'master' into dev_guide
YigitElma 326d331
fix after merge conflict
YigitElma 739b4fc
add new notebooks to index.rst, delete some extra copies
YigitElma b4b6aa1
fix some build problems
YigitElma 3b991f8
fix errors
YigitElma c986268
fix more errors
YigitElma 4ffc092
change title versions
YigitElma 6efe224
Merge branch 'master' into dev_guide
YigitElma 3c1e23b
move dev_guide notebooks inside dev_guide folder
YigitElma 9e2e7de
remove redundant stuff
YigitElma d5d4ee5
remove more
YigitElma 14a9aef
Merge branch 'master' into dev_guide
YigitElma f9a9c7e
add notes
YigitElma 1db7b6b
Merge branch 'master' into dev_guide
YigitElma 8a9e128
remove some outdated notebooks
YigitElma a854cce
update index
YigitElma 4365340
remove outdated one
YigitElma 46b63e2
remove more outdated stuf
YigitElma 0e72132
make backend stuff a notebook
YigitElma 8c2d454
Merge remote-tracking branch 'origin/master' into dev_guide
YigitElma 871a11a
move files
YigitElma f434485
take grid from master
YigitElma 8c7194c
take adding_objectives from master
YigitElma 0fb0d21
some minor update to transform and titles
YigitElma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Backend | ||
------- | ||
|
||
|
||
DESC uses JAX for faster compile times, automatic differentiation, and other scientific computing tools. | ||
The purpose of ``backend.py`` is to determine whether DESC may take advantage of JAX and GPUs or default to standard ``numpy`` and CPUs. | ||
|
||
JAX provides a ``numpy`` style API for array operations. | ||
In many cases, to take advantage of JAX, one only needs to replace calls to ``numpy`` with calls to ``jax.numpy``. | ||
A convenient way to do this is with the import statement ``import jax.numpy as jnp``. | ||
|
||
Of course if such an import statement is used in DESC, and DESC is run on a machine where JAX is not installed, then a runtime error is thrown. | ||
We would prefer if DESC still works on machines where JAX is not installed. | ||
With that goal, in functions which can benefit from JAX, we use the following import statement: ``from desc.backend import jnp``. | ||
``desc.backend.jnp`` is an alias to ``jax.numpy`` if JAX is installed and ``numpy`` otherwise. | ||
|
||
While ``jax.numpy`` attempts to serve as a drop in replacement for ``numpy``, it imposes some constraints on how the code is written. | ||
For example, ``jax.numpy`` arrays are immutable. | ||
This means in-place updates to elements in arrays is not possible. | ||
To update elements in ``jax.numpy`` arrays, memory needs to be allocated to create a new array with the updated element. | ||
Similarly, JAX's JIT compilation requires code flow structures such as loops and conditionals to be written in a specific way. | ||
|
||
The utility functions in ``desc.backend`` provide a simple interface to perform these operations. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should add answers to (good) questions like this here:
#854 (comment)
#854 (comment)