ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lazy SMP in Cheng
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Martin Sedlak



Joined: 26 Nov 2010
Posts: 1753

PostPost subject: Lazy SMP in Cheng    Posted: Mon Feb 02, 2015 1:14 pm Reply to topic Reply with quote

Because some may find it useful, I will attempt to describe how I do lazy smp in cheng:

(actually I just found a bug where minimum qs depth is not copied to helpers before the start of new iteration so right now min qs depth is for helpers now actually depends on maximum depth reached in previous search, I'm not sure if/what impact this may have)

Code:

IterativeDeepening:
    synchronize smp threads (copy age, board, history, repetition list, multipv => helpers)
    depth 1 with full width window on 1 thread
    loop (depth=2 .. max)
        AspirationLoop:
            (as usual)
            start helper threads( depth, alpha, beta )
            root( depth, alpha, beta)
            stop helper threads
            (rest as usual)
        end aspiration loop
    end id loop


Code:

starting helper threads:
    clear smp abort flag
    for each helper thread:
        copy rootmoves and minimum qs depth => helper
        signal helper to start root search at current depth (add 1 for each even helper (assuming 0-based indexing) with aspiration alpha, beta bounds and wait until helper starts searching


note: helper threads run in infinite mode => no need to check for timeout

Code:

aborting helper threads:
    set abort flag for each helper and wait for each to stop searching


The search (including root handling) is the same for master and helpers (no code duplication just a couple of extra trivial conditions).
helpers hold ref pointer to master (if it's 0 it's master) - actually a pointer to abort smp flag would do.
At the end of root search helpers simply set a special flag (abort smp flag) in master.
When master detects abort (smp) flag coming from the helpers (different from typical abort flag),
it scans through helpers and copies score/bestmove/PV from the first helper that finished root.

Pondering doesn't require any special handling (handled by master search thread).

I hope I didn't forget something important, perhaps it even makes sense Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
Lazy SMP in Cheng Martin Sedlak Mon Feb 02, 2015 1:14 pm
      Re: Lazy SMP in Cheng Louis Zulli Mon Feb 02, 2015 2:39 pm
            Re: Lazy SMP in Cheng Martin Sedlak Mon Feb 02, 2015 8:34 pm
                  Re: Lazy SMP in Cheng Joerg Oster Mon Feb 02, 2015 9:42 pm
                        Re: Lazy SMP in Cheng Peter Österlund Mon Feb 02, 2015 10:56 pm
                              Re: Lazy SMP in Cheng Joerg Oster Mon Feb 02, 2015 11:15 pm
                                    Re: Lazy SMP in Cheng Peter Österlund Tue Feb 03, 2015 11:18 pm
                                          Re: Lazy SMP in Cheng Louis Zulli Wed Feb 04, 2015 12:23 am
                                                Re: Lazy SMP in Cheng Lucas Braesch Wed Feb 04, 2015 1:27 am
                                                Re: Lazy SMP in Cheng Gary Wed Feb 04, 2015 2:05 am
                                                      Re: Lazy SMP in Cheng Michel Van den Bergh Wed Feb 04, 2015 9:04 am
                                                            Re: Lazy SMP in Cheng Lucas Braesch Wed Feb 04, 2015 10:32 am
                                                                  Re: Lazy SMP in Cheng Michel Van den Bergh Wed Feb 04, 2015 11:40 am
                                                            Re: Lazy SMP in Cheng Robert Hyatt Thu Feb 05, 2015 1:20 am
                                                Re: Lazy SMP in Cheng Peter Österlund Wed Feb 04, 2015 6:49 pm
                                                      Re: Lazy SMP in Cheng Joerg Oster Wed Feb 04, 2015 8:20 pm
                                                      Re: Lazy SMP in Cheng Robert Hyatt Thu Feb 05, 2015 1:18 am
                                          Re: Lazy SMP in Cheng Joerg Oster Wed Feb 04, 2015 10:49 am
                              Re: Lazy SMP in Cheng Joerg Oster Tue Feb 03, 2015 11:42 am
                                    Re: Lazy SMP in Cheng Robert Hyatt Wed Feb 04, 2015 2:04 am
                                          Re: Lazy SMP in Cheng Joerg Oster Wed Feb 04, 2015 10:30 am
                                                Re: Lazy SMP in Cheng Robert Hyatt Thu Feb 05, 2015 1:14 am
                        Re: Lazy SMP in Cheng Robert Hyatt Mon Feb 02, 2015 11:00 pm
      Re: Lazy SMP in Cheng Marco Belli Mon Feb 02, 2015 7:53 pm
            Re: Lazy SMP in Cheng Martin Sedlak Mon Feb 02, 2015 8:02 pm
                  Re: Lazy SMP in Cheng Marco Belli Mon Feb 02, 2015 8:11 pm
      Re: Lazy SMP in Cheng Mathieu Pagé Wed Feb 04, 2015 4:54 am
            Re: Lazy SMP in Cheng Martin Sedlak Wed Feb 04, 2015 6:22 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads