-
Notifications
You must be signed in to change notification settings - Fork 64
gpu info upon notebook import #410
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bb875c5
displaying fpl logo and gpu info works on import in nb
kushalkolar 364871e
add face logo for nb and add to MANIFEST
kushalkolar 8b05dac
remove line that snuck in from other branch
kushalkolar 4cd4d04
git lfs to pypi build action
kushalkolar fdfdcb5
fix import and add easter egg
kushalkolar 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 hidden or 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,2 +1,4 @@ | ||
| recursive-include fastplotlib/utils/colormaps/ * | ||
| include fastplotlib/VERSION | ||
| recursive-include fastplotlib/assets/ * | ||
|
|
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,2 @@ | ||
| from .functions import * | ||
| from ._gpu_info import print_adapter_info |
This file contains hidden or 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,68 @@ | ||
| from pathlib import Path | ||
|
|
||
| from wgpu.backends.wgpu_native import enumerate_adapters | ||
| from wgpu.utils import get_default_device | ||
|
|
||
| try: | ||
| from wgpu.gui.jupyter import JupyterWgpuCanvas | ||
| except ImportError: | ||
| JupyterWgpuCanvas = False | ||
|
|
||
| try: | ||
| from IPython.display import display | ||
| from ipywidgets import Image | ||
| except NameError: | ||
| pass | ||
|
|
||
|
|
||
| def print_adapter_info(): | ||
| try: | ||
| ip = get_ipython() | ||
| if not (ip.has_trait("kernel") and JupyterWgpuCanvas is not False): | ||
| return | ||
| except NameError: | ||
| return | ||
|
|
||
| logo_path = Path(__file__).parent.parent.joinpath("assets", "fastplotlib_face_logo.png") | ||
|
|
||
| with open(logo_path, "rb") as f: | ||
| logo_data = f.read() | ||
|
|
||
| image = Image( | ||
| value=logo_data, | ||
| format="png", | ||
| width=300, | ||
| height=55 | ||
| ) | ||
|
|
||
| display(image) | ||
|
|
||
| # print logo and adapter info | ||
| adapters = [a for a in enumerate_adapters()] | ||
| adapters_info = [a.request_adapter_info() for a in adapters] | ||
|
|
||
| ix_default = adapters_info.index(get_default_device().adapter.request_adapter_info()) | ||
|
|
||
| if len(adapters) > 0: | ||
| print("Available devices:") | ||
|
|
||
| for ix, adapter in enumerate(adapters_info): | ||
| atype = adapter["adapter_type"] | ||
| backend = adapter["backend_type"] | ||
| driver = adapter["description"] | ||
| device = adapter["device"] | ||
|
|
||
| if atype == "DiscreteGPU" and backend != "OpenGL": | ||
| charactor = chr(0x2705) | ||
| elif atype == "IntegratedGPU" and backend != "OpenGL": | ||
| charactor = chr(0x0001FBC4) | ||
| else: | ||
| charactor = chr(0x2757) | ||
|
|
||
| if ix == ix_default: | ||
| default = " (default) " | ||
| else: | ||
| default = " " | ||
|
|
||
| output_str = f"{charactor}{default}| {device} | {atype} | {backend} | {driver}" | ||
| print(output_str) |
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.
Uh oh!
There was an error while loading. Please reload this page.