How to get ScorpioNN to work?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Dokterchen
Posts: 133
Joined: Wed Aug 15, 2007 12:18 pm
Location: Munich

How to get ScorpioNN to work?

Post by Dokterchen »

Hi all,

I have a machine with WIN10 and RTX 2070. I have installed the WIN10 Ubuntu app and I used Scorpio's shell script (install.sh). And except the update of the ini file the script seems to work well. Now I have that file structure:

C:\Data\scorpio\Scorpio-16-Jul-2019\bin\Windows
C:\Data\scorpio\Scorpio-16-Jul-2019\nets-maddex
C:\Data\scorpio\Scorpio-16-Jul-2019\nnprobe-windows-gpu

Is that correct? Will Scorpio automatically find the DLLs in the "nnprobe-windows-gpu" directory? I ask because I get no information about the nn part of Scorpio in the log:

Code: Select all

ht 67108864 X 16 = 1024.0 MB
eht 524288 X 8 = 8.0 MB
pht 32768 X 24 = 0.8 MB
treeht 1342169600 X 10 = 12799.9 MB
processors [128]
<COMMAND LINE>
loading_time = 0s
==============================
I have edit the ini file with the informations from the bash shell manually. My ini file:

Code: Select all

#############################################
# log on/off   - turn logging on and off
# resign       - resign value in centipawns
#############################################
log                 on
resign              800
##################################################################
# Hashtable sizes in mb.
#      ht - main hash table shared by ALL threads
#     eht - evalualtion hash table allocated PER thread
#     pht - pawn hash table allocated PER thread
# Usually 1m or 2mb is enough for pawn hash table, but the others
# can be set as high as possible
##################################################################
ht  	            1024
eht                 8
pht                 1
##################################################################
# montecarlo - Use montecarlo tree search (MCTS) if set to 1
# treeht - Maximum size of tree to store in memory given in MB.
#          Note that this memory is not allocated at start up; it only
#          specifies the maximum limit the tree could grow to.
#          Note: Don't think you are making scorpio weak by not setting
#          this memory to high value, infact treeht=0 is the strongest 
#          MCTS setting.
# frac_freeze_tree    [0 - 100] - freeze tree after this percentage of time is spent
# frac_alphabeta      [0 - 100] - use alpha-beta search this percent of the time
# frac_abrollouts     [0 - 100] - use alpha-beta rollouts search this percent of the time
# mcts_strategy_depth [0 - 64]  - Lookahead depth for MCTS rollouts
# alphabeta_depth     [0 - 64]  - Fixed search depth for standard alphabeta searches at the leaves
# evaluate_depth      [-4 - 64]  - Fixed search depth for evaluation of new children during expansion 
#                                (-4=eval,-3=see,-2=recap qsearch,-1=no-checks qsearch 0=qsearch,x=search)
# backup_type         [0 - 7]   - minmax = 0, averaging = 1, mixed = 2, for mixing score with 
#                                 previous ID use 3,4,5 resp. 6 is classic MCTS, 7 is mixing by visit count
# reuse_tree                    - reuse MCTS tree between moves
# virtual_loss                  - virtual loss for parallel search
# visit_threshold               - minimum number of visits for minimax backup
# policy_temp                   - Temperature for move policy
# cpuct_init                    - Starting cpuct value
# cpuct_base                    - Denominator of cpuct forumula
# fpu_is_loss                   - FPU is loss (1=true, 0=false)
# fpu_red                       - Reduction factor for FPU
##################################################################
montecarlo          1
treeht              12800
frac_freeze_tree    100
frac_alphabeta      0
frac_abrollouts     20
frac_abprior        0
mcts_strategy_depth 30
alphabeta_depth     16
evaluate_depth      0
backup_type         7
reuse_tree          1
virtual_loss        1
visit_threshold     800
policy_temp         200
cpuct_init          125
cpuct_base          19652
fpu_is_loss         0
fpu_red             33
#############################################################################
# Parallel search setup
#   mt            - number of processors
#   smp_depth     - split depth for smp
#   cluster_depth - split depth for cluster search
#   message_poll_nodes - number nodes to search before checking for message
#############################################################################
mt                  128
smp_depth           8
cluster_depth       12
message_poll_nodes  20
smp_type            YBW
cluster_type        YBW 
##########################################################################
# EGBB
# egbb_path              - path to endgame egbbs 
# egbb_cache_size        - cache size for egbbs in MBs
# egbb_ply_limit_percent - percent of plies from the root to egbb probing
# egbb_depth_limit       - depth from the leaves to egbb probing
# egbb_load_type         - egbb load type with the following values
#                    0 = none are loaded
#                    1 = all 3/4 men are loaded
#                    2 = Not implemented yet
#                    3 = all 5 men are loaded
##########################################################################
egbb_path                Z:/Scorpio6menEGTB/
egbb_cache_size          32
egbb_load_type           3
egbb_depth_limit         6
#######################################
# NN
# use_nn                 - turn off/on neural network
# nn_cache_size          - neural network cache size in MBs
# nn_path                - path to neural network
# nn_type                - type of neural network (0=scorpio, 1=lczero)
# device_type            - CPU or GPU
# delay                  - Sleep threads for this amount. Set this to 1
#                          if you are using way too many threads than you
#                          have physical cores (maybe when >16x more).
# float_type             - inference precison for tensorrt = FLOAT/HALF/INT8
#######################################
use_nn                   1
nn_cache_size            200
nn_type                  1
nn_path                  C:/Data/scorpio/Scorpio-16-Jul-2019/nets-maddex/net-maddex.uff
device_type              GPU
n_devices                1
delay                    1
float_type               HALF
Thanks in advance
Torsten
User avatar
Werner
Posts: 2871
Joined: Wed Mar 08, 2006 10:09 pm
Location: Germany
Full name: Werner Schüle

