Hakkapeliitta-nnue 3.0 problems to compile

Discussion of chess software programming and technical issues.

Moderator: Ras

chessica
Posts: 914
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Hakkapeliitta-nnue 3.0 problems to compile

Post by chessica »

I used MSVS2022:

benchmark.cpp
bitboards.cpp
counter.cpp
evaluation.cpp
history.cpp
killer.cpp
main.cpp
movegen.cpp
movesort.cpp
misc.cpp
nnue.cpp
pht.cpp
position.cpp
search.cpp
tbprobe.cpp
tt.cpp
uci.cpp
zobrist.cpp
hakkapeliitta.vcxproj -> C:\Users\Privat\Desktop\hakkapeliitta-nnue-master\hakkapeliitta-nnue-master\x64\Debug\hakkapeliitta.exe

The exe-file was created, when I access it I can enter uci and get this answer:

Hakkapeliitta 3.0 (C) 2013-2015 Mikko Aarnos
Detected 4 CPU core(s)
NNUE not found: nn.bin
Detected hardware POPCNT
uci
id name Hakkapeliitta 3.0
id author Mikko Aarnos
option name Hash type spin default 32 min 1 max 65536
option name Pawn Hash type spin default 4 min 1 max 8192
option name Clear Hash type button
option name Contempt type spin default 0 min -75 max 75
option name Ponder type check default true
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name SyzygyProbeLimit type spin default 6 min 0 max 6
option name Syzygy50MoveRule type check default true
uciok

If I say go, then the console is closed.

Code: Select all

