Linux compile of stockfish rockwood?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

CositasBuenas
Posts: 107
Joined: Tue Aug 03, 2010 7:36 pm

Linux compile of stockfish rockwood?

Post by CositasBuenas »

Hello there,

Is there by any chance a linux compile of stockfish rockwood? Or how do I compile the sources? There is no makefile included.

Best regards, Michael
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Linux compile of stockfish rockwood?

Post by zullil »

CositasBuenas wrote:Hello there,

Is there by any chance a linux compile of stockfish rockwood? Or how do I compile the sources? There is no makefile included.

Best regards, Michael
You could try

Code: Select all

g++ -o stockfish_rw *.cpp
from a src directory.

Didn't compile for me, and I didn't care enough to investigate further:

Code: Select all

MEM_HANDLER.cpp: In function ‘void CREATE_MEM(void**, int, uint64_t)’:
MEM_HANDLER.cpp:27:66: error: ‘printf’ was not declared in this scope
MEM_HANDLER.cpp:28:36: error: ‘MEMALIGN’ was not declared in this scope
MEM_HANDLER.cpp:34:62: error: ‘printf’ was not declared in this scope
MEM_HANDLER.cpp: In function ‘void FREE_MEM(void*)’:
MEM_HANDLER.cpp:46:24: error: ‘ALIGNED_FREE’ was not declared in this scope
MEM_HANDLER.cpp: In function ‘void CREATE_MEM(void**, int, uint64_t)’:
MEM_HANDLER.cpp:56:6: error: redefinition of ‘void CREATE_MEM(void**, int, uint64_t)’
MEM_HANDLER.cpp:20:6: error: ‘void CREATE_MEM(void**, int, uint64_t)’ previously defined here
MEM_HANDLER.cpp:59:33: error: ‘MEM_LARGE_PAGES’ was not declared in this scope
MEM_HANDLER.cpp:59:49: error: ‘MEM_COMMIT’ was not declared in this scope
MEM_HANDLER.cpp:59:60: error: ‘MEM_RESERVE’ was not declared in this scope
MEM_HANDLER.cpp:59:72: error: ‘PAGE_READWRITE’ was not declared in this scope
MEM_HANDLER.cpp:59:86: error: ‘VirtualAlloc’ was not declared in this scope
MEM_HANDLER.cpp:63:59: error: ‘printf’ was not declared in this scope
MEM_HANDLER.cpp:67:64: error: ‘printf’ was not declared in this scope
MEM_HANDLER.cpp:68:34: error: ‘MEMALIGN’ was not declared in this scope
MEM_HANDLER.cpp: In function ‘void CREATE_MEM2(void**, int, uint64_t)’:
MEM_HANDLER.cpp:75:33: error: ‘MEM_LARGE_PAGES’ was not declared in this scope
MEM_HANDLER.cpp:75:49: error: ‘MEM_COMMIT’ was not declared in this scope
MEM_HANDLER.cpp:75:60: error: ‘MEM_RESERVE’ was not declared in this scope
MEM_HANDLER.cpp:75:72: error: ‘PAGE_READWRITE’ was not declared in this scope
MEM_HANDLER.cpp:75:86: error: ‘VirtualAlloc’ was not declared in this scope
MEM_HANDLER.cpp:79:59: error: ‘printf’ was not declared in this scope
MEM_HANDLER.cpp: In function ‘void FREE_MEM(void*)’:
MEM_HANDLER.cpp:83:6: error: redefinition of ‘void FREE_MEM(void*)’
MEM_HANDLER.cpp:40:6: error: ‘void FREE_MEM(void*)’ previously defined here
MEM_HANDLER.cpp:88:24: error: ‘ALIGNED_FREE’ was not declared in this scope
MEM_HANDLER.cpp:91:28: error: ‘MEM_RELEASE’ was not declared in this scope
MEM_HANDLER.cpp:91:39: error: ‘VirtualFree’ was not declared in this scope
MEM_HANDLER.cpp: In function ‘void SETUP_PRIVILEGES()’:
MEM_HANDLER.cpp:96:6: error: redefinition of ‘void SETUP_PRIVILEGES()’
MEM_HANDLER.cpp:19:6: error: ‘void SETUP_PRIVILEGES()’ previously defined here
MEM_HANDLER.cpp:99:5: error: ‘HANDLE’ was not declared in this scope
MEM_HANDLER.cpp:99:12: error: expected ‘;’ before ‘token_handle’
MEM_HANDLER.cpp:100:5: error: ‘TOKEN_PRIVILEGES’ was not declared in this scope
MEM_HANDLER.cpp:100:22: error: expected ‘;’ before ‘tp’
MEM_HANDLER.cpp:102:40: error: ‘GetCurrentProcess’ was not declared in this scope
MEM_HANDLER.cpp:102:42: error: ‘TOKEN_ADJUST_PRIVILEGES’ was not declared in this scope
MEM_HANDLER.cpp:102:66: error: ‘TOKEN_QUERY’ was not declared in this scope
MEM_HANDLER.cpp:102:79: error: ‘token_handle’ was not declared in this scope
MEM_HANDLER.cpp:102:91: error: ‘OpenProcessToken’ was not declared in this scope
MEM_HANDLER.cpp:103:59: error: ‘TEXT’ was not declared in this scope
MEM_HANDLER.cpp:103:62: error: ‘tp’ was not declared in this scope
MEM_HANDLER.cpp:103:83: error: ‘LookupPrivilegeValue’ was not declared in this scope
MEM_HANDLER.cpp:105:33: error: ‘SE_PRIVILEGE_ENABLED’ was not declared in this scope
MEM_HANDLER.cpp:106:58: error: ‘AdjustTokenPrivileges’ was not declared in this scope
MEM_HANDLER.cpp:107:29: error: ‘CloseHandle’ was not declared in this scope
tbcore.cpp: In function ‘void init_tb(char*)’:
tbcore.cpp:229:20: error: ‘Tablebases’ has not been declared
tbcore.cpp:230:5: error: ‘Tablebases’ has not been declared
tbcore.cpp: At global scope:
tbcore.cpp:259:6: error: ‘Tablebases’ has not been declared
tbcore.cpp:259:29: error: ‘string’ in namespace ‘std’ does not name a type
tbcore.cpp:259:42: error: ISO C++ forbids declaration of ‘path’ with no type [-fpermissive]
tbcore.cpp: In function ‘void init(const int&)’:
tbcore.cpp:284:24: error: request for member ‘c_str’ in ‘path’, which is of non-class type ‘const int’
tbcore.cpp:307:3: error: ‘TBLargest’ was not declared in this scope
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linux compile of stockfish rockwood?

