Skip to content
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

bug[next] Fix broken gpu tox setup #1358

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pytest

import gt4py.next as gtx
from gt4py.next import common
from gt4py.next.program_processors.runners import dace_iterator, gtfn

from next_tests.integration_tests import cases
Expand All @@ -26,26 +27,19 @@

@pytest.mark.requires_gpu
@pytest.mark.parametrize("fieldview_backend", [dace_iterator.run_dace_gpu, gtfn.run_gtfn_gpu])
def test_copy(cartesian_case, fieldview_backend): # noqa: F811 # fixtures
def test_copy(fieldview_backend): # noqa: F811 # fixtures
import cupy as cp

@gtx.field_operator(backend=fieldview_backend)
def testee(a: cases.IJKField) -> cases.IJKField:
return a

inp_arr = cp.full(shape=(3, 4, 5), fill_value=3, dtype=cp.int32)
outp_arr = cp.zeros_like(inp_arr)
inp = gtx.as_field([cases.IDim, cases.JDim, cases.KDim], inp_arr)
outp = gtx.as_field([cases.IDim, cases.JDim, cases.KDim], outp_arr)

testee(inp, out=outp, offset_provider={})
assert cp.allclose(inp_arr, outp_arr)

inp_field = gtx.full(
[cases.IDim, cases.JDim, cases.KDim], fill_value=3, allocator=fieldview_backend
)
out_field = gtx.zeros(
[cases.IDim, cases.JDim, cases.KDim], outp_arr, allocator=fieldview_backend
)
domain = {
cases.IDim: common.unit_range(3),
cases.JDim: common.unit_range(4),
cases.KDim: common.unit_range(5),
}
inp_field = gtx.full(domain, fill_value=3, allocator=fieldview_backend, dtype=cp.int32)
out_field = gtx.zeros(domain, allocator=fieldview_backend, dtype=cp.int32)
testee(inp_field, out=out_field, offset_provider={})
assert cp.allclose(inp_field.ndarray, out_field.ndarray)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ set_env =
PIP_EXTRA_INDEX_URL = {env:PIP_EXTRA_INDEX_URL:https://test.pypi.org/simple/}
commands =
nomesh-cpu: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "not requires_atlas and not requires_gpu" {posargs} tests{/}next_tests
nomesh-gpu: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "not requires_atlas and requires_gpu" {posargs} tests{/}next_tests
nomesh-{cuda,cuda11x,cuda12x}: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "not requires_atlas and requires_gpu" {posargs} tests{/}next_tests
atlas-cpu: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "requires_atlas and not requires_gpu" {posargs} tests{/}next_tests
atlas-gpu: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "requires_atlas and requires_gpu" {posargs} tests{/}next_tests
# atlas-{cuda,cuda11x,cuda12x}: python -m pytest --cache-clear -v -n {env:NUM_PROCESSES:1} -m "requires_atlas and requires_gpu" {posargs} tests{/}next_tests # TODO(ricoh): activate when such tests exist
pytest --doctest-modules src{/}gt4py{/}next

[testenv:storage-py{38,39,310}-{internal,dace}-{cpu,cuda,cuda11x,cuda12x}]
Expand Down
Loading