Re: How to get ScorpioNN to work?

Post by Werner »

Try
Scorpio.bat go
In command window and wait a few minutes, then you see the output with all infos

Install Scorpio.bat in Arena as engine.

Or follow the instructions Daniel made in tournaments CEGT update Sunday one week ago
Werner
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: How to get ScorpioNN to work?

Post by Daniel Shawul »

Yes, like Werner mentioned use scorpio.bat not scorpio.exe.

Also the egbb_path should be set to "C:\Data\scorpio\Scorpio-16-Jul-2019\nnprobe-windows-gpu" not "Z:/Scorpio6menEGTB/"
At the moment it is only possible to have one directory for both endgame bitbases and neural network dlls, so you have to move
the egbbs to the nnprobe-windows-gpu or vice versa. But what I recommend is you try without bitbases and point the egbb_path to the NN dlls.

scorpio.bat will automatically set "path" environement variable by reading the egbb_path from scorpio.ini automatically.
Using scorpio.exe directory will crash.

Are you running the shell script using cygwin/mysys ? Let me know if you see any issues so that I can incorporate it.

Thanks for testing
Daniel
Dokterchen
Posts: 133
Joined: Wed Aug 15, 2007 12:18 pm
Location: Munich

Re: How to get ScorpioNN to work?

Post by Dokterchen »

Hi Daniel and Werner,

thanks you very much for replies that was really helpful.

Now everything works fine and with my 4 core CPU and a RTX 2070 I am getting almost 200 K nps:

Code: Select all

