Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Protocol to Compile "Stockfish" for Haswell Architecture
- -----------------------------------------
- 1) Launch MSYS2 (C:\msys64\mingw64.exe) and in the terminal enter the following:
- wget https://github.com/official-stockfish/Stockfish/archive/master.zip
- unzip master.zip
- cd Stockfish-master/src
- 2) Insert the following line into "Makefile" (C:\msys64\home\Justin\Stockfish-master\src) section 3, line 2:
- CXXFLAGS += -march=native
- 3) Return to cmd and enter the following:
- gcc -Q -march=native --help=target |egrep "(march|mtune|enabled)"
- cd Stockfish-master/src
- make profile-build ARCH=x86-64-bmi2 COMP=gcc -j 4
- make profile-build ARCH=x86-64-modern COMP=gcc -j 40
- strip stockfish.exe
- or
- strip sugar.exe
- mv stockfish.exe ../../stockfish_x64_bmi2.exe
- or
- mv sugar.exe ../../S_XPrO.110118.x64.POPCNT.exe
- make clean
- cd
- -----------------------------------------
- (Optional Customizations Only)
- 4) In Makefile:
- Replace:
- material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \
- material.o misc.o movegen.o movepick.o opt.o pawns.o position.o psqt.o \
- 5) main.cpp
- + void SETUP_PRIVILEGES();
- + void FREE_MEM(void *);
- +
- int main(int argc, char* argv[]) {
- std::cout << engine_info() << std::endl;
- -
- + #ifndef BENCH
- + SETUP_PRIVILEGES();
- + #endif
- UCI::init(Options);
- + TT.resize(Options["Hash"]);
- PSQT::init();
- Bitboards::init();
- Position::init();
- Pawns::init();
- Threads.init();
- Tablebases::init(Options["SyzygyPath"]);
- TT.resize(Options["Hash"]);
- UCI::loop(argc, argv);
- + if (large_use) {
- + FREE_MEM(TT. mem);
- + TT.mem = nullptr;
- + }
- +
- Threads.exit();
- }
- 6) tt.cpp
- TranspositionTable TT; // Our global transposition table
- +void CREATE_MEM2(void **,uint64_t);
- +void FREE_MEM(void *);
- Ill TranspositionTable: :resize() sets the size of the transposition table, Ill measured in megabytes. Transposition table consists of a power of 2 number
- clustercount = newClusterCount;
- + mem = nullptr;
- + FREE_MEM(mem);
- + CREATE_MEM2(&mem, clustercount * sizeof(Cluster));
- + large_use = true;
- +
- + if (!mem)
- + {
- free(mem);
- mem = calloc(clustercount * sizeof(Cluster) + CacheLineSize - 1, 1);
- + large_use = false;
- + }
- 7) tt.h
- + extern int large_use;
- + void FREE_MEM (void *);
- +
- class TranspositionTable {
- static const int cacheLinesize = 64;
- static_assert(sizeof(Cluster) == CacheLineSize / 2, "Cluster size incorrect");
- public:
- - ~TranspositionTable() { free(mem); }
- + void* mem;
- + ~TranspositionTable() { large_use ? FREE_MEM (mem) : free(mem); }
- void new_search() {generations+= 4; } // Lower 2 bits are used by Bound
- uint8_t generation() const { return generations; }
- TTEntry* probe(const Key key, bool& found) const;
- private:
- size t clustercount;
- cluster* table;
- void* mem;
- uint8_t generation8; // Size must be not bigger than TTEntry::genBound8
- };
- ------------------------------
- Finally, in order to customize your engine follow the following steps:
- 8) misc.cpp
- const string Version = "";
- to
- static const string Version = "SF091015MZ"
- AND
- ss << "Stockfish" << Version << setfill('0');
- to
- ss << " " << Version << setfill('0');
Add Comment
Please, Sign In to add comment