How to use the numcodecs.blosc.set_nthreads function in numcodecs

To help you get started, we’ve selected a few numcodecs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zarr-developers / numcodecs / numcodecs / __init__.py View on Github external
from numcodecs.lzma import LZMA
    register_codec(LZMA)
except ImportError:  # pragma: no cover
    pass

try:
    from numcodecs import blosc
    from numcodecs.blosc import Blosc
    register_codec(Blosc)
    # initialize blosc
    try:
        ncores = multiprocessing.cpu_count()
    except OSError:  # pragma: no cover
        ncores = 1
    blosc.init()
    blosc.set_nthreads(min(8, ncores))
    atexit.register(blosc.destroy)
except ImportError:  # pragma: no cover
    pass

try:
    from numcodecs import zstd
    from numcodecs.zstd import Zstd
    register_codec(Zstd)
except ImportError:  # pragma: no cover
    pass

try:
    from numcodecs import lz4
    from numcodecs.lz4 import LZ4
    register_codec(LZ4)
except ImportError:  # pragma: no cover