-
-
Notifications
You must be signed in to change notification settings - Fork 417
Initial GPU support #1967
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
Initial GPU support #1967
Changes from 39 commits
22a5807
d8cc79f
4d2b8c7
36b1cb2
04001b4
74a13c4
bdc0a24
d900aa3
0eca795
d9ed6c4
5405e38
2858701
4e18098
35948d4
bd2a20b
828401f
02a6e9d
ff40d3c
e5cfd2f
d473a3d
2a2e399
b89ab9a
c5a387d
72d172d
3db61bd
425c3f8
75b0ad7
c8c7e6d
25a67ca
ce7f5e2
ac061d9
523d8d5
b559ee4
26a74f4
7307833
f6fddd9
2b1fe14
abd135f
1db58e7
296bd02
b33c887
c894f60
e0da0fb
07277af
6e49e85
02c319c
e82ddc1
7854ce9
9688ad6
3852c9f
2e8069c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
|
||
| name: GPU Test V3 | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ v3 ] | ||
| pull_request: | ||
| branches: [ v3 ] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }} | ||
|
|
||
| runs-on: gpu-runner | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.11'] | ||
| numpy-version: ['2.0'] | ||
| dependency-set: ["gpu"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: GPU check | ||
| run: | | ||
| nvidia-smi | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: 'pip' | ||
| - name: Install Hatch and CuPy | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install hatch cupy-cuda12x | ||
| - name: Set Up Hatch Env | ||
| run: | | ||
| hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} | ||
| hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env | ||
| - name: Run Tests | ||
| run: | | ||
| hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage-gpu | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,6 +74,9 @@ jupyter = [ | |||||||||||||
| 'ipytree>=0.2.2', | ||||||||||||||
| 'ipywidgets>=8.0.0', | ||||||||||||||
| ] | ||||||||||||||
| gpu = [ | ||||||||||||||
| "cupy-cuda12x", | ||||||||||||||
| ] | ||||||||||||||
|
Comment on lines
+77
to
+79
Member
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.
Suggested change
|
||||||||||||||
| docs = [ | ||||||||||||||
| 'sphinx', | ||||||||||||||
| 'sphinx-autobuild>=2021.3.14', | ||||||||||||||
|
|
@@ -120,9 +123,9 @@ build.hooks.vcs.version-file = "src/zarr/_version.py" | |||||||||||||
| [tool.hatch.envs.test] | ||||||||||||||
| dependencies = [ | ||||||||||||||
| "numpy~={matrix:numpy}", | ||||||||||||||
| "universal_pathlib" | ||||||||||||||
| "universal_pathlib", | ||||||||||||||
| ] | ||||||||||||||
| features = ["test", "extra"] | ||||||||||||||
| features = ["test", "extra", "gpu"] | ||||||||||||||
|
Member
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.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| [[tool.hatch.envs.test.matrix]] | ||||||||||||||
| python = ["3.10", "3.11", "3.12"] | ||||||||||||||
|
|
@@ -134,8 +137,14 @@ python = ["3.10", "3.11", "3.12"] | |||||||||||||
| numpy = ["1.24", "1.26", "2.0"] | ||||||||||||||
| features = ["optional"] | ||||||||||||||
|
|
||||||||||||||
| [[tool.hatch.envs.test.matrix]] | ||||||||||||||
| python = ["3.10", "3.11", "3.12"] | ||||||||||||||
| numpy = ["1.24", "1.26", "2.0"] | ||||||||||||||
| features = ["gpu"] | ||||||||||||||
|
Member
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.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| [tool.hatch.envs.test.scripts] | ||||||||||||||
| run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov=tests" | ||||||||||||||
| run-coverage-gpu = "pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov=tests" | ||||||||||||||
| run = "run-coverage --no-cov" | ||||||||||||||
| run-verbose = "run-coverage --verbose" | ||||||||||||||
| run-mypy = "mypy src" | ||||||||||||||
|
|
@@ -223,4 +232,8 @@ filterwarnings = [ | |||||||||||||
| "error:::zarr.*", | ||||||||||||||
| "ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning", | ||||||||||||||
| "ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning", | ||||||||||||||
| "ignore:Creating a zarr.buffer.gpu.*:UserWarning", | ||||||||||||||
| ] | ||||||||||||||
| markers = [ | ||||||||||||||
| "gpu: mark a test as requiring CuPy and GPU" | ||||||||||||||
|
Member
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. Make it is worth using
Member
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. You're thinking, @jakirkham, that then there could be a multiplicity of these. |
||||||||||||||
| ] | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| from zarr.core.buffer.core import ( | ||
| ArrayLike, | ||
| Buffer, | ||
| BufferPrototype, | ||
| NDArrayLike, | ||
| NDBuffer, | ||
| default_buffer_prototype, | ||
| ) | ||
| from zarr.core.buffer.cpu import numpy_buffer_prototype | ||
|
|
||
| __all__ = [ | ||
| "ArrayLike", | ||
| "Buffer", | ||
| "NDArrayLike", | ||
| "NDBuffer", | ||
| "BufferPrototype", | ||
| "default_buffer_prototype", | ||
| "numpy_buffer_prototype", | ||
| ] |
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.
Manually adding this here for now. Should make this part of the hatch workflow 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.
Yeah there's probably a better way to handle this. Happy to chat when this is ready for discussion
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 is the only thing remaining for this PR, so any solutions here would be great!
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, did an initial pass below
We should be able to use the self-referential extra with hatch as well