Opening millions of numpy.memmaps in python

白昼怎懂夜的黑 提交于 2019-12-24 07:34:16

问题


I have a database composed of millions of training examples. Each is saved as its own numpy.memmap. (Yes, yes, I know, but they're of irregular sizes. I probably will modify my design to put like-size examples together in one memmap and hide that fact from the user.)

Trying to open this database causes me to run in to the system NOFILES limits, but I've solved that part.

Now I'm running in to OSError: [Errno 12] Cannot allocate memory after about 64865 memmaps are created, and executing most other code after that point results in a MemoryError. This is strange because the process takes only 1.1 GiB of memory before it fails, and this server has nearly 100 GiB of memory.

I've gone and saved a million dummy files in a directory and opened them all with python's standard open function, and it works fine. Takes about 5 GiB of memory between file handles and contents, but it works.

What could be limiting me to only opening about 2^16 memory maps?

来源:https://stackoverflow.com/questions/57402397/opening-millions-of-numpy-memmaps-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!