Problem to make a icc compile of crafty 21.6

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Problem to make a icc compile of crafty 21.6

Postby Volker Pittlik » 31 Oct 2007, 11:01

Using the Makefile coming with it I have no problems to make an executable for my 32-bit Suse 10.2 computer with gcc.

Icc-profile does work too, the problem begins when I try to make profiling step 2:

volker@vpittlik:~/schach/crafty/21.6> make -j linux-icc

... things are going alright nearly to the end until ...

egtb.cpp(5267): (col. 9) remark: LOOP WAS VECTORIZED.
tbdecode.h(637): (col. 9) remark: BLOCK WAS VECTORIZED.
egtb.cpp(5151): (col. 5) remark: BLOCK WAS VECTORIZED.
egtb.cpp: warning #11503: Total routines 1066, routines w/o profile info: 1053
icc -lstdc++ -o crafty crafty.o egtb.o -lm
crafty.o: In function `DisplayChessBoard.':
crafty.c:(.text+0xe1cd): undefined reference to `__svml_irem4'
make[2]: *** [crafty] Fehler 1

(German: Fehler = Error).

After some searches I found out it has something to do with Intel's "Short Vector Math Library". I tried the solution published here:

http://www.intel.com/cd/ids/developer/asmo-na/eng/81970.htm

I copied the code to a file I named "intel-stuff.h" and added the line

#include "intel-stuff.h" to crafty.c.

That didn't help a lot because now I get:

intel-stuff.h(9): error: expected an identifier
extern "C" { __m128d vmldExp2(__m128d a); }
^

intel-stuff.h(9): error: expected a ";"
extern "C" { __m128d vmldExp2(__m128d a); }
^

compilation aborted for crafty.c (code 2)
make[2]: *** [crafty.o] Fehler 2


All hints appreciated.

Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Problem to make a icc compile of crafty 21.6

Postby Roman Hartmann » 31 Oct 2007, 15:05

Hi Volker,
I just tried to compile crafty with profiling and it works somehow for me. I write somehow because the binary created after the profiling is actually slower than the one used for the profiling. Although the profiling consisted only of analyzing a single position for about 5 minutes as I only wanted to see if profiling actually works.

The only issues I initially had was due a missing lib (libstdc++) the linker complained about.

Did you adjust the Makefile between the two compiles? Probably you did but it took me a minute to figure out that I have to modify some flags between the compiles.

best regards
Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21

Re: Problem to make a icc compile of crafty 21.6

Postby Volker Pittlik » 31 Oct 2007, 15:28

Roman Hartmann wrote:... the binary created after the profiling is actually slower than the one used for the profiling...

...

Did you adjust the Makefile between the two compiles? Probably you did but it took me a minute to figure out that I have to modify some flags between the compiles...


I guess it can be expected that the executable after using "make -j linux-icc-profile" (with -prof_genx in it) is slower. That executable runs here and creates a *.dyn file in the profdir.

Am I wrong I have to use "make -j linux-icc" (with -prof_use in it) to get the faster executable? I don't see what to change else.

Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Problem to make a icc compile of crafty 21.6

Postby Roman Hartmann » 31 Oct 2007, 15:36

Volker Pittlik wrote:
Roman Hartmann wrote:... the binary created after the profiling is actually slower than the one used for the profiling...

...

Did you adjust the Makefile between the two compiles? Probably you did but it took me a minute to figure out that I have to modify some flags between the compiles...


I guess it can be expected that the executable after using "make -j linux-icc-profile" (with -prof_genx in it) is slower. That executable runs here and creates a *.dyn file in the profdir.

Am I wrong I have to use "make -j linux-icc" (with -prof_use in it) to get the faster executable? I don't see what to change else.

Volker


Well, I'm not an expert regarding icc as I usually use gcc but my understanding is that you need to compile first with -prof_gen then use the created binary to gather data (the *.dyn file) and then recompile with -prof_use. At least that's what I did and it does work here.

As far as I can see you do everything right.

I'm using ubuntu here and not SuSE btw.

Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21

Re: Problem to make a icc compile of crafty 21.6

Postby Roman Hartmann » 31 Oct 2007, 16:55

Ok, seems doing several things at the same time is no good idea. Now I get exactly the same errors like you get. Probably I just compiled two times with -prof_gen before ...

It looks like a linking issue to me.

Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21

Re: Problem to make a icc compile of crafty 21.6

Postby bob » 31 Oct 2007, 19:20

Volker Pittlik wrote:
Roman Hartmann wrote:... the binary created after the profiling is actually slower than the one used for the profiling...

...