Post by syzygy »

CositasBuenas wrote:Is there by any chance a linux compile of stockfish rockwood? Or how do I compile the sources? There is no makefile included.
Support for large pages is most likely Windows-specific, since it is not necessary for Linux.

If you take away support for large pages, what is left is http://abrok.eu/stockfish_syzygy/ plus some cosmetic patches.
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: Linux compile of stockfish rockwood?

Post by phenri »

syzygy wrote:
CositasBuenas wrote:Is there by any chance a linux compile of stockfish rockwood? Or how do I compile the sources? There is no makefile included.
Support for large pages is most likely Windows-specific, since it is not necessary for Linux.

If you take away support for large pages, what is left is http://abrok.eu/stockfish_syzygy/ plus some cosmetic patches.
I'm curious to hear your opinion on this:
https://github.com/gmg78/Stockfish/comm ... 096aeb0a15
Do you think this is also cosmetic?
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linux compile of stockfish rockwood?

Post by syzygy »

phenri wrote:
syzygy wrote:
CositasBuenas wrote:Is there by any chance a linux compile of stockfish rockwood? Or how do I compile the sources? There is no makefile included.
Support for large pages is most likely Windows-specific, since it is not necessary for Linux.

If you take away support for large pages, what is left is http://abrok.eu/stockfish_syzygy/ plus some cosmetic patches.
I'm curious to hear your opinion on this:
https://github.com/gmg78/Stockfish/comm ... 096aeb0a15
Do you think this is also cosmetic?
Huge pages? Huge pages = large pages. See the comment you quoted.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linux compile of stockfish rockwood?

Post by syzygy »

Ok, the patch you link to uses hugetlbfs to allocate huge pages / large pages. This needs special configuration.

Without it, Linux will use transparent huge pages. This happens automatically. I don't think the difference is "huge".

https://www.kernel.org/doc/Documentatio ... nshuge.txt
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: Linux compile of stockfish rockwood?

Post by phenri »

Thank you
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linux compile of stockfish rockwood?

Post by syzygy »

phenri wrote:Thank you
If you're running Linux, you can verify whether SF uses huge pages by typing

Code: Select all

$ cat /proc/meminfo
and looking at AnonHugePages, e.g. before and after starting SF. But it may be that the number of huge pages increases while SF is running (as far as I understand the OS tries to defragment memory in order to make space for huge pages).

For more precise information you can look at

Code: Select all

$ cat /proc/<pid>/smaps | grep Huge
where <pid> is the pid of the SF process (see top or ps).

To increase the chances of SF finding many huge pages, clear the page cache before starting SF (you'll need to be root):

Code: Select all

echo 1 >/proc/sys/vm/drop_caches
This has the downside of dropping all cached TB information from previous engine runs.
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: Linux compile of stockfish rockwood?

Post by phenri »

According to its author, the difference is not so huge in fact.
https://groups.google.com/d/msg/fishcoo ... YkC9TZi2MJ
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Linux compile of stockfish rockwood?

Post by syzygy »

phenri wrote:According to its author, the difference is not so huge in fact.
https://groups.google.com/d/msg/fishcoo ... YkC9TZi2MJ
On my machine that is currently doing all kinds of calculations I started one instance of SF, allocated 8192 MB hash and started a search. In /proc/<sf-pid>/smaps I find:

Code: Select all

AnonHugePages&#58;   8386560 kB
So 8190 MB of huge pages and just 2 MB of regular pages. Clearly transparent huge pages works quite well.

On a machine with not so much RAM it might be different, but then you certainly don't want to reserve a large proportion of your RAM exclusively for hash table use.