Skip to content

Use better cd_values[] in LZ4 example#186

Merged
ajelenak merged 9 commits intomasterfrom
lz4-example-default
Jun 16, 2025
Merged

Use better cd_values[] in LZ4 example#186
ajelenak merged 9 commits intomasterfrom
lz4-example-default

Conversation

@ajelenak
Copy link
Contributor

The old value does not seem appropriate for the LZ4 filter as it is too small. Such small values will create much larger compressed chunks than the original chunk size.

The old value does not seem appropriate for the LZ4 filter as it is too small.
@byrnHDF
Copy link
Collaborator

byrnHDF commented May 30, 2025

Because this change comes from a branch in a fork, the reqular plugin workflow fails to run, the daily-build workflow needs to run from the fork and use the ignore option.

@ajelenak
Copy link
Contributor Author

the daily-build workflow needs to run from the fork and use the ignore option.

@byrnHDF https://github.com/HDFGroup/hdf5_plugins/actions/runs/15354926926

@byrnHDF
Copy link
Collaborator

byrnHDF commented May 30, 2025

Right so you need to update the testfiles references to match the output of the tests

@ajelenak
Copy link
Contributor Author

It seems more than just that. The example fails on this line:

printf("decompressed size not the same: %d, != %d\n", compressedBytes, compressedBlockSize);

with the error:

decompressed size not the same: -81, != 96

@byrnHDF
Copy link
Collaborator

byrnHDF commented Jun 2, 2025

Yes, that does indicate a coding error.

@byrnHDF
Copy link
Collaborator

byrnHDF commented Jun 4, 2025

Changing the case will also need to be applied to the examples in HDF5 repo.

@ajelenak
Copy link
Contributor Author

ajelenak commented Jun 4, 2025

Are you okay with this capitalization change @byrnHDF ? I wanted to ask you but you responded faster.

@byrnHDF
Copy link
Collaborator

byrnHDF commented Jun 4, 2025 via email

@ajelenak
Copy link
Contributor Author

ajelenak commented Jun 4, 2025

Was there a reason - because it will have consequences in other projects.

Projects out there, or in-house, like HDF5?

The reason was the name of the filter is LZ4, not lz4. It is not a required change. Now that I better understand how many places need to be changed, I will switch back.

@byrnHDF
Copy link
Collaborator

byrnHDF commented Jun 4, 2025 via email

@ajelenak ajelenak force-pushed the lz4-example-default branch from 57dcd98 to f0dc290 Compare June 4, 2025 18:31
@ajelenak
Copy link
Contributor Author

ajelenak commented Jun 4, 2025

Ok, I removed those changes. Back to the important stuff...

I switched to an older version of the LZ4 plugin in this branch, and it worked for a more sensible block size in the LZ4 example. Also all LZ4-related tests are updated accordingly. We now need to decide how to proceed. It would be nice to understand why introduction of the LZ4_decompress_safe() function in the LZ4 plugin is not working with a block size larger than 3 bytes but also it is important to have a really working LZ4 plugin in this repository.

@ajelenak
Copy link
Contributor Author

ajelenak commented Jun 4, 2025

The LZ4 plugin seems to work now using the new LZ4_decompress_safe() function. The updated LZ4 example code does not report an error about decompressed block size difference.

LZ4/src/H5Zlz4.c Outdated
goto error;
}
#else
#if LZ4_VERSION_NUMBER > 10800
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LZ4_decompress_safe existed before LZ4_VERSION_NUMBER existed lz4/lz4@64547df

So I think the version checks can be safely removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would simplify the code. I am not familiar with the LZ4 evolution, is there any chance that older versions of this function were slower than the current implementation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but even for older versions of LZ4, the better error handling is worth it.

Copy link
Collaborator

@nhz2 nhz2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@dkokron
Copy link

dkokron commented Jun 12, 2025

I am eager to test LZ4 compression in NetCDF Operators (NCO) and NetCDF itself. What steps remain before this PR can be merged?

@ajelenak
Copy link
Contributor Author

All LZ4 tests pass. Fixed #185.

@ajelenak ajelenak merged commit caea827 into master Jun 16, 2025
20 of 23 checks passed
@ajelenak ajelenak deleted the lz4-example-default branch June 16, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants