Skip to content

Commit

Permalink
Merge pull request #4 from Blosc/latest_blosc2
Browse files Browse the repository at this point in the history
Latest blosc2
  • Loading branch information
FrancescAlted authored Jan 4, 2024
2 parents b3a2691 + 0c82e25 commit d4f0a7b
Show file tree
Hide file tree
Showing 26 changed files with 70 additions and 272 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/cibuildwheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64]
# arch: [x86_64, aarch64]
exclude:
- os: windows-latest
arch: aarch64
- os: macos-latest
arch: aarch64

steps:
- name: Checkout repo
Expand All @@ -36,7 +42,7 @@ jobs:

- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Install Ninja
id: ninja
Expand All @@ -63,7 +69,7 @@ jobs:
cmd /V /C "set BLOSC_TRACE=1 && python -m pytest {project}/tests"
- name: Build wheels (Linux / Mac OSX x86_64)
if: ${{ matrix.os != 'windows-latest'}}
if: ${{ matrix.os != 'windows-latest' && matrix.arch != 'aarch64' }}
uses: pypa/[email protected]
env:
# The build requirements should be installed by the pyproject.toml specs
Expand All @@ -76,15 +82,23 @@ jobs:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: "x86_64"

# - name: Build wheels (Mac OSX arm64)
# if: ${{ matrix.os != 'windows-latest' && runner.os != 'Linux' }}
# uses: pypa/[email protected]
# env:
# # The build requirements should be installed by the pyproject.toml specs
# CIBW_ENVIRONMENT: CMAKE_OSX_ARCHITECTURES=arm64 DONT_BUILD_EXAMPLES=1
# CIBW_BUILD: 'cp39-* cp310-* cp311-* cp312-*'
# CIBW_TEST_SKIP: "*macosx*arm64*" # cibuild does not support testing arm64 on macos
# CIBW_ARCHS_MACOS: "arm64"
- name: Build wheels (Ubuntu aarch64)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'aarch64' }}
uses: pypa/[email protected]
env:
# The build requirements should be installed by the pyproject.toml specs
CIBW_BUILD: 'cp39-* cp310-* cp311-* cp312-*'
CIBW_ARCHS_LINUX: "aarch64"

- name: Build wheels (Mac OSX arm64)
if: ${{ matrix.os != 'windows-latest' && runner.os != 'Linux' }}
uses: pypa/[email protected]
env:
# The build requirements should be installed by the pyproject.toml specs
CIBW_ENVIRONMENT: CMAKE_OSX_ARCHITECTURES=arm64 DONT_BUILD_EXAMPLES=1
CIBW_BUILD: 'cp39-* cp310-* cp311-* cp312-*'
CIBW_TEST_SKIP: "*macosx*arm64*" # cibuild does not support testing arm64 on macos
CIBW_ARCHS_MACOS: "arm64"

- name: Upload wheels
uses: actions/upload-artifact@v3
Expand Down
9 changes: 5 additions & 4 deletions ANNOUNCE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Announcing blosc2-grok 0.1.0
Announcing blosc2-grok 0.2.0
============================

