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

Blosc compression in HDF5 is not designed for multiple threads call blosc library? #24

Open
MarkRivers opened this issue Dec 19, 2018 · 1 comment

Comments

@MarkRivers
Copy link
Member

hdf5Src/blosc_filter.c calls the blosc_compress function in the blosc library as follows:

    status = blosc_compress(clevel, doshuffle, typesize, nbytes,
                            *buf, outbuf, nbytes);

These comments in blosc.h suggest that in multi-threaded applications should use blosc_compress_ctx instead. This also allows directly specifying the number of threads to use:

/**
  Context interface to blosc compression. This does not require a call
  to blosc_init() and can be called from multithreaded applications
  without the global lock being used, so allowing Blosc be executed
  simultaneously in those scenarios.

  It uses the same parameters than the blosc_compress() function plus:

  `compressor`: the string representing the type of compressor to use.

  `blocksize`: the requested size of the compressed blocks.  If 0, an
   automatic blocksize will be used.

  `numinternalthreads`: the number of threads to use internally.

  A negative return value means that an internal error happened.  This
  should never happen.  If you see this, please report it back
  together with the buffer data causing this and compression settings.
*/
BLOSC_EXPORT int blosc_compress_ctx(int clevel, int doshuffle, size_t typesize,
                                    size_t nbytes, const void* src, void* dest,
                                    size_t destsize, const char* compressor,
                                    size_t blocksize, int numinternalthreads);


NDPluginCodec calls blosc_compress_ctx. Shouild hdf5Src/blosc_filter.c be changed to also call blosc_compress_ctx rather than blosc_compress?

@xiaoqiangwang
Copy link
Contributor

Here is the official repo for the hdf5 filter, https://github.com/Blosc/hdf5-blosc. Maybe this issue can be raised there?

From the code, setting BLOSC_NOLOCK=1 could switch to the _ctx version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants