| View previous topic :: View next topic |
| Author |
Message |
nagzi n00b

Joined: 29 Dec 2003 Posts: 35 Location: Canada
|
Posted: Tue Mar 23, 2004 7:58 pm Post subject: Compiling the kernel (2.6) with icc. |
|
|
I'm going to assume that the reader already has icc installed (I'll help a little bit with getting it working). Look to this thread for some tips on getting it installed. You'll have to make sure that /opt/intel/compiler80/bin is in your path or make symlinks to icc and icpc in a dir that is in your path. Also you're going to have to make symlinks to some libs in a dir thats listed in your /etc/ld.so.conf, other wise your /opt/intel/compiler80/lib entry will disappear everytime you emerge something (if someone knows how to fix this please let me know! ).
For the path:
| Code: | cd /usr/bin
ln -s /opt/intel/compiler80/bin/icc
ln -s /opt/intel/compiler80/bin/icpc
|
Now for the libs:
| Code: | cd /usr/lib
ln -s /opt/intel/compiler80/lib/libcprts.so libcprts.so.5
ln -s /opt/intel/compiler80/lib/libcxa.so libcxa.so.5
ln -s /opt/intel/compiler80/lib/libunwind.so libunwind.so.5
ln -s /opt/intel/compiler80/lib/libcxaguard.so libcxaguard.so.5
ldconfig
|
With your favorite editor open /usr/src/linux-'uname -r'/Makefile. Now goto approximately line 163. This may or may not change from kernel version to kernel version or with different kernel patches applied. Myself I'm running 2.6.3 with mm1 patch plus the supermount patch. The lines that you want should look like:
| Code: | HOSTCC = gcc
HOSTCXX = g++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2
HOSTCXXFLAGS = -O2
|
Now edit the first two lines and change gcc and g++ to icc and icpc. You can also change the cflags too, but that can be taking some risk. I did however change it from O2 to O3 with no probs. After editing, my lines now look like:
| Code: | HOSTCC = icc
HOSTCXX = icpc
HOSTCFLAGS = -Wall -Wstrict-prototypes -O3
HOSTCXXFLAGS = -O3
|
Hopefully this will work for most people, if not I'll help as best as I can. Hopefully we can start getting more interest and talking about icc, since the main thread has sort of died down.
Well that should be it. Thats what I had to do to get icc compiling the kernel. There are a few other tips for icc, but those are for emerges.
PS: Incase the subject didn't click in, this is for the 2.6 kernel. I have absolutely no idea if this works for 2.4 or not.
PSS: Don't be to harsh, this is my first posting of a tip.  _________________ Core 2 Duo E6700 | Asus P5B | 2G DDR-2 800
BFG 7900 GS OC | Dell UltraSharp 2005FPW
Seagate 7200.10 320G Sata2 | Plextor PX-755SA
MAKE, not war. |
|
| Back to top |
|
 |
PillowBiter n00b


Joined: 16 Mar 2004 Posts: 26 Location: Palm Bay, FL
|
Posted: Tue Mar 23, 2004 9:17 pm Post subject: |
|
|
| Are there any advantages to using intels compiler vs gcc? |
|
| Back to top |
|
 |
Markus_T n00b


Joined: 09 Feb 2004 Posts: 49 Location: Berlin
|
Posted: Tue Mar 23, 2004 9:19 pm Post subject: |
|
|
Cool,
I didn't know, that it is that easy.
Has anybody experimented with the
profile-guided optimization options?
Anyway, I will try it out in the next days. |
|
| Back to top |
|
 |
nagzi n00b

Joined: 29 Dec 2003 Posts: 35 Location: Canada
|
Posted: Wed Mar 24, 2004 4:19 pm Post subject: |
|
|
| PillowBiter wrote: | | Are there any advantages to using intels compiler vs gcc? |
Well, Intel's compiler is suppose to produce to faster code. And I can't say that I notice any difference since I upgraded to 2.6 and started using icc for the kernel at the sametime. _________________ Core 2 Duo E6700 | Asus P5B | 2G DDR-2 800
BFG 7900 GS OC | Dell UltraSharp 2005FPW
Seagate 7200.10 320G Sata2 | Plextor PX-755SA
MAKE, not war. |
|
| Back to top |
|
 |
TenPin Guru


Joined: 26 Aug 2002 Posts: 499 Location: Kansas City
|
Posted: Wed Mar 24, 2004 5:00 pm Post subject: |
|
|
| The kernel is all discrete math and icc only really increases performance significantly for floating point math. Also, I wouldn't like to use -O3 as you are more likely to end up with a broken kernel. GCC is the tried and tested platform and -O2 is considered fine. I think if there were any real benefits from using -O3 on the kernel we would know about it. |
|
| Back to top |
|
 |
Markus_T n00b


