optimization issues on an SGI system
haley at niwot.scd.ucar.edu
Tue Aug 28 21:50:38 CEST 2001
I recently built Python 2.1.1 and the Python Imaging Library (PIL)
1.1.2 on an SGI running IRIX 6.5, and heeded the warning found in the
README file in the top level directory of the python source tree:
WARNING: There are bugs in the optimizer of some versions of
SGI's compilers that can cause bus errors or other strange
behavior, especially on numerical operations. To avoid this,
try building with "make OPT=".
If I didn't heed this warning, then the simple line of code:
p = 0 + 1.
would cause python to core dump. Turning off optimization fixed the
However, we have been known to run jobs that take 20+ hours, and using
a non-optimized version of python causes a 30% reduction in speed
compared to a partially optimized version of python. This partially
optimized version was created by narrowing down the problem to a
single file, and only turning off optimization for it. The file is
(Side note: I'm already compiling $PYTHON/Objects/complexobject.c with
optimization turned off, based on a comment I read on the web
I ran into another optimization problem that caused the following PIL
script to core dump:
im = Image.new("RGB",(200,100))
draw = ImageDraw.Draw(im)
The offending file in this case was
Using "-O1" on both of these files makes these tests run successfully.
I found a thread on the mail.python.org bulletin board that discussed
"a troubling math bug under IRIX 6.5" that seems similar to the
"p=0+1." problem I'm having. The conclusion of this thread was that
upgrading the IRIX compiler to version 184.108.40.206m would solve the
problem. We did just that, and are still getting a core dump unless
we compile these files with optimization turned off.
While I realize that there's not much a developer can do about a
compiler optimization problem, I'm mentioning it here for 3 reasons:
1) in case it helps other SGI python users to create a faster version
of python, 2) on the wee possibility that there is a solution to this,
and 3) I have dreams of kicking the optimization level up to "-O3"!
haley at ucar.edu
More information about the Python-list