openexr icon indicating copy to clipboard operation
openexr copied to clipboard

Allow multithreading in python

Open tiruns opened this issue 2 years ago • 0 comments

This can be done by exposing the Imf::setGlobalThreadCount interface in Python bindings.

I have tested the following modification, and it seems to work fine.

--- a/OpenEXR.cpp
+++ b/OpenEXR.cpp
@@ -1238,6 +1238,7 @@ MOD_INIT(OpenEXR)
     PyObject *m, *d, *item;

     Imf::staticInitialize();
+    Imf::setGlobalThreadCount(8);

     MOD_DEF(m, "OpenEXR", "", methods)
     d = PyModule_GetDict(m);

tiruns avatar Mar 03 '24 15:03 tiruns