C:\Data\scorpio\Scorpio-16-Jul-2019\bin\Windows>C:\Data\scorpio\Scorpio-16-Jul-2019\bin\Windows\scorpio.bat go
feature done=0
Number of cores 4 of 4
ht 4194304 X 16 = 64.0 MB
eht 524288 X 8 = 8.0 MB
pht 32768 X 24 = 0.8 MB
treeht 1342169600 X 10 = 12799.9 MB
processors [128]
EgbbProbe 4.3 by Daniel Shawul
egbb_cache 4084 X 8216 = 32.0 MB
0 egbbs loaded !
Loading neural network : C:/Data/scorpio/Scorpio-16-Jul-2019/nets-maddex/net-maddex.uff
nn_cache 131072 X 1552 = 194.0 MB
Loading graph on /gpu:0
0. main_input 7168 = 112 8 8
1. value_head 1 = 1 1 1
2. policy_head 1858 = 1858 1 1
Neural network loaded !
loading_time = 2s
# rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
# [st = 11114ms, mt = 29250ms , hply = 0 , moves_left 10]
63 38 111 19671  e2-e4 c7-c5 Nb1-c3 Nb8-c6 Ng1-f3 g7-g6 d2-d4 c5xd4 Nf3xd4 Bf8-g7 Bc1-e3 Ng8-f6 Bf1-c4 Ke8-g8 Bc4-b3 d7-d6
64 34 224 39138  e2-e4 e7-e6 d2-d4 d7-d5 e4xd5 e6xd5 Ng1-f3 Ng8-f6 Bf1-d3 Bf8-d6 Ke1-g1 Ke8-g8 Bc1-g5 Bc8-g4 Nb1-d2 Nb8-d7
65 28 336 58761  e2-e4 e7-e6 d2-d4 d7-d5 Nb1-c3 Ng8-f6 Bf1-b5 c7-c6 Bb5-d3 c6-c5 d4xc5 Bf8xc5 Ng1-f3 d5xe4 Nc3xe4 Nf6xe4 Bd3xe4
66 31 447 82909  c2-c4 e7-e5 g2-g3 Ng8-f6 Bf1-g2 Bf8-c5 Nb1-c3 Ke8-g8 Ng1-f3 Nb8-c6 Ke1-g1 d7-d6
67 31 558 104134  d2-d4 Ng8-f6 c2-c4 e7-e6 Nb1-c3 Bf8-b4 e2-e3 Ke8-g8 Ng1-f3 d7-d5 Bc1-d2 Nb8-d7 Bf1-d3 d5xc4
68 32 670 130134  d2-d4 Ng8-f6 c2-c4 e7-e6 Nb1-c3 Bf8-b4 e2-e3 Ke8-g8 Ng1-f3 d7-d5 Bc1-d2 Nb8-d7 Bf1-d3 d5xc4
69 32 781 155815  d2-d4 d7-d5 c2-c4 e7-e6 Nb1-c3 a7-a6 c4xd5 e6xd5 Ng1-f3 Ng8-f6 Bc1-g5 Bc8-e6 e2-e3 Nb8-d7 Bf1-d3 Bf8-d6 Ke1-g1 Ke8-g8
70 27 854 171718  d2-d4 Ng8-f6 Ng1-f3 e7-e6 g2-g3 c7-c5 Bf1-g2 c5xd4 Nf3xd4 d7-d5 Ke1-g1 e6-e5 Nd4-b3 Bc8-e6 Nb1-c3

