256GB RAM,64位python和64位numpy的Numy内存错误. ulimit问题?

有很多关于google land中的numpy内存错误的文章,但是我找不到解决我问题的文章.我正在使用具有256GB RAM,64位opensuse 13.1、64位python和64位numpy的高端服务器运行其他人的软件(据我所知).见下文.

原始作者无法获得帮助请求,因此我尽力确定numpy尝试创建的对象的内存大小.首先,这是堆栈跟踪:

File "/home/<me>/cmsRelease/trunk/Classes/DotData.py", line 193, in __new__
  DataObj = numpy.rec.fromarrays(Columns,names = names)
File "/usr/lib64/python2.7/site-packages/numpy/core/records.py", line 562, in fromarrays
  _array = recarray(shape, descr)
File "/usr/lib64/python2.7/site-packages/numpy/core/records.py", line 400, in __new__
  self = ndarray.__new__(subtype, shape, (record, descr), order=order)
MemoryError

我使用以下for循环来估计对象的大小,这是我所知道的最好的方法:

size = 0
for i in Columns:  # Columns is the list passed into numpy.rec.fromarrays
    size += sys.getsizeof(i)
print "Columns size: " + str(size)

结果是Columns大小:12051648.除非我没有记错,否则只有12MB​​,但是无论哪种情况,它与256GB的差距都很大.

基于此信息,我怀疑存在系统限制(ulimit)阻止python访问内存.运行ulimit -a报告以下内容(在运行程序之前,我设置了ulimit -s 256000000):

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 2065541
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 10000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 256000000
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2065541
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

问题:

>我想念什么?
>我是否没有正确测量“列”列表对象的大小?
>是否需要设置另一个系统属性?

我希望内存错误会更具体.我感谢您的帮助.

配套系统信息:

系统内存:

> free -h
             total       used       free     shared    buffers     cached
Mem:          252G       1.6G       250G       4.2M        12M        98M
-/+ buffers/cache:       1.5G       250G
Swap:         2.0G        98M       1.9G

操作系统版本:

> cat /etc/os-release
NAME=openSUSE
VERSION="13.1 (Bottle)"
VERSION_ID="13.1"
PRETTY_NAME="openSUSE 13.1 (Bottle) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:13.1"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"

Python版本:

Python 2.7.6 (default, Nov 21 2013, 15:55:38) [GCC] on linux2
>>> import platform; platform.architecture()
('64bit', 'ELF')

numpy版本:

>>> numpy.version
<module 'numpy.version' from '/usr/lib64/python2.7/site-packages/numpy/version.pyc'>
>>> numpy.version.version
'1.7.1'

解决方法:

真尴尬.我真的快快用光了.我首先开始查看所有256GB的存储空间.为什么在我所有的调查中从未检查过,甚至对我自己来说都是个谜.我很抱歉忽略了显而易见的内容.

上一篇:c – Qmake – 如何配置包含路径顺序?


下一篇:node.js – Vue CLI和Webpack:无法运行webpack-dev-server