Cfish for Windows possible ?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Look
Posts: 382
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Cfish for Windows possible ?

Post by Look »

Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
Farewell.
AndrewGrant
Posts: 1957
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Cfish for Windows possible ?

Post by AndrewGrant »

I as able to build perfectly fine on windows in my first attempt -- "make build ARCH=x86-64-modern"

Code: Select all

$ gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 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.
I believe it is important that you have a POSIX version of gcc, for pthread reasons.
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Cfish for Windows possible ?

Post by dangi12012 »

Look wrote: Thu Dec 02, 2021 4:46 pm Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
CFish was just to show what optimisations C CANNOT do? Because people think that C is faster - but with modern C++ you have much more modern compiler backends and features like constexpr/consteval that make code a lot faster because you can make your intentions to the compiler much clearer.
Also the last port is 1 year old so it will be weaker than current stockfish.

But to your question: Yes Clang is the only option - it is the only compiler besides MSVC that supports the Windows ABI.
You can build clang on windows with its own cmake file and you get native windows binaries of clang-64.exe that you can use like you would in linux.
It will compile a stockfish.exe.

IMO just try that with stockfish? I dont know what you have to gain by using Cfish.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Guenther
Posts: 4718
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Cfish for Windows possible ?

Post by Guenther »

dangi12012 wrote: Thu Dec 02, 2021 5:16 pm
Look wrote: Thu Dec 02, 2021 4:46 pm Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
CFish was just to show what optimisations C CANNOT do? Because people think that C is faster
...snip...
? CFish simply was faster than the according SF (by 15-20% IIRC) ... nothing to argue about.
https://rwbc-chess.de

[Trolls n'existent pas...]
Guenther
Posts: 4718
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Cfish for Windows possible ?

Post by Guenther »

AndrewGrant wrote: Thu Dec 02, 2021 5:10 pm I as able to build perfectly fine on windows in my first attempt -- "make build ARCH=x86-64-modern"

Code: Select all

$ gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 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.
I believe it is important that you have a POSIX version of gcc, for pthread reasons.
Neither had any problems with Msys2 (a kind of posix emulation is used there) for all my compilations.
https://rwbc-chess.de

[Trolls n'existent pas...]
tcusr
Posts: 325
Joined: Tue Aug 31, 2021 10:32 pm
Full name: tcusr

Re: Cfish for Windows possible ?

Post by tcusr »

dangi12012 wrote: Thu Dec 02, 2021 5:16 pm
Look wrote: Thu Dec 02, 2021 4:46 pm Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
CFish was just to show what optimisations C CANNOT do? Because people think that C is faster - but with modern C++ you have much more modern compiler backends and features like constexpr/consteval that make code a lot faster because you can make your intentions to the compiler much clearer.
Also the last port is 1 year old so it will be weaker than current stockfish.

But to your question: Yes Clang is the only option - it is the only compiler besides MSVC that supports the Windows ABI.
You can build clang on windows with its own cmake file and you get native windows binaries of clang-64.exe that you can use like you would in linux.
It will compile a stockfish.exe.

IMO just try that with stockfish? I dont know what you have to gain by using Cfish.
my first move generator was in C and perft was faster than the one in C++. the code was basically the same except that i used templates extensively for color/piece.
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Cfish for Windows possible ?

Post by dangi12012 »

tcusr wrote: Thu Dec 02, 2021 5:52 pm my first move generator was in C and perft was faster than the one in C++. the code was basically the same except that i used templates extensively for color/piece.
My first 50 move generators were in different programming languages - and the fastest ever was in C++. Its because you can tell the compiler exactly what you want and C is missing a lot of those features.

Yes guys you can use gcc and cygwin and running over a posix middleware -
BUT it is not the same performance as natively compiled for windows!

Only CLANG can do that.


How to do it:
1) Build https://github.com/llvm/llvm-project on windows with cmake and visualstudio
2) Build stockfish
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
User avatar
Look
Posts: 382
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Re: Cfish for Windows possible ?

Post by Look »

dangi12012 wrote: Thu Dec 02, 2021 5:16 pm
Look wrote: Thu Dec 02, 2021 4:46 pm Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
CFish was just to show what optimisations C CANNOT do? Because people think that C is faster - but with modern C++ you have much more modern compiler backends and features like constexpr/consteval that make code a lot faster because you can make your intentions to the compiler much clearer.
Also the last port is 1 year old so it will be weaker than current stockfish.

But to your question: Yes Clang is the only option - it is the only compiler besides MSVC that supports the Windows ABI.
You can build clang on windows with its own cmake file and you get native windows binaries of clang-64.exe that you can use like you would in linux.
It will compile a stockfish.exe.

IMO just try that with stockfish? I dont know what you have to gain by using Cfish.
Cfish , because I know C but not C++.
Farewell.
User avatar
Look
Posts: 382
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Re: Cfish for Windows possible ?

Post by Look »

Guenther wrote: Thu Dec 02, 2021 5:34 pm
dangi12012 wrote: Thu Dec 02, 2021 5:16 pm
Look wrote: Thu Dec 02, 2021 4:46 pm Hi,

I wonder if it is possible to build a Cfish fork for Windows with free tools ? Maybe a CMake file , Visual Studio community with Clang compiler. What do you think ?
CFish was just to show what optimisations C CANNOT do? Because people think that C is faster
...snip...
? CFish simply was faster than the according SF (by 15-20% IIRC) ... nothing to argue about.
IMHO translation might not be perfect. We may need a proper test here.
Farewell.
AndrewGrant
Posts: 1957
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Cfish for Windows possible ?

Post by AndrewGrant »

dangi12012 wrote: Thu Dec 02, 2021 5:57 pm
tcusr wrote: Thu Dec 02, 2021 5:52 pm my first move generator was in C and perft was faster than the one in C++. the code was basically the same except that i used templates extensively for color/piece.
My first 50 move generators were in different programming languages - and the fastest ever was in C++. Its because you can tell the compiler exactly what you want and C is missing a lot of those features.

Yes guys you can use gcc and cygwin and running over a posix middleware -
BUT it is not the same performance as natively compiled for windows!

Only CLANG can do that.


How to do it:
1) Build https://github.com/llvm/llvm-project on windows with cmake and visualstudio
2) Build stockfish
No cygwin here.

Are you able to demonstrate that this claim is true? That GCC out performs CLANG due to native issues?
And the claim that C++ is faster than C is totally bunk, and requires some proof in this case lol.