# Move   Value=(V,P,V+P)   Policy  Visits                  PV
#----------------------------------------------------------------------------------
#  1   (0.540,0.527,0.533)  22.91   96597   d2-d4 Ng8-f6 Ng1-f3 e7-e6 g2-g3 c7-c5 Bf1-g2 c5xd4 Nf3xd4 d7-d5 Ke1-g1 e6-e5 Nd4-b3 Bc8-e6 Nb1-c3
#  2   (0.536,0.527,0.532)  22.69   44511   e2-e4 e7-e6 d2-d4 d7-d5 Nb1-c3 Ng8-f6 Bf1-b5 c7-c6 Bb5-d3 c6-c5 d4xc5 Bf8xc5 Ng1-f3 d5xe4 Nc3xe4 Nf6xe4 Bd3xe4 Qd8xd1
#  3   (0.530,0.527,0.529)   9.49    9887   c2-c4 e7-e5 e2-e3 Ng8-f6 Nb1-c3 Bf8-b4 Ng1-e2 Ke8-g8 a2-a3 Bb4-e7 d2-d4 e5xd4 Ne2xd4
#  4   (0.533,0.527,0.530)   9.15   11884   Ng1-f3 d7-d5 d2-d4 Ng8-f6 c2-c4 e7-e6 Nb1-c3 Bf8-e7 Bc1-g5 Ke8-g8 e2-e3 h7-h6 Bg5-h4 b7-b6
#  5   (0.504,0.527,0.504)   4.39    1362   g2-g3 d7-d5 Ng1-f3 c7-c5 Bf1-g2 Ng8-f6 Ke1-g1 Nb8-c6 d2-d4 c5xd4 Nf3xd4 e7-e5 Nd4xc6
#  6   (0.514,0.527,0.514)   4.04    1687   e2-e3 e7-e6 c2-c4 d7-d5 Ng1-f3 Ng8-f6 d2-d4 Bf8-e7 Bf1-e2 Ke8-g8
#  7   (0.496,0.527,0.496)   3.02     789   b2-b3 e7-e5 Bc1-b2 Nb8-c6 e2-e3 Ng8-f6 Ng1-f3 e5-e4 Nf3-d4 Bf8-c5 Nd4xc6 d7xc6 d2-d4
#  8   (0.490,0.527,0.490)   2.84     803   c2-c3 d7-d5 d2-d4 Ng8-f6 Ng1-f3 e7-e6 Bc1-f4 Bf8-d6 e2-e3 Bd6xf4
#  9   (0.495,0.527,0.495)   2.68     803   Nb1-c3 d7-d5 d2-d4 Ng8-f6 Bc1-f4 a7-a6 e2-e3 e7-e6 Ng1-f3 c7-c5 Bf1-e2 Nb8-c6 Ke1-g1
# 10   (0.497,0.527,0.497)   2.68     717   d2-d3 d7-d5 Ng1-f3 Ng8-f6 g2-g3 c7-c5 Bf1-g2 Nb8-c6 Ke1-g1 e7-e5 e2-e4 d5-d4
# 11   (0.467,0.527,0.467)   2.48     409   f2-f4 d7-d5 Ng1-f3 Ng8-f6 e2-e3 c7-c5 b2-b3 g7-g6 Bf1-b5
# 12   (0.475,0.527,0.475)   2.10     382   b2-b4 e7-e5 Bc1-b2 Bf8xb4 Bb2xe5 Ng8-f6 c2-c3 Bb4-e7 e2-e3 Ke8-g8 d2-d4 d7-d5
# 13   (0.496,0.527,0.496)   1.92     497   h2-h3 d7-d5 d2-d4 c7-c5 e2-e3 Ng8-f6 Ng1-f3 Nb8-c6 c2-c4 e7-e6 Nb1-c3
# 14   (0.504,0.527,0.504)   1.91     590   a2-a3 d7-d5 d2-d4 Ng8-f6 Ng1-f3 g7-g6 c2-c4 Bf8-g7 c4xd5
# 15   (0.428,0.527,0.428)   1.60     174   Ng1-h3 d7-d5 g2-g3 e7-e5 d2-d4 e5xd4 Qd1xd4 Nb8-c6 Qd4-a4
# 16   (0.473,0.527,0.473)   1.42     253   a2-a4 e7-e5 e2-e4 Ng8-f6 Nb1-c3 Bf8-b4 Ng1-f3 Ke8-g8 Nf3xe5 Rf8-e8
# 17   (0.446,0.527,0.446)   1.27     164   h2-h4 d7-d5 d2-d4 c7-c5 d4xc5 Ng8-f6 Ng1-f3 e7-e6 Bc1-e3
# 18   (0.372,0.527,0.372)   1.23      90   g2-g4 d7-d5 h2-h3 e7-e5 Bf1-g2 Nb8-c6 Nb1-c3 Ng8-e7 d2-d3
# 19   (0.413,0.527,0.413)   1.20     116   f2-f3 e7-e5 Nb1-c3 Ng8-f6 d2-d4 e5xd4 Qd1xd4 Nb8-c6 Qd4-f2
# 20   (0.439,0.527,0.439)   0.99     119   Nb1-a3 e7-e5 e2-e3 d7-d5 d2-d4 e5-e4 c2-c4 c7-c6