NLINE void refresh_accumulator(const Position* pos)
{
	Accumulator* accumulator = &(pos->nnue[0]->accumulator);

	index_list active_indices[2]{};
	active_indices[0].size = active_indices[1].size = 0;
	append_active_indices(pos, active_indices);

	for (unsigned c = 0; c < 2; c++)
	{
#ifdef VECTOR
		for (unsigned i = 0; i < k_half_dimensions / tile_height; i++)
		{
			const auto ft_biases_tile = reinterpret_cast<vec16_t*>(&ft_biases[i * tile_height]);
			const auto acc_tile = reinterpret_cast<vec16_t*>(&accumulator->accumulation[c][i * tile_height]);
			vec16_t acc[num_regs]{};

			for (unsigned j = 0; j < num_regs; j++)
				acc[j] = ft_biases_tile[j];

			for (size_t k = 0; k < active_indices[c].size; k++)    [b] <<<----error[/b]
			{
				const unsigned index = active_indices[c].values[k];
				const unsigned offset = k_half_dimensions * index + i * tile_height;
				const auto column = reinterpret_cast<vec16_t*>(&ft_weights[offset]);

				for (unsigned j = 0; j < num_regs; j++)
					acc[j] = vec_add_16(acc[j], column[j]);
How it can fixed?
tmokonen
Posts: 1353
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by tmokonen »

Part of the output says :
NNUE not found: nn.bin

The neural net file nn.bin has to be in the same folder as the executable, if using the default UCI value.
chessica
Posts: 914
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by chessica »

Yes, that was clear. But after I added the "NNUE" file, this message disappeared, the problem is
still there exactly as it is. I had successfully compiled the engine with msvs2022, but it doesn't work.
Then I read the README file again and it says this:

### Compiling it yourself

A makefile is provided for this purpose inside the directory "src". It works for sure with GCC
versions greater than or equal to 4.8.1, and possibly with even older versions. The makefile has
been tested on Windows and Linux, so there might be some problems on other operating systems.
Binaries produced by this makefile will most likely only work on the machine it was compiled on,
so Hakkapeliitta should compiled individually for every machine it is needed on.

my version from gcc

~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $ gcc --version
gcc (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $

my version from g++

~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $ g++ --version
g++ (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $

Then tried to compile using W64devkit but it failed:

~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $ make -d ARCH=x86-64 COMP=gcc


Putting child 0000028a259dcd10 (make) PID 2792384722736 on the chain.
Live child 0000028a259dcd10 (make) PID 2792384722736
Main thread handle = 0000000000000108
search.cpp: In constructor 'Search::Search(SearchListener&)':
search.cpp:191:72: error: 'log1p' is not a member of 'std'
191 | lmrReductions[j] = static_cast<int>(std::max(1.0, (std::log1p(i) * std::log1p(j)) / 1.70));
| ^~~~~
search.cpp:191:88: error: 'log1p' is not a member of 'std'
191 | lmrReductions[j] = static_cast<int>(std::max(1.0, (std::log1p(i) * std::log1p(j)) / 1.70));
| ^~~~~
search.cpp:197:50: error: 'round' is not a member of 'std'
197 | lmpMoveCounts[d] = static_cast<int>(std::round(2.98484 + std::pow(d, 1.74716)));
| ^~~~~
search.cpp:197:71: error: 'pow' is not a member of 'std'
197 | lmpMoveCounts[d] = static_cast<int>(std::round(2.98484 + std::pow(d, 1.74716)));
| ^~~
In file included from uci.cpp:23:
textio.hpp: In function 'std::string positionToFen(const Board&)':
textio.hpp:101:18: error: ordered comparison of pointer with integer zero ('int (*)(Square) noexcept' {aka 'int (*)(Square)'} and 'int')
101 | if (rank > 0)
| ~~~~~^~~
Reaping losing child 0000028a259dcd10 PID 2792384722736
make: *** [Makefile:5: make] Error 1


g++ -pthread -std=c++11 -Ofast -Wall -flto -march=native -s -DNDEBUG -Wl,--no-as-needed main.cpp benchmark.cpp bitboards.cpp counter.cpp evaluation.cpp history.cpp killer.cpp movegen.cpp movesort.cpp pht.cpp position.cpp search.cpp tt.cpp uci.cpp zobrist.cpp syzygy/tbprobe.cpp -o Hakkapeliitta
CreateProcess(C:\MinGW-w64devkit-1.15\bin\g++.exe,g++ -pthread -std=c++11 -Ofast -Wall -flto -march=native -s -DNDEBUG -Wl,--no-as-needed main.cpp benchmark.cpp bitboards.cpp counter.cpp evaluation.cpp history.cpp killer.cpp movegen.cpp movesort.cpp pht.cpp position.cpp search.cpp tt.cpp uci.cpp zobrist.cpp syzygy/tbprobe.cpp -o Hakkapeliitta,...)
Putting child 000001c5fc75cd10 (make) PID 1949880644560 on the chain.
Live child 000001c5fc75cd10 (make) PID 1949880644560
Main thread handle = 00000000000000fc
search.cpp: In constructor 'Search::Search(SearchListener&)':
search.cpp:191:72: error: 'log1p' is not a member of 'std'
191 | lmrReductions[j] = static_cast<int>(std::max(1.0, (std::log1p(i) * std::log1p(j)) / 1.70));
| ^~~~~
search.cpp:191:88: error: 'log1p' is not a member of 'std'
191 | lmrReductions[j] = static_cast<int>(std::max(1.0, (std::log1p(i) * std::log1p(j)) / 1.70));
| ^~~~~
search.cpp:197:50: error: 'round' is not a member of 'std'
197 | lmpMoveCounts[d] = static_cast<int>(std::round(2.98484 + std::pow(d, 1.74716)));
| ^~~~~
search.cpp:197:71: error: 'pow' is not a member of 'std'
197 | lmpMoveCounts[d] = static_cast<int>(std::round(2.98484 + std::pow(d, 1.74716)));
| ^~~
In file included from uci.cpp:23:
textio.hpp: In function 'std::string positionToFen(const Board&)':
textio.hpp:101:18: error: ordered comparison of pointer with integer zero ('int (*)(Square) noexcept' {aka 'int (*)(Square)'} and 'int')
101 | if (rank > 0)
| ~~~~~^~~
Reaping losing child 000001c5fc75cd10 PID 1949880644560
make: *** [Makefile:5: make] Error 1
Removing child 000001c5fc75cd10 PID 1949880644560 from chain.
~/Desktop/hakkapeliitta-nnue-master/hakkapeliitta-nnue-master/src $
Frank Quisinsky
Posts: 6888
Joined: Wed Nov 18, 2009 7:16 pm
Location: Gutweiler, Germany
Full name: Frank Quisinsky

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by Frank Quisinsky »

chessica
Posts: 914
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by chessica »

Frank Quisinsky wrote: Tue Sep 19, 2023 2:11 pm Can be found here ...
https://github.com/FireFather?tab=repositories
Hi, this version is not working for my old pc.
chessica
Posts: 914
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by chessica »

here i show the error message in msvs2022:

https://i.ibb.co/hfF8b46/Zwischenablage01.jpg
tmokonen
Posts: 1353
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

Re: Hakkapeliitta-nnue 3.0 problems to compile

Post by tmokonen »

I got it to compile with VS2022 by adding a

#include <cmath>

statement to search.cpp and textio.hpp, as I guess the members of std that gave you error messages are part of the cmath library. I also had to change the c++ standard from c++14 to c++17 to get the nnue code to compile for me.