We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7aec32 commit 07f715eCopy full SHA for 07f715e
numcodecs/__init__.py
@@ -1,6 +1,8 @@
1
# -*- coding: utf-8 -*-
2
# flake8: noqa
3
from __future__ import absolute_import, print_function, division
4
+import multiprocessing
5
+import atexit
6
7
8
from numcodecs.version import version as __version__
@@ -18,8 +20,14 @@
18
20
register_codec(LZMA)
19
21
22
try:
23
+ from numcodecs import blosc as _blosc
24
from numcodecs.blosc import Blosc
25
register_codec(Blosc)
26
+ # initialize blosc
27
+ ncores = multiprocessing.cpu_count()
28
+ _blosc.init()
29
+ _blosc.set_nthreads(min(8, ncores))
30
+ atexit.register(_blosc.destroy)
31
except ImportError: # pragma: no cover
32
pass
33
0 commit comments