Oh, thank you. I think leela2200 won the mini match 3-2 though
Zahak, a GoLang based chess engine
Moderators: hgm, Rebel, chrisw
-
- Posts: 883
- Joined: Sat Mar 13, 2021 1:47 am
- Full name: Amanj Sherwany
Re: Zahak, a GoLang based chess engine
-
- Posts: 1631
- Joined: Tue Aug 21, 2018 7:52 pm
- Full name: Dietrich Kappe
Re: Zahak, a GoLang based chess engine
It appears that white won every game.
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".
-
- Posts: 1364
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Szentendre, Hungary
- Full name: Gabor Szots
Re: Zahak, a GoLang based chess engine
I tried some hash settings under Cute Chess.amanjpro wrote: ↑Sun Mar 14, 2021 8:39 pm As for the memory allocation, I am not seeing it on Mac, Linux and also Windows (on VritualBox though). Here is a Windows screenshot:
https://drive.google.com/file/d/1J2_6GG ... sp=sharing
I set hash to 32 (MB), and the allocation is around 45 (for the entire program)
When set to 16 MB, the allocated memory is 65.
When set to 32 MB, the allocated memory is 129 MB.
64 --> 286
128 --> more than 600 but then gradually decreases down to about 400.
256 --> about 1400, then gradually decreases down to about 800.
So it seems that for lower values the allocated memory increase is about 4 times the hash size increase. For greater values the allocated memory changes with time (it went down a bit with each move I made).
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 4610
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Zahak, a GoLang based chess engine
I can confirm that behaviour under Win7-64 from cmd w/o any GUI.Gabor Szots wrote: ↑Mon Mar 15, 2021 8:53 amI tried some hash settings under Cute Chess.amanjpro wrote: ↑Sun Mar 14, 2021 8:39 pm As for the memory allocation, I am not seeing it on Mac, Linux and also Windows (on VritualBox though). Here is a Windows screenshot:
https://drive.google.com/file/d/1J2_6GG ... sp=sharing
I set hash to 32 (MB), and the allocation is around 45 (for the entire program)
When set to 16 MB, the allocated memory is 65.
When set to 32 MB, the allocated memory is 129 MB.
64 --> 286
128 --> more than 600 but then gradually decreases down to about 400.
256 --> about 1400, then gradually decreases down to about 800.
So it seems that for lower values the allocated memory increase is about 4 times the hash size increase. For greater values the allocated memory changes with time (it went down a bit with each move I made).
Code: Select all
uci
id name Zahak
id author Amanj
option name Ponder type check default false
option name Hash type spin default 10 min 1 max 8000
option name Book type check default false
uciok
ucinewgame
isready
readyok
setoption name Hash value 320
position startpos
go infinite
...
The reducing later became slower and slower and halted at around 1GB.
https://rwbc-chess.de
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: Zahak, a GoLang based chess engine
Maybe it uses a vector without giving it a capacity or specific number of elements to start with. In Rust, if you create a vector and then push elements into it, the vector needs to resize if it's not big enough. It'll then resize to about 1.5x its current size. For example:Gabor Szots wrote: ↑Mon Mar 15, 2021 8:53 amI tried some hash settings under Cute Chess.amanjpro wrote: ↑Sun Mar 14, 2021 8:39 pm As for the memory allocation, I am not seeing it on Mac, Linux and also Windows (on VritualBox though). Here is a Windows screenshot:
https://drive.google.com/file/d/1J2_6GG ... sp=sharing
I set hash to 32 (MB), and the allocation is around 45 (for the entire program)
When set to 16 MB, the allocated memory is 65.
When set to 32 MB, the allocated memory is 129 MB.
64 --> 286
128 --> more than 600 but then gradually decreases down to about 400.
256 --> about 1400, then gradually decreases down to about 800.
So it seems that for lower values the allocated memory increase is about 4 times the hash size increase. For greater values the allocated memory changes with time (it went down a bit with each move I made).
You could initialize a vector with a capacity of say, 8 elements and make sure you don't ever put more than 256 elements in it. Then the vector will stay at 8 elements all the time. You could also initialize it without a capacity and leave it empty. After that, when you put elements in it, it will go something like this in many programming languages:
0 -> empty
1 -> reserved memory for 2 elements.
2 -> 2
3 -> 4
4 -> 4
5 -> 6
6 - > 8
7 -> 8
8 -> 8
9 -> 16
10 -> 16
...
Maybe that's what you're seeing.
-
- Posts: 883
- Joined: Sat Mar 13, 2021 1:47 am
- Full name: Amanj Sherwany
Re: Zahak, a GoLang based chess engine
That is the thing, I already initialize it with a fixed size:mvanthoor wrote: ↑Mon Mar 15, 2021 10:11 amMaybe it uses a vector without giving it a capacity or specific number of elements to start with. In Rust, if you create a vector and then push elements into it, the vector needs to resize if it's not big enough. It'll then resize to about 1.5x its current size. For example:Gabor Szots wrote: ↑Mon Mar 15, 2021 8:53 amI tried some hash settings under Cute Chess.amanjpro wrote: ↑Sun Mar 14, 2021 8:39 pm As for the memory allocation, I am not seeing it on Mac, Linux and also Windows (on VritualBox though). Here is a Windows screenshot:
https://drive.google.com/file/d/1J2_6GG ... sp=sharing
I set hash to 32 (MB), and the allocation is around 45 (for the entire program)
When set to 16 MB, the allocated memory is 65.
When set to 32 MB, the allocated memory is 129 MB.
64 --> 286
128 --> more than 600 but then gradually decreases down to about 400.
256 --> about 1400, then gradually decreases down to about 800.
So it seems that for lower values the allocated memory increase is about 4 times the hash size increase. For greater values the allocated memory changes with time (it went down a bit with each move I made).
You could initialize a vector with a capacity of say, 8 elements and make sure you don't ever put more than 256 elements in it. Then the vector will stay at 8 elements all the time. You could also initialize it without a capacity and leave it empty. After that, when you put elements in it, it will go something like this in many programming languages:
0 -> empty
1 -> reserved memory for 2 elements.
2 -> 2
3 -> 4
4 -> 4
5 -> 6
6 - > 8
7 -> 8
8 -> 8
9 -> 16
10 -> 16
...
Maybe that's what you're seeing.
https://github.com/amanjpro/zahak/blob/ ... go#L84-L85
And I never append to it (I only insert in already allocated indices): https://github.com/amanjpro/zahak/blob/ ... go#L43-L69
I use modulo to make sure I stay within the bounds: https://github.com/amanjpro/zahak/blob/ ... go#L39-L41
I am using a garbage collected language, I cannot really control when memory is freed when searching. So, the increase during search is probably normal. But why does it stay high even after search, I might have some memory leak, need to check, which is not exactly an easy task
-
- Posts: 883
- Joined: Sat Mar 13, 2021 1:47 am
- Full name: Amanj Sherwany
Re: Zahak, a GoLang based chess engine
I might have an idea where the memory consumption is coming from, the way I keep PV is too memory intense (I create almost one array per node to keep track of PV (each with the size of 100), I need to think about a better way to do that)
-
- Posts: 1631
- Joined: Tue Aug 21, 2018 7:52 pm
- Full name: Dietrich Kappe
Re: Zahak, a GoLang based chess engine
Ideally you would allocate objects on the stack, but that’s not possible with the TT. In Julia, which is also a GC language (non-compacting to boot), I’ve had to use an arena memory allocation approach for the AB/TT and the MCTS node tree. Otherwise it slows down appreciably over the course of a game.amanjpro wrote: ↑Mon Mar 15, 2021 10:54 am I am using a garbage collected language, I cannot really control when memory is freed when searching. So, the increase during search is probably normal. But why does it stay high even after search, I might have some memory leak, need to check, which is not exactly an easy task
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".
-
- Posts: 883
- Joined: Sat Mar 13, 2021 1:47 am
- Full name: Amanj Sherwany
Re: Zahak, a GoLang based chess engine
Oh snap, found the issue. I had to call runtime.GC() manually for it to remove (old versions of the transposition table). I believe I have fixed it. I might do a new release soon with the fix. Go's GC is lazy, it doesn't run if it is not needed apparently. I ran the search for 14 plies deep (from startpos), and memory barely touched early 400MB with tt set to 256 (which I believe is normal, given all the stack I allocate)
-
- Posts: 135
- Joined: Tue Mar 05, 2019 3:43 pm
- Full name: Archimedes
Re: Zahak, a GoLang based chess engine
There was also a problem on Android. Version 0.1.0 works for DroidFish, but versions 0.2.0 and 0.2.1 didn't. The newest version works again with DroidFish.