Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Aug 7, 2023
1 parent 397320a commit 4c9b71f
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions notebooks/zarr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{
"data": {
"text/plain": [
"<zarr.core.Array (100,) int64>"
"<zarr.core.Array (50,) int64>"
]
},
"execution_count": 3,
Expand All @@ -75,7 +75,7 @@
"source": [
"# Let's create a new Zarr array using KvikIO's GDS store and Snappy compression\n",
"z = zarr.array(\n",
" cupy.arange(100), \n",
" cupy.arange(50), \n",
" chunks=10, \n",
" store=kvikio.zarr.GDSStore(\"my-zarr-file.zarr\"), \n",
" meta_array=cupy.empty(()),\n",
Expand Down Expand Up @@ -145,14 +145,9 @@
{
"data": {
"text/plain": [
"array([ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,\n",
" 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,\n",
" 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,\n",
" 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,\n",
" 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,\n",
" 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\n",
" 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,\n",
" 133, 134, 135, 136, 137, 138, 139, 140, 141])"
"array([42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,\n",
" 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,\n",
" 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91])"
]
},
"execution_count": 6,
Expand All @@ -170,9 +165,9 @@
"metadata": {},
"source": [
"### Mixing CPU and GPU IO\n",
"For instance, we can read our GPU-written Zarr file into a NumPy array. \n",
"It will use the `kvikio.zarr.Snappy` compressor, which was used to write `\"my-zarr-file.zarr\"`. This means that the decompression is still done by nvCOMP on the GPU even though the destination is CPU memory. \n",
"\n"
"We can read our GPU-written Zarr file into a NumPy array. It will use the `kvikio.zarr.Snappy` compressor, which was used to write `\"my-zarr-file.zarr\"`. However, this also means that the decompression is still using nvCOMP even though the destination is CPU memory. \n",
"\n",
"We are working with the Zarr team to enable decompression on the CPU even when the file was compressed usingthe GPU. \n"
]
},
{
Expand All @@ -194,12 +189,35 @@
],
"source": [
"z = zarr.open_array(\"my-zarr-file.zarr\")\n",
"type(z[1:2])"
"type(z[:])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "ac11f375-bf54-468f-b09e-94272c57641c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n",
" 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,\n",
" 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"z[:]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "80682922-b7b0-4b08-b595-228c2b446a78",
"metadata": {},
"outputs": [],
Expand Down

0 comments on commit 4c9b71f

Please sign in to comment.