How to run stockfish with hugepages under linux

Discussion of chess software programming and technical issues.

Moderator: Ras

BeyondCritics
Posts: 414
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

How to run stockfish with hugepages under linux

Post by BeyondCritics »

You can run stockfish and most other applications under linux with hugetables, even if they are not programmed for this.
Under Ubuntu: First install the packet "hugepages":

Code: Select all

sudo apt-get install hugepages
Next run stockfish like that:

Code: Select all

hugectl --heap stockfish
This should work also:

Code: Select all

LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=thp stockfish
I have written myself a small shell script, so that i can test this from any gui:

Code: Select all

! /bin/sh
#export LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=thp
#exec stockfish "$@"
hugectl --heap stockfish "$@"
For stockfish with a very large hash table this really makes a very noticeable difference in nps.

This works by intercepting the dynamic calls to malloc, therefore it should work for any engine.