Some beginner questions about Lc0

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

Moderators: hgm, Rebel, chrisw

Jouni
Posts: 3278
Joined: Wed Mar 08, 2006 8:15 pm

Some beginner questions about Lc0

Post by Jouni »

1) Why is Lc0.exe not updated after 10.10.? Development stopped?
2) If I define 4 GB hash in UCI does it mean GPU RAM memory?
3) What is NNCache?

I have some dozen others also :) .
Jouni
User avatar
Werner
Posts: 2871
Joined: Wed Mar 08, 2006 10:09 pm
Location: Germany
Full name: Werner Schüle

Re: Some beginner questions about Lc0

Post by Werner »

a) look here https://lczero.org/play/configuration/flags/
b) help Channel on discord https://discord.gg/trkUZqaZ
b) change settings and see difference in taskmanager
Werner
Jouni
Posts: 3278
Joined: Wed Mar 08, 2006 8:15 pm

Re: Some beginner questions about Lc0

Post by Jouni »

Why is 2 CPU cores default? In my test 1 core was fastest and 3 slowest. How does Lc0 use CPU?
Jouni
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Some beginner questions about Lc0

Post by brianr »

Jouni wrote: Tue Jan 12, 2021 7:57 pm Why is 2 CPU cores default? In my test 1 core was fastest and 3 slowest. How does Lc0 use CPU?
Lc0 is a totally different architecture and nothing like traditional alpha/beta engines.
Lc0 uses CPUs to fill large batches of work for the GPUs to process with the net.
The overhead in transferring data to/from the CPU and GPU is enormous, relative to the CPU speed in traditional A/B CPU only engines. Accordingly, large batches of work are assembled to mitigate this overhead. The Lc0 "formula" is 1 CPU plus the number of GPUs being used. For 1 GPU the reported nps may be higher or lower with 1 or 3 CPUs than with 2, but that can mean that the batches are being filled with useless nodes. For 1 GPU, 2 CPUs is best for playing strength.

For a more detailed answer the best place to ask is the Leela Chess Server Discord.
FWIW, the Lc0 search code is extremely complex, not that I am even close to understanding it.
Jouni
Posts: 3278
Joined: Wed Mar 08, 2006 8:15 pm

Re: Some beginner questions about Lc0

Post by Jouni »

One more.I have read, that Lc0 needs a lot memory to run well. But how do You increase memory? Even if I increase hash to XX GB and NN cache to zillion system monitor says always about 2 GB GPU memory used and 15% of GPU power. System monitor sucks I quess?
Jouni
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Some beginner questions about Lc0

Post by dkappe »

Jouni wrote: Mon Jan 18, 2021 10:34 pm One more.I have read, that Lc0 needs a lot memory to run well. But how do You increase memory? Even if I increase hash to XX GB and NN cache to zillion system monitor says always about 2 GB GPU memory used and 15% of GPU power. System monitor sucks I quess?
While the code for lc0 may be complex, you can take a look at a0lite for a single-threaded python engine. https://github.com/dkappe/a0lite

Why does it need lots of memory? Let’s look at the different uses of memory:

1) NNCache: this is a cache of the neural network results for previously evaluated positions. It’s not like a transposition table, but it’s still useful, as evaluating a position on the gpu is expensive.
2) Search tree: unlike a depth first ab search where you essentially only have to have the current branch in memory, MCTS samples the search tree and keeps it all in memory. As you make moves, you can chop off old parts of the tree and reclaim memory. Unlike an ab engine hash, there’s nothing to configure. If you let lc0 run forever, it will eat up all your ram.
3) GPU Memory: contains the Network and the hundreds or thousands of positions to be evaluated and their results. Mostly doing linear algebra computations. Positions and results are moved in and out quickly to make room for the next batch. GPU Memory usage will stay pretty much the same.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: Some beginner questions about Lc0

Post by dkappe »

If your GPU is only at 15% utilization, then your cpu isn’t feeding the gpu enough. I’d try the default values and see if you can get close to 100%.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".