Compile Stockfish NNUE with Visual Studio

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

Moderators: hgm, Rebel, chrisw

Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Compile Stockfish NNUE with Visual Studio

Post by Fulvio »

I quickly searched the forum but I didn't find it.
I adapted my previous script to:
cl /std:c++latest /DNDEBUG /DUSE_POPCNT /GS- /MT /O2 /Oi /Ot /Oy /GL /EHsc *.cpp nnue/*.cpp nnue/features/*.cpp syzygy/*.cpp /link /STACK:reserve=8388608 /OUT:stockfish.exe advapi32.lib

However it doesn't embed the network and works only after setting the UCI option "Use NNUE" to false.
Can someone please post the visual studio command equivalent to the Linux "make -j build ARCH=x86-64-modern" ?
Thanks.
pferd
Posts: 134
Joined: Thu Jul 24, 2014 2:49 pm

Re: Compile Stockfish NNUE with Visual Studio

Post by pferd »

Embedding network files will not work with MSVC. See the top of evaluate.cpp:

Code: Select all

// Macro to embed the default NNUE file data in the engine binary (using incbin.h, by Dale Weiler).
// This macro invocation will declare the following three variables
//     const unsigned char        gEmbeddedNNUEData[];  // a pointer to the embedded data
//     const unsigned char *const gEmbeddedNNUEEnd;     // a marker to the end
//     const unsigned int         gEmbeddedNNUESize;    // the size of the embedded file
// Note that this does not work in Microsof Visual Studio.