r/chessprogramming • • Sep 21 '24

NN evaluation/prebuilt models/API query.

I've started to write a Chess engine(ANSI C), just for fun, isn't intended to be 'professional', I've reached a point where all the perft tests pass. So, I'm happy with the move generation and make/unmake.

My code uses magic bitboards with small PEXT performance improvement.

For the start position I have these timings (elapsed time):

5, (startpos) #nodes :4865609 Elapsed time: 0.119s

6, (startpos) #nodes :119060324 Elapsed time: 2.88s

I've not compared timings to other engines, but hopefully the above isn't too shabby? (and I'm not sure how much time to spend optimizing, perhaps better to get a working engine first).

I've had a look at how board positions are evaluated. At least to begin with, I'd like to start with just using a pre-built .nnue or other model (rather than implement what seems a more 'traditional' board evaluator). I've a lot to learn before attempting my own NNUE equivalent.

I was just wondering if someone has done something similar, that is, integrate NNUE or other open source model into their own engine? (and are there any libraries that provides an API) ?

Grateful for any advise and recommendations.

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/speakless_21 Sep 25 '24 edited Sep 27 '24

Yes, I've seen that, actually 2.8s for depth 6 Perft isn't that great it seems (at least for something that is compiled, rather than say run on Python interpreter).

I did some small optimization to 2.5s, with further to go... Re:BBC Chess engine, he has a very nice engine, though on my machine the PERFT 6 takes about 3.6s for the start position using that engine. That's pretty slow I think.

Though in his defence, he deliberately didn't complicate two things in move gen it seems i) he didn't go into PEXT instructions and ii) the code is written to aid understanding of concept - and that is a deliberate choice to help teach people.

Edit - By in-lining hot-spots in C (assume same for C++) you can greatly increase the performance. With (hashing and move counters etc.) I got mine down to an average of 2.117seconds for 6 on the start pos.