lazy smp using ms vs2015 c++11 std::async

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

edwardyu
Posts: 34
Joined: Mon Nov 17, 2008 6:58 am

lazy smp using ms vs2015 c++11 std::async

Post by edwardyu »

I have just use ms vs2015 c++11 std::async to implement lazy smp for my xiangqi engine. I ran 2-rounds 1'+1" with 3 versions on an Intel i3 (2cores+2HT) under Windows 10:-

Final Result:
--------------------------------------------------------------------------------
No. 引擎 ELO K 胜(W) 和(D) 负(L) 积分(pts)
--------------------------------------------------------------------------------
1 eychessu2892u_2cores 2504 10 2 5 1 9
2 eychessu2892u_1cores 2501 10 2 4 2 8
3 eychessu2892u_4cores 2495 10 1 5 2 7
========================================

My questions are :
1. How many games and what time control should be played in order to confirm the effectiveness of lazy smp ?
2. Is HyperThread still not favorable for lazy smp ? (Does Stockfish use HT ?)

Thanks, Edward
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: lazy smp using ms vs2015 c++11 std::async

Post by jdart »

Re: 1 use something like BayesELO that will give you error bars.

Re 2 I recommend disabling hyperthreading.

--Jon
NowCan
Posts: 7
Joined: Mon Aug 13, 2007 10:16 am

Re: lazy smp using ms vs2015 c++11 std::async

Post by NowCan »

To edwardyu, is your engine a UCCI engine ?
I remember, a engine named EychessU played UCCI league 5 years ago.

Good luck !
APassionForCriminalJustic
Posts: 417
Joined: Sat May 24, 2014 9:16 am

Re: lazy smp using ms vs2015 c++11 std::async

Post by APassionForCriminalJustic »

jdart wrote:Re: 1 use something like BayesELO that will give you error bars.

Re 2 I recommend disabling hyperthreading.

--Jon
Prove that today's modern hyperthreading is bad first. I use Stockfish with hyperthreading enabled going from 36 physical to 72 logical; it shows great performance - and huge NPS. Time to depth is still great. Hyperthreading has come a lonnnnngggg way, not to mention the Intel CPUs that use it.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: lazy smp using ms vs2015 c++11 std::async

Post by jdart »

It is possible that some programs might benefit from it.

However, two hyperthread cores in the same execution unit share everything in the memory system. So it is possible for HT to increase memory contention, especially when RAM is limited and is being heavily utilized. (There is a pretty recent paper that basically says this: https://www.nas.nasa.gov/assets/pdf/pap ... g_2011.pdf).

--Jon
edwardyu
Posts: 34
Joined: Mon Nov 17, 2008 6:58 am

Re: lazy smp using ms vs2015 c++11 std::async

Post by edwardyu »

Yes, Eychessu is my Xiangqi engine. I have been away from computer chess for sometime and pick it now, Before heard of lazy smp, I have tried using MS VC++ PPL to implement smp with splitting at the PV and non-PV nodes, but the result was worse than single thread (due to the vast overhead of concurrency) !!!

Instead of setting up threadpool, I like the simplicity of std::async. However, I found that even I use 2 real-core threads (no HT) to run lazy smp, the result is marginally break-even to offset the smp overhead.