Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: odd multithreaded search behavior--explanation?

Author: Mike Curtis

Date: 02:19:53 05/26/00

Go up one level in this thread


On May 26, 2000 at 02:49:55, Tom Kerrigan wrote:

>I've been writing a multithreaded program. I'm running on 1 processor but my
>program splits into 4 threads. So far, the threads don't communicate in any way,
>so searches take exactly 4 times as long (not counting some overhead).
>
>But this evening I added a shared hash table, and now the threads=4 program is
>only slightly slower (in terms of NPS and nodes/ply) than the threads=1 program.
>

Perfect! That's what I would expect.

Since you are already in the neighborhood, I'll go ahead and share the following
idea.

Also because my annotated TODO list has almost as many lines as my chess
program.

I haven't done so, but I strongly suspect it's possible for a multi-threaded
version of a chess program to outperform the corresponding single-threaded
version, on the same single-processor machine.

Sometime last month I was thinking about multiprocessing and how most
designs utilize a symmetrical model.

But what if you just had one fast machine and two slower ones? What then?

Most programmers reading this far have already guessed where this is going
but I'll finish typing this message anyhow.

One way to split the tree search is right at the root.

process 1 => alpha_beta(MAX_EVAL, VALUE1)
process 2 => alpha_beta(VALUE1, VALUE2)
process 3 => alpha_beta(VALUE2, MAX_EVAL)

I would let the fast machine search process 2 above.

On a single-processor machine I would grant the 2nd thread a higher priority.

This method of multiprocessing probably doesn't scale well,
but it is easy to code and ....

It just might outperform a corresponding single-threaded approach.

Similar to aspiration searching, but never having to restart the search with a
wider window, because at least one of the processes will succeed.

Anyhow it passes my the stare-at-the-screen visualization test.

What do you think?

"People tell me I'm a NUT for reinventing the wheel,
for example this hexagonal one here..."

FathomEngine

-Mike


>Is this some sort of mistake? I tried for almost an hour to prove that something
>flakey is going on, but it seems to really go 4 times faster, even though the
>threads don't communicate (except for the hash table). The PVs and scores that
>the programs spit out are exactly the same, and the threads seem to be sharing
>the work equally.
>
>Could this be some sort of side effect from running on 1 processor?
>
>Thanks for any comments.
>
>-Tom



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.