Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase thread stack for OS X #2035

Merged
merged 5 commits into from
Mar 12, 2019

Conversation

mcostalba
Copy link

 On OSX threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.

On OSX threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

No bench change.
This is illegal, although practically it works.
But be a good C++ citizens and do it the proper way.

No functiona change.
start_routine() is called at random time, possibly
after we exit NativeThread() c'tor, so ensure our
pair of arguments don't go out of scope.
Copy link
Member

@vondele vondele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a good option to me

@@ -67,4 +67,47 @@ typedef std::condition_variable ConditionVariable;

#endif

#if !defined(_MSC_VER) // defined(__APPLE__) FIXME when done with testing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME... APPLE only?

src/thread_win32.h Outdated Show resolved Hide resolved
And rename the files accordingly.
@MichaelB7
Copy link
Contributor

The proposed patch addresses the issue on macOS on the initial position where this issue was discovered using 23 threads , Stockfish ran for nearly 15 minutes benfore I stopped it. Previously it had generally crashed under 60 seconds.

Stockfish 100319 64 POPCNT by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
uci
id name Stockfish 100319 64 POPCNT
id author T. Romstad, M. Costalba, J. Kiiski, G. Linscott

option name Debug Log File type string default 
option name Contempt type spin default 24 min -100 max 100
option name Analysis Contempt type combo default Both var Off var White var Black var Both
option name Threads type spin default 1 min 1 max 512
option name Hash type spin default 16 min 1 max 131072
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Move Overhead type spin default 30 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name Slow Mover type spin default 84 min 10 max 1000
option name nodestime type spin default 0 min 0 max 10000
option name UCI_Chess960 type check default false
option name UCI_AnalyseMode type check default false
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name Syzygy50MoveRule type check default true
option name SyzygyProbeLimit type spin default 7 min 0 max 7
uciok
isready
readyok
position fen 8/2p1p1p1/2P1P1Pp/P4K2/P7/p2p4/rppP3P/qkn4R w - -
setoption name threads value 23
go infinite
info depth 1 seldepth 1 multipv 1 score cp -1984 nodes 388 nps 27714 tbhits 0 time 14 pv a5a6
info depth 2 seldepth 2 multipv 1 score cp 0 nodes 3818 nps 272714 tbhits 0 time 14 pv h2h3 h6h5
info depth 3 seldepth 3 multipv 1 score cp 0 nodes 4747 nps 339071 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 4 seldepth 4 multipv 1 score cp 0 nodes 5736 nps 409714 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 5 seldepth 4 multipv 1 score cp 0 nodes 6694 nps 478142 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 6 seldepth 4 multipv 1 score cp 0 nodes 7564 nps 540285 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 7 seldepth 4 multipv 1 score cp 0 nodes 8640 nps 617142 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 8 seldepth 4 multipv 1 score cp 0 nodes 9372 nps 669428 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 9 seldepth 4 multipv 1 score cp 0 nodes 10162 nps 725857 tbhits 0 time 14 pv h2h3 h6h5 h3h4
info depth 10 seldepth 4 multipv 1 score cp 0 nodes 11211 nps 800785 tbhits 0 time 14 pv h2h3 h6h5 h3h4
...
info depth 122 seldepth 4 multipv 1 score cp 0 nodes 28499245493 nps 31694564 hashfull 1000 tbhits 0 time 899184 pv h2h3 h6h5 h3h4
bestmove h2h3 ponder h6h5

@mcostalba
Copy link
Author

@MichaelB7 Thank you for confirming!

@snicolet
Copy link
Member

Looks good to me

@mcostalba mcostalba merged commit bad18bc into official-stockfish:master Mar 12, 2019
@mcostalba mcostalba deleted the os_x_stack branch March 12, 2019 07:35
@mcostalba mcostalba mentioned this pull request Mar 12, 2019
MichaelB7 added a commit to MichaelB7/Stockfish that referenced this pull request Mar 12, 2019
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Mar 12, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Apr 11, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Apr 24, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Apr 27, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Apr 27, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Apr 29, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request May 2, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
MichaelB7 pushed a commit to MichaelB7/Stockfish that referenced this pull request May 9, 2019
Do no LMR for the first four moves if at root node.

STC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 19686 W: 4524 L: 4261 D: 10901
http://tests.stockfishchess.org/tests/view/5cd3577b0ebc5925cf04a089

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 88335 W: 15193 L: 14766 D: 58376
http://tests.stockfishchess.org/tests/view/5cd35e600ebc5925cf04a1c3

Bench: 3184182
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request May 19, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request May 19, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request May 21, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request May 23, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Jun 19, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Jun 27, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Jun 27, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Jul 31, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Aug 1, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Aug 29, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
pb00068 pushed a commit to pb00068/Stockfish that referenced this pull request Sep 10, 2019
On OS X threads other than the main thread are created with a reduced stack
size of 512KB by default, this is dangerously low for deep searches, so
adjust it to TH_STACK_SIZE. The implementation calls pthread_create() with
proper stack size parameter.

Verified for no regression at STC enabling the patch on all platforms where
pthread is supported.

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 50873 W: 9768 L: 9700 D: 31405

No functional change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants