提交 1b0b053d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

More reliable way to get platform's bitwidth

Previous code identified Windows 64 as 32-bit.
上级 2a84ab12
...@@ -5,6 +5,7 @@ import cPickle ...@@ -5,6 +5,7 @@ import cPickle
import logging import logging
import operator import operator
import os import os
import platform
import shutil import shutil
import stat import stat
import StringIO import StringIO
...@@ -30,12 +31,10 @@ AddConfigVar('cmodule.mac_framework_link', ...@@ -30,12 +31,10 @@ AddConfigVar('cmodule.mac_framework_link',
def local_bitwidth(): def local_bitwidth():
"""Return 32 for 32bit arch, 64 for 64bit arch""" """Return 32 for 32bit arch, 64 for 64bit arch"""
# Note - it seems from an informal survey of machines at scipy2010 # Note - it seems from an informal survey of machines at scipy2010
# that platform.architecture is also a reliable way to get the bitwidth # that platform.architecture is a reliable way to get the bitwidth
try: arch = platform.architecture()
maxint = sys.maxint bit_width = arch[0][:-3]
except AttributeError: # python 3 compatibility return int(bit_width)
maxint = sys.maxsize
return len('%x' % maxint) * 4
_logger=logging.getLogger("theano.gof.cmodule") _logger=logging.getLogger("theano.gof.cmodule")
_logger.setLevel(logging.WARNING) _logger.setLevel(logging.WARNING)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论