Joined: 09 Feb 2004 Posts: 49 Location: Berlin
|
Posted: Thu Mar 25, 2004 8:33 am Post subject: |
|
|
| Quote: |
GCC is the tried and tested platform and -O2 is considered fine. I think if there were any real benefits from using -O3 on the kernel we would know about it.
|
GCC -O3 != ICC -O3
BTW, I'm using:
HOSTCFLAGS = -Wall -Wstrict-prototypes -O3 -ip
HOSTCXXFLAGS = -O3 -ip
right now, without any problems.
The -ipo flag does not work, but maybe one only has to make
trivial changes in the Makefile to get it right. |
|
| Back to top |
|
 |
Markus_T n00b


Joined: 09 Feb 2004 Posts: 49 Location: Berlin
|
Posted: Thu Mar 25, 2004 10:52 pm Post subject: |
|
|
Well, if you use
make V=1 (verbose mode)
to build the kernel, you will see that
actually gcc is used to build the kernel.
Now thats more than embarrassing...
Icc is only invoked for a few config progs
at the beginning of the kernel build.  |
|
| Back to top |
|
 |
TenPin Guru


Joined: 26 Aug 2002 Posts: 499 Location: Kansas City
|
Posted: Thu Mar 25, 2004 10:52 pm Post subject: |
|
|
| Markus_T wrote: | | Quote: |
GCC is the tried and tested platform and -O2 is considered fine. I think if there were any real benefits from using -O3 on the kernel we would know about it.
|
GCC -O3 != ICC -O3
BTW, I'm using:
HOSTCFLAGS = -Wall -Wstrict-prototypes -O3 -ip
HOSTCXXFLAGS = -O3 -ip
right now, without any problems.
The -ipo flag does not work, but maybe one only has to make
trivial changes in the Makefile to get it right. |
Maybe not but considering the highest level optimisations of both compilers is -O3 I would suspect they are very similar.
My main point is that theres not much point (probably none) rushing out to compile your kernel with icc in the hope that it will make your kernel faster. |
|
| Back to top |
|
 |
hbp4c n00b


Joined: 17 Apr 2002 Posts: 46 Location: Charlottesville, Va
|
Posted: Wed Mar 31, 2004 8:41 pm Post subject: |
|
|
I admit I'd be happy to see if intel's compilers would build the kernel, if for no other reason than to prove if icc is a good and fully capable compiler.
Before icc8 was released, intel insisted that it would be nearly 100% gcc compatible, and while they made great strides to make it so, it still comes up short on a few bits of code.
I and the others here in my workplace (astronomy at UVa) have our own code which using gcc can take hours longer to run than using the intel compilers to optimize the same code.
My only reccomendation about tuning the kernel makefiles is make sure you have a backup kernel to resort to in case you new one goes kaboom  |
|
| Back to top |
|
 |
uglyb0b Apprentice


Joined: 07 Sep 2003 Posts: 280
|
Posted: Wed Mar 31, 2004 9:07 pm Post subject: |
|
|
Icc makes faster code on Opterons. _________________ Blog.
Linux geek and Mac whore. |
|
| Back to top |
|
 |
zrl n00b

Joined: 20 Jan 2004 Posts: 47
|
Posted: Sun May 23, 2004 5:07 am Post subject: |
|
|
icc is used for only few files;
gcc is actually compiling 98% of all;
if you change part of the Makefile as follow:
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)xild
CC = $(CROSS_COMPILE)icc
CPP = $(CC) -E
AR = $(CROSS_COMPILE)xiar
every thing will be done by icc, however, it spit at me with following:
| Quote: | CHK include/linux/version.h
CC arch/i386/kernel/asm-offsets.s
iccbin: Command line warning: ignoring option '-W'; no argument required
iccbin: Command line warning: ignoring option '-p'; no argument required
iccbin: Command line warning: ignoring unknown option '-fomit-frame-pointer'
include/linux/kernel.h(10): catastrophic error: could not open source file "stdarg.h"
#include <stdarg.h>
^
compilation aborted for arch/i386/kernel/asm-offsets.c (code 4)
make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 4
make: *** [arch/i386/kernel/asm-offsets.s] Error 2 |
|
|
| Back to top |
|
 |
moocha Watchman

Joined: 21 Oct 2003 Posts: 5722 Location: Cluj-Napoca, Romania
|
Posted: Sun May 23, 2004 5:21 am Post subject: |
|
|
If you're interested in compiling your kernel with icc, take a look at this thread - but be forewarned that an icc-compiled kernel is almost sure not to work. _________________ Military Commissions Act of 2006: http://tinyurl.com/jrcto
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin |
|
| Back to top |
|
 |
lomi n00b


Joined: 09 Jan 2003 Posts: 73
|
Posted: Sun May 23, 2004 9:35 am Post subject: |
|
|
| would this make any difference to an amd user? |
|
| Back to top |
|
 |
moocha Watchman

Joined: 21 Oct 2003 Posts: 5722 Location: Cluj-Napoca, Romania
|
Posted: Sun May 23, 2004 10:20 am Post subject: |
|
|
In theory yes. The Intel compiler produces code that is faster on AMD architectures too. The gain isn't as big as with Intel architectures though (hardly surprising ). _________________ Military Commissions Act of 2006: http://tinyurl.com/jrcto
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin |
|
| Back to top |
|
 |
|