There is now a batch analyse function in the graphical version of gnubg (actually also in the text) that you mind find useful.

C

On 3/2/21 11:03 AM, Chris Wilson wrote:
Thanks Ian. I run these batches overnight, but it won't hurt to add 'set priority to idle'. I am running an i7 processor, so I'll also add 'set threads to 4'. The whole point of this exercise is that I ran across a ton of match files from 15-20 years ago and I'm interested in the difference in analysis over the years. I even located my copy of Snowie4.

Chris

On Tue, Mar 2, 2021 at 1:35 AM Ian Shaw <ian.s...@riverauto.co.uk <mailto:ian.s...@riverauto.co.uk>> wrote:

    Hi Chris,

     I think Jim is recommending that you have a copy of
    .gnubg/gnubgautorc.rc with your preferred settings for batch
    analysis.

    In the batch file, before running gnubg, you can have

    rename .gnubg/gnubgautorc.rc .gnubg/gnubgautorc.rc.play and
    rename .gnubg/gnubgautorc.rc.batch .gnubg/gnubgautorc.rc.

    run gnubg bg with commands

    Then do the reverse at the end of the batch file to restore the
    original settings.

    I don’t see much difference between doing that and loading a
    command file within gnubg. I suppose the main point is to,
    whichever way you do it, restore the settings that you use when
    not doing batch analysis, if they are different to your regular
    settings.

    Set threads n is the command to use to specify a number of
    threads. You’d have to look up the number of cores your processor
    has, and double it if you have a multithreading processor like an i7.

    I’d do it differently though. I’d use set priority low or set
    priority idle. This would let gnubg use all the power when nothing
    else is happening, but back off on hogging resources when you’re
    doing other stuff. I have set priority idle as a permanent setting.

    Cheers,
    Ian

    From: Bug-gnubg [mailto:bug-gnubg-bounces+ian.shaw
    <mailto:bug-gnubg-bounces%2Bian.shaw>=riverauto.co...@gnu.org
    <mailto:riverauto.co...@gnu.org>] On Behalf Of Chris Wilson
    Sent: 02 March 2021 02:12
    To: Philippe Michel <philippe.mich...@free.fr
    <mailto:philippe.mich...@free.fr>>
    Cc: bug-gnubg@gnu.org <mailto:bug-gnubg@gnu.org>
    Subject: Re: No command line?

    Thanks to everyone for the information. Ok, I put the following
    lines into a file called matches01.txt:

    ---
    set cache 1048576
    set cube use on

    set analysis movefilter 1  0  4 12 0.32
    set analysis movefilter 2  0  4 12 0.32
    set analysis movefilter 2  1  -1 0 0
    set analysis movefilter 3  0  4 12 0.32
    set analysis movefilter 3  1  -1 0 0
    set analysis movefilter 3  2  0 4 0.08
    set analysis movefilter 4  0  4 12 0.32
    set analysis movefilter 4  1  -1 0 0
    set analysis movefilter 4  2  0 4 0.08
    set analysis movefilter 4  3  -1 0 0

    set analysis cubedecision eval plies 4
    set analysis chequerplay eval plies 4

    set analysis luckanalysis plies 2
    set analysis luckanalysis prune on

    import mat 'G:\NewMatches\scoper10.mat'
    analyze match
    save match 'G:\NewMatches\Analyzed\scoper10.sgf'
    relational add match
    ---

    I then executed the command gnubg-cli.exe -c matches01.txt and I
    received an 'Invalid argument' error. (I'm on Windows 10) I
    removed the quotes from around the paths and the error went away.
    (The quotes were a requirement 15 years ago)  With respect to the
    "set analysis" parameters, are you saying to place them into a
    separate file and then issue a "load commands <parameters file>"
    from within the script?

    BTW, what do I issue to set the threads to half the cores?

    Chris

    On Mon, Mar 1, 2021 at 2:26 PM Philippe Michel
    <philippe.mich...@free.fr <mailto:philippe.mich...@free.fr>> wrote:
    On Mon, Mar 01, 2021 at 09:23:49PM +0100, Jim Segrave wrote:

    > And I then run gnubg:
    >
    > /usr/local/bin/gnubg -t -c /tmp/4413280.cmd
    >
    > This works exactly as it should

    On Windows the equivalent of gnubg -t is gnubg-cli.exe and the -c
    option
    works juste the same :
    %homepath%\AppData\Local\gnubg\gnubg-cli.exe -c cmdfile.cmd
    or something similar.

    > My advice for setting options like the luckanalysis ones would
    be to
    > save your current .gnubg/gnubgautorc.rc file and replace it one
    with the
    > settings you want here, then put the original back when you're
    done.
    > Unfortunately, there's no command line option to specify the
    > configuration file to use.

    The gnubgautorc file is huge and full of irrelevant parameters. It
    would
    probably be simpler to start the analysis command files with a "load
    commands <parameters file>", the parameters file containing the
    kind of
    commands Chris shows at the beginnig of his script.

    FWIW, for 4 ply analysis I use:

    set cube use on

    set analysis movefilter 1  0  4 12 0.32
    set analysis movefilter 2  0  4 12 0.32
    set analysis movefilter 2  1  -1 0 0
    set analysis movefilter 3  0  4 12 0.32
    set analysis movefilter 3  1  -1 0 0
    set analysis movefilter 3  2  0 4 0.08
    set analysis movefilter 4  0  4 12 0.32
    set analysis movefilter 4  1  -1 0 0
    set analysis movefilter 4  2  0 4 0.08
    set analysis movefilter 4  3  -1 0 0

    set analysis cubedecision eval plies 4
    set analysis chequerplay eval plies 4

    set analysis luckanalysis plies 2
    set analysis luckanalysis prune on


    > On 3/1/21 2:55 PM, Chris Wilson wrote:
    > > Years ago I would batch analyze my matches. I wrote a program
    that
    > > created entries in the following format (minus the dashes):
    > >
    > > ---
    > > set cache 65536
    > > set Priority Idle
    > > set analysis luckanalysis plies 2
    > > set analysis luckanalysis reduced 2
    > > set analysis luckanalysis cubeful on
    > >
    > > import mat 'G:\NewMatches\scoper10.mat'
    > > analyze match
    > > save match 'G:\NewMatches\Analyzed\scoper10.sgf'
    > > relational add match

    reduced is not used any more but everything else should still work.
    Maybe set cache larger since current computers have plenty of
    memory, or
    rely on the default value set from the GUI. Maybe set threads to some
    value lower than the number of cores of your machine (half of them
    ?) if
    you run that while doing something else.

    > > I would like to accomplish the same task at
    > > 4-ply as well as automate rollouts on some matches.

    "Automating rollouts on a match" is tricky. There are commands to
    mark
    moves or cube decsions to be rolled out later. That's fine from
    the GUI
    or to roll out a list of positions with command files like:

    set matchid cAm1ABAAGAAA
    set board f/sAACDsdgsKAA
    hint
    cmark move set rollout 1 2
    analyse rollout move
    save position pos.sgf

    or

    set matchid cAmgABAAGAAA
    set board //YAAEDtthsAAA
    hint
    cmark cube set rollout
    analyse rollout cube
    export position text pos.txt

    But there is no easy way to select them automatically in a whole
    match.
    A way to do this would be to analyse it at, say, 3 ply, and have
    commands
    like:

    cmark move set rollout analysed plies 3
    cmark cube set rollout analysed plies 3
    analyze rollout match

    to roll out the errors and the decisions close enough for the move
    filters to select them for 3 ply analysis.

    alas, the first two don't exist... It may be possible to do this with
    the python interface, or to add the above commands to gnubg.

Reply via email to