This is the first public release. This provides the ability to use the
[grok](https://github.com/GrokImageCompression/grok) codec as dynamic plugin for Blosc2.

This is a minor release, were the `cod_format` default value was change to JP2
and the `mode` param was added to activate high throughput.
Furthermore, with the new Python-Blosc2 release, there is no need to register the
codec. Instead, just use its id `blosc2.Codec.GROK`.
For more info, you can have a look at the release notes in:

https://github.com/Blosc/blosc2_grok/releases
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import numpy as np
import blosc2_grok
from PIL import Image

# Register the grok codec
blosc2.register_codec("grok", 160)

# Set the params for the grok codec
kwargs = {}
kwargs['cod_format'] = blosc2_grok.GrkFileFmt.GRK_FMT_JP2
Expand All @@ -31,7 +28,7 @@ blosc2_grok.set_params_defaults(**kwargs)
# Define the compression and decompression parameters for Blosc2.
# Disable the filters and do not split blocks (these won't work with grok).
cparams = {
'codec': 160,
'codec': blosc2.Codec.GROK,
'filters': [],
'splitmode': blosc2.SplitMode.NEVER_SPLIT,
}
Expand Down
8 changes: 5 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Release notes

## Changes from 0.0.1 to 0.1.1
## Changes from 0.1.0 to 0.2.0

#XXX version-specific blurb XXX#
* Default `cod_format` changed to JP2.
* Added `mode` param to perform high throughput coding.
* Added some benchmarks.
* Added include header in `utils.h`.


## Changes from 0.0.1 to 0.1.0
Expand All @@ -11,5 +14,4 @@
* Documentation for params added in the README.
* Fixed a bug when compressing several images in a row.
* Sporadic segfaults when compressing/decompressing fixed.

* First public release.
10 changes: 0 additions & 10 deletions RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ Tagging

$ git push --delete origin vX.Y.Z

- After the CI uploads wheels in PyPI, do a manual wheel for the Apple ARM64 architecture::

$ python -m cibuildwheel --only 'cp312-macosx_arm64'

and upload it to PyPI::

$ python -m twine upload wheelhouse/blosc2_grok-X.Y.Z-py3-none-macosx_11_0_arm64.whl

(note that you will need to have a PyPI account and be a maintainer of the blosc2_grok project there).

- Create a new release visiting https://github.com/Blosc/blosc2_grok/releases/new
and add the release notes copying them from `RELEASE_NOTES.md` document.

Expand Down
18 changes: 1 addition & 17 deletions bench/encode-blocking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@
"nblocks = 8 # number of blocks per dimension, when blocked"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-19T06:36:46.428319Z",
"start_time": "2023-12-19T06:36:46.426582Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -142,7 +126,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" 'nthreads': 32, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
5 changes: 1 addition & 4 deletions bench/encode-blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@


if __name__ == '__main__':
# Register grok codec locally
blosc2.register_codec('grok', 160)

# Define the compression and decompression parameters. Disable the filters and the
# splitmode, because these don't work with the codec.
cparams = {
'codec': 160,
'codec': blosc2.Codec.GROK,
'nthreads': 4,
'filters': [],
'splitmode': blosc2.SplitMode.NEVER_SPLIT,
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-AppleM1-asahi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,6 @@
"meas = {} # dictionary for storing the measurements"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-21T16:43:04.375750Z",
"start_time": "2023-12-21T16:43:04.345982Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -146,7 +130,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-AppleM1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,6 @@
"meas = {} # dictionary for storing the measurements"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-21T16:43:04.375750Z",
"start_time": "2023-12-21T16:43:04.345982Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -146,7 +130,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-MacMini-i8500B.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@
"meas = {} # dictionary for storing the measurements"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-21T13:06:46.439832Z",
"start_time": "2023-12-21T13:06:46.433963Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -144,7 +128,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-Ryzen-7950X3D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,6 @@
"meas = {} # dictionary for storing the measurements"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-21T16:43:04.375750Z",
"start_time": "2023-12-21T16:43:04.345982Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -146,7 +130,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-blocking-AppleM1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,6 @@
"nblocks = 4 # number of blocks per dimension, when blocked"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-22T08:04:32.278829Z",
"start_time": "2023-12-22T08:04:32.276060Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -142,7 +126,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
18 changes: 1 addition & 17 deletions bench/encode-chunking-blocking-Ryzen-7950X3D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@
"nblocks = 4 # number of blocks per dimension, when blocked"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5aed3cac86499bda",
"metadata": {
"ExecuteTime": {
"end_time": "2023-12-20T12:54:05.675688Z",
"start_time": "2023-12-20T12:54:05.672730Z"
}
},
"outputs": [],
"source": [
"# Register grok codec locally\n",
"blosc2.register_codec('grok', 160)"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -144,7 +128,7 @@
"# Define the compression and decompression parameters for Blosc2.\n",
"# Disable the filters and the splitmode, because these don't work with grok.\n",
"cparams = {\n",
" 'codec': 160,\n",
" 'codec': blosc2.Codec.GROK,\n",
" #'nthreads': 16, # when commented out, this is automatically set to the number of cores\n",
" 'filters': [],\n",
" 'splitmode': blosc2.SplitMode.NEVER_SPLIT,\n",
Expand Down
Loading

0 comments on commit d4f0a7b

Please sign in to comment.