Did you adjust the Makefile between the two compiles? Probably you did but it took me a minute to figure out that I have to modify some flags between the compiles...


I guess it can be expected that the executable after using "make -j linux-icc-profile" (with -prof_genx in it) is slower. That executable runs here and creates a *.dyn file in the profdir.

Am I wrong I have to use "make -j linux-icc" (with -prof_use in it) to get the faster executable? I don't see what to change else.

Volker


I don't use the -j, because I use the "crafty.c" file for compiling which crams everything together for max inlining. But it compiles and runs fine here on my suse 10.2 laptop (64 bits) my suse 10.2 dual xeon office (32 bit) and on two different 64 bit clusters we have. Sounds like a missing or uninstalled library.
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59

Re: Problem to make a icc compile of crafty 21.6

Postby Roman Hartmann » 31 Oct 2007, 20:51

Ok, finally I was able to compile it with icc profiling enabled.

For some strange reason utility.c is causing some troubles here (DisplayChessBoard() to be exact) and utility.c has to be compiled separately with profiling disabled in order to get no errors when linking the object files together.

Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21

Re: Problem to make a icc compile of crafty 21.6

Postby bob » 31 Oct 2007, 21:49

Roman Hartmann wrote:Ok, finally I was able to compile it with icc profiling enabled.

For some strange reason utility.c is causing some troubles here (DisplayChessBoard() to be exact) and utility.c has to be compiled separately with profiling disabled in order to get no errors when linking the object files together.

Roman


No idea why as I don't have to do that. Do you have the latest ICC version??? As a note, I always copy the icc lib files into the system /lib directory, as there are no name conflicts, and that prevents any sort of LD_LIBRARY_PATH glitch...
User avatar
bob
 
Posts: 156
Joined: 10 May 2006, 17:59

Re: Problem to make a icc compile of crafty 21.6

Postby Roman Hartmann » 01 Nov 2007, 09:10

bob wrote:
Roman Hartmann wrote:Ok, finally I was able to compile it with icc profiling enabled.

For some strange reason utility.c is causing some troubles here (DisplayChessBoard() to be exact) and utility.c has to be compiled separately with profiling disabled in order to get no errors when linking the object files together.

Roman


No idea why as I don't have to do that. Do you have the latest ICC version??? As a note, I always copy the icc lib files into the system /lib directory, as there are no name conflicts, and that prevents any sort of LD_LIBRARY_PATH glitch...


I just downloaded and installed the newest version of the intel compiler on my laptop and also copied the lib files to /lib. But still the same behaviour.

But anyway in my case the problem seems to be related to the -xN switch. If I remove that from linux-icc-profile and linux-icc in the Makefile it compiles and links just fine.

Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21

Re: Problem to make a icc compile of crafty 21.6

Postby Volker Pittlik » 01 Nov 2007, 09:12

bob wrote:...Do you have the latest ICC version??? As a note, I always copy the icc lib files into the system /lib directory...


I run icc 10.0 20070426 here. However, none of the suggestions solved the problem here.

Googling a bit I found a simple and trivial solution: adding " -lsvml" to "LDFLAGS='$(LDFLAGS) -lstdc++' " changing it to "LDFLAGS='$(LDFLAGS) -lstdc++ -lsvml' " solved the problem here.

Now I'm playing around a bit with the other options. Using -xT, -fast and -ipo gave me the fastest executable so far. But the differences may be just random. But all icc compilations are much faster than those made with gcc.


Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Problem to make a icc compile of crafty 21.6

Postby Sven Schüle » 01 Nov 2007, 14:17

Volker Pittlik wrote:Now I'm playing around a bit with the other options. Using -xT, -fast and -ipo gave me the fastest executable so far. But the differences may be just random. But all icc compilations are much faster than those made with gcc.

Hi Volker,

as I already mentioned some weeks ago in a private email to you, the -fast flag implicitly also sets -xT and -ipo, so you probably don't get a faster result with "-xT -fast -ipo" compared to using only "-fast".

Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: Problem to make a icc compile of crafty 21.6

Postby Volker Pittlik » 01 Nov 2007, 14:55

Sven Schüle wrote:...
as I already mentioned some weeks ago in a private email to you, the -fast flag implicitly also sets -xT and -ipo, so you probably don't get a faster result with "-xT -fast -ipo" compared to using only "-fast".

Sven


Yes. However, the testresults of the bench command differ up to three seconds if different options are in use. I have no explanation for it but report only what I got here. In the documentation of icc experimenting with options is recommended. I know for sure Glaurung needs other options than Fruit for example.

However, the main problem is solved and that makes me more happy than 2 or 3% more or less speed.

Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 8 guests