# nodes = 1740651 <0% qnodes> time = 8900ms nps = 195578 eps = 0 nneps = 19402
# Tree: nodes = 232811 depth = 22 pps = 19376 visits = 171835
#       qsearch_calls = 0 search_calls = 0
move d2d4
I have used Ubuntu not Cygwin.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: How to get ScorpioNN to work?

Post by Daniel Shawul »

Glad that it worked for you.
Note that the actual "nps" is 20k i.e. either the "nneps" or "pps" number not the confusing "nps" number.
The nps could increase upto 60-70 as you approach the endgame.

One thing you can do is to use INT8 that could potentially double your nps on the RTX gpus.
To do that do:

Code: Select all

./scorpio.bat runinpnn calibrate.edp calibrate.dat quit
This will generate the input for calibration and it might take a couple of minutes

Once that is done change the "float_type" to "INT8" in scorpio.ini and run scorpio one more time

Code: Select all

./scorpio.bat float_type INT8 go quit
This will again take a couple of minutes to calibrate and run search. It will generate a new calibrated INT8 network file
and will use that from then onwards, and the actual loading time will be low afterwards.

Daniel
Dokterchen
Posts: 133
Joined: Wed Aug 15, 2007 12:18 pm
Location: Munich

Re: How to get ScorpioNN to work?

Post by Dokterchen »

Daniel Shawul wrote: Wed Jul 17, 2019 2:45 pm Glad that it worked for you.
Note that the actual "nps" is 20k i.e. either the "nneps" or "pps" number not the confusing "nps" number.
The nps could increase upto 60-70 as you approach the endgame.

One thing you can do is to use INT8 that could potentially double your nps on the RTX gpus.
To do that do:

Code: Select all

./scorpio.bat runinpnn calibrate.edp calibrate.dat quit
This will generate the input for calibration and it might take a couple of minutes

Once that is done change the "float_type" to "INT8" in scorpio.ini and run scorpio one more time

Code: Select all

./scorpio.bat float_type INT8 go quit
This will again take a couple of minutes to calibrate and run search. It will generate a new calibrated INT8 network file
and will use that from then onwards, and the actual loading time will be low afterwards.

Daniel
Hi Daniel,

first of all if someone else wants to try it, there is a typo "calibrate.edp" instead of "calibrate.epd". That is the corrected one:

Code: Select all

./scorpio.bat runinpnn calibrate.epd calibrate.dat quit
Apart from this everything worked fine. Here my results:

Code: Select all

HALF and delay=0
# nodes = 1766012 <0% qnodes> time = 8906ms nps = 198294 eps = 0 nneps = 19643

INT8 and delay=0
# nodes = 3152093 <0% qnodes> time = 10297ms nps = 306117 eps = 0 nneps = 28222

HALF and delay=1
# nodes = 320331 <0% qnodes> time = 8024ms nps = 39921 eps = 0 nneps = 4581

INT8 and delay=1
# nodes = 416830 <0% qnodes> time = 8306ms nps = 50184 eps = 0 nneps = 5644
With INT8 I am geting a spedup of almost 50% - not bad. :-)

But on my machine the delay has by far the biggest effect.

KR
Torsten
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: How to get ScorpioNN to work?

Post by Daniel Shawul »

Thanks Torsten! I didn't see your reply until now.

So your GPU is an RTX 2070 and you already got 20k and 28k with FP16 and INT8 with the maddex net.

I just bought an RTX 2070-super and I am not able to get good numbers with FP16 (just 10k) for some reason with maddex net
but INT8 gives about 33k. With a different net it goes upto 46k though.

There is something i don't understand fully understand but on your machine it works pretty well.

regards,
Daniel