-
-
Notifications
You must be signed in to change notification settings - Fork 399
Expand file tree
/
Copy pathtest_nvcomp.py
More file actions
34 lines (28 loc) · 872 Bytes
/
test_nvcomp.py
File metadata and controls
34 lines (28 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest
import zarr
from zarr.abc.store import Store
from zarr.codecs import NvcompZstdCodec
from zarr.storage import StorePath
from zarr.testing.utils import gpu_test
@gpu_test
@pytest.mark.parametrize("store", ["local", "memory"], indirect=["store"])
@pytest.mark.parametrize(
"checksum",
[
False,
],
)
def test_nvcomp_zstd(store: Store, checksum: bool) -> None:
import cupy as cp
with zarr.config.enable_gpu():
data = cp.arange(0, 256, dtype="uint16").reshape((16, 16))
a = zarr.create_array(
StorePath(store, path="nvcomp_zstd"),
shape=data.shape,
chunks=(16, 16),
dtype=data.dtype,
fill_value=0,
compressors=NvcompZstdCodec(level=0, checksum=checksum),
)
a[:, :] = data
cp.testing.assert_array_equal(data, a[:, :])