Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

numpy.recfromcsv not releasing GIL

Tags:

python

numpy

I am using numpy.recfromcsv function to read a large amount of data. This is done in a worker thread so that my GUI (PySide) thread is not blocked. Even though I know of GIL that ensures that only one thread is being interpreted by Python at a time, I had very good experience with numpy operations. Most of them seem to release GIL so that while other processor cores are working on a numpy operation, my GUI thread remains responsive.

However numpy.recfromcsv causes my GUI to become sluggish. Does that mean that it does not release GIL? Or is there another reason? Is there a workaround to keep the GUI responsive even during this operation? I tried multiprocessing by this seems to be overkill and incredible pain with sharing or pickling large amounts of data.

like image 307
V.K. Avatar asked Mar 21 '26 16:03

V.K.


1 Answers

np.recfromcsv uses np.genfromtxt (source) internally, which looks like it's just a pure python function, so I don't think what you're hoping for is possible with numpy.

like image 78
user545424 Avatar answered Mar 23 '26 06:03

user545424



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!