[Pythonmac-SIG] Intel compilers to build Python?

Boyd Waters bwaters at nrao.edu
Tue Aug 29 04:28:34 CEST 2006


On Aug 27, 2006, at 8:22 PM, Boyd Waters wrote:

> I'm the one who is hacking together the DarwinPort for using the  
> Intel compiler

This is probably arrogance on my part. But I could not find a recipe  
for building Python with the Intel compiler, so I created one.

I have just finished building Python-2.5c1 (release candidate 1) with  
the Intel compiler (9.1.029) on a Mac Pro. This might lead to  
performance benefits with downstream plugins like NumPy, but it is  
more likely to lead to compatibility issues with those modules. I  
don't know yet.

Anyway, I patched two files: the configure shell script, and the Mac/ 
PythonLauncher Makefile.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure.diff
Type: application/octet-stream
Size: 1168 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20060828/8720ec87/attachment-0002.obj 
-------------- next part --------------
	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mac-PythonLauncher-Makefile.in.diff
Type: application/octet-stream
Size: 437 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20060828/8720ec87/attachment-0003.obj 
-------------- next part --------------

The Mac/PythonLauncher/Makefile.in patch simply forces the use of GCC  
to compile Objective-C files in the Mac Cocoa launcher.

The configure file slightly modifies the linking of top-level python.exe

I applied the patches like this:

# cd Python-2.5c1
# patch -p0 < ~/Mac-PythonLauncher-Makefile.in.diff
# patch < ~/configure.diff


I invoked configure like this:

# CC=icc CXX=icpc OPT="-xT -O3 -fstack-security-check -fpic - 
parallel" ICC_LIBS="-L/opt/intel/cc/9.1.029/lib -lirc -limf" ./ 
configure --enable-framework

This tells the compiler to optimize for the Woodcrest or Merom  
processor; to optimize for Core Solo/Duo, use -xP. I can reliably  
trip a compiler error if I use -axT, which tries to accommodate both  
types of processor.


I build like this:

# make -j4
# sudo make frameworkinstall


This goes rather quickly on a four-core Mac Pro. This afternoon my  
colleagues came by to see what I was working on, gave me encouraging  
comments like "Hey, you can get it to crash that much faster on the  
new Mac..."


I'll have a DarwinPort real soon...

Feedback is welcome.

- boyd




More information about the Pythonmac-SIG mailing list