-
Notifications
You must be signed in to change notification settings - Fork 24
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
[WIP] Use cupy
, in which case all operations are performed on GPU
#259
Open
RemiLehe
wants to merge
36
commits into
LASY-org:development
Choose a base branch
from
RemiLehe:cupy_backend
base: development
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.
Open
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d92a196
Enable cupy backend for lasy
RemiLehe 22960d9
Make setters and getters GPU aware
RemiLehe f3a71b9
Get field on CPU explicitly for show/write_to_file
RemiLehe aed9b41
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 834b6ff
Fix pyflakes errors
RemiLehe 8673bda
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe 0a7db65
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 346a8b3
Use axiprop with the correct backend
RemiLehe 8e4c8cd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b5b203c
Use correct axiprop backend
RemiLehe 798bb48
Correct typo in axiprop backend
RemiLehe c5fb50c
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe cf3bbc8
Minor fix to make things work on GPU
RemiLehe c71e2a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ba906d9
Fix gaussian propagator test
RemiLehe 54d5afa
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe a8b94d0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 38215fc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d7542a3
Do not import in __init__
RemiLehe f5344a1
Update requirements.txt
RemiLehe e45490d
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe 4cf2e5e
Fix parabolic mirror test
RemiLehe 4232db4
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe 50e8651
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e60d32a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 59aa101
Merge branch 'development' into cupy_backend
RemiLehe 38e920e
Update speckle laser
RemiLehe cc7cf41
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe a2b2a7b
Merge remote-tracking branch 'public/development' into cupy_backend
RemiLehe 6f768eb
Update lasy/laser.py
RemiLehe ba21e4d
Update lasy/laser.py
RemiLehe 4d5adea
Move arrays to CPU
RemiLehe 86992ef
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2bde24b
Conversion to numpy array
RemiLehe 066c018
Merge branch 'cupy_backend' of github.com:RemiLehe/lasy into cupy_bac…
RemiLehe 7d4afae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
__version__ = "0.4.0" | ||
|
||
from .backend import use_cupy | ||
|
||
if use_cupy: | ||
print("Lasy is using Cupy as a backend.") | ||
|
||
else: | ||
print("Lasy is using Numpy as a backend.") | ||
|
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,10 @@ | ||
try: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re backend control: #259 (comment) We could do a similar control as done in matplotlib, e.g., import lasy
lasy.use("numpy") # default: "auto" https://matplotlib.org/stable/users/explain/figure/backends.html The logic could be, using the usual precedence of options:
|
||
import cupy as xp | ||
|
||
|
||
use_cupy = True | ||
except ImportError: | ||
import numpy as xp | ||
|
||
|
||
use_cupy = False | ||
|
||
__all__ = ["use_cupy", "xp"] |
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
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
Oops, something went wrong.
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.
This should be discussed: right now, LASY automatically detects whether
cupy
is available and always uses it if it is.