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

Disable pthread in blosc #263

Open
oeway opened this issue Dec 24, 2020 · 1 comment
Open

Disable pthread in blosc #263

oeway opened this issue Dec 24, 2020 · 1 comment

Comments

@oeway
Copy link

oeway commented Dec 24, 2020

Hi, I am porting zarr with numcodecs into Pyodide (see here pyodide/pyodide#938), since pthread is not yet supported I have to disable it.

I applied the following patch to blosc and it seems to be working.

diff --git a/c-blosc/blosc/blosc.h b/c-blosc/blosc/blosc.h
index 40857d0..8a1e969 100644
--- a/c-blosc/blosc/blosc.h
+++ b/c-blosc/blosc/blosc.h
@@ -50,7 +50,7 @@ extern "C" {
   ((INT_MAX - BLOSC_MAX_TYPESIZE * sizeof(int32_t)) / 3)
 
 /* The maximum number of threads (for some static arrays) */
-#define BLOSC_MAX_THREADS 256
+#define BLOSC_MAX_THREADS 1
 
 /* Codes for shuffling (see blosc_compress) */
 #define BLOSC_NOSHUFFLE   0  /* no shuffle */

 diff --git a/c-blosc/blosc/blosc.c b/c-blosc/blosc/blosc.c
index a5a5bd5..2a7797c 100644
--- a/c-blosc/blosc/blosc.c
+++ b/c-blosc/blosc/blosc.c
@@ -2236,6 +2236,7 @@ void blosc_atfork_child(void) {
 
 void blosc_init(void)
 {
+  g_initlib = 1;
   /* Return if we are already initialized */
   if (g_initlib) return;

However, I am quite certain that this is not the best way to do it. Can someone here provide some advice on how to properly disable pthread? It would be even better if we can have a build flag that I can controlled in setup.py.

@jakirkham
Copy link
Member

Would suggest following up with the Blosc team. As to Numcodecs, we may soon just rely on Blosc to be packaged independently. See issue ( #262 ) for context.

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