JGIsland_BB - code for ultrafast solving #2

Discussion of chess software programming and technical issues.

Moderator: Ras

msterkowiec
Posts: 27
Joined: Sat Apr 26, 2025 7:01 pm
Full name: Marcin Sterkowiec

JGIsland_BB - code for ultrafast solving #2

Post by msterkowiec »

JGIsland_BB - C++ header-only library for ultrafast solving #2 and #1 - is now available on github at https://github.com/msterkowiec/JGIsland_BB
It works solely on 64-byte bitboard data using from 6k to 23k additional buffers and is able to solve more than 25 two-movers per 1 millisecond (i7-14700; in All Solutions mode). JGIsland_BB is now a part of the engine of J.G.Island Chess Moremovers 11.0 and is responsible for about 10% performance improvement in this version.; see also its thread: viewtopic.php?t=85039&start=40
User avatar
Roland Chastain
Posts: 711
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: JGIsland_BB - code for ultrafast solving #2

Post by Roland Chastain »

Hello! Thank you for sharing.

Please could you provide a simple usage example, for people who don't know C++?

When trying to compile the following program, I get a lot of error messages.

Code: Select all

// test.cpp

#include "JGIsland_BB.h"

int main()
{
  return 0;
}
I used the following command:

Code: Select all

g++ test.cpp -Iinclude

Code: Select all

In file included from include/JGIsland_BB.h:14,
                 from test.cpp:3:
include/data.h: In function 'constexpr T CTABS(T)':
include/data.h:44:18: error: 'is_constant_evaluated' is not a member of 'std' [-Wtemplate-body]
   44 |         if (std::is_constant_evaluated())
      |                  ^~~~~~~~~~~~~~~~~~~~~
include/data.h: In function 'constexpr std::array<long unsigned int, 64> InitQueenAttackMasks()':
include/data.h:195:39: error: uninitialized variable 'res' in 'constexpr' function
  195 |         std::array<std::uint64_t, 64> res;
      |                                       ^~~
Qui trop embrasse mal étreint.

Author of Eschecs, a simple UCI chess GUI written in Pascal.
msterkowiec
Posts: 27
Joined: Sat Apr 26, 2025 7:01 pm
Full name: Marcin Sterkowiec

Re: JGIsland_BB - code for ultrafast solving #2

Post by msterkowiec »

Hi Roland,

The most reliable way of building this project is by using the included CMakeLists.txt, which is, for example:
cmake .
cmake --build . --verbose
(The first line is configuration of cmake, so it should be run only once)

Alternatively you can open the folder in some IDE like Visual Studio 2022 (Windows), Visual Studio Code or CLion (Linux) and the IDE will build it and let you run or debug it.

BTW: The error you mentioned is most probably due to C++ language version (the project requires C++20, which is specified in the CMakeLists.txt; std::is_constant_evaluated is a feature of C++20). Thus, the compiler version (e.g. gcc, clang, msvc) on your machine should be up-to-date in order to handle C++ 20
User avatar
Roland Chastain
Posts: 711
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: JGIsland_BB - code for ultrafast solving #2

Post by Roland Chastain »

Thank you. Using the information that you provided, I could compile a first example.

Code: Select all

// test.cpp
// g++ -o test test.cpp -std=c++20

#define private public
#include "JGIsland_BB.h"

int main()
{
  FullBitboards bb;
  bb.fromFEN("b3BN1n/b3npP1/pP1RRPP1/p1k1b1Rn/B1p1b2p/2K1pp1p/3PP1R1/1b2r2b");
  printf("%d\n", bb.AllBetweenEmpty(_B1_, _B6_) == true);
  return 0;
}
Qui trop embrasse mal étreint.

Author of Eschecs, a simple UCI chess GUI written in Pascal.
msterkowiec
Posts: 27
Joined: Sat Apr 26, 2025 7:01 pm
Full name: Marcin Sterkowiec

Re: JGIsland_BB - code for ultrafast solving #2

Post by msterkowiec »

Keep also in mind that the following compiler switches for performance (for release build) may be crucial in this project:
-O3 -march=native
(You can find them in CMakeLists.txt)