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 for Windows possible ?
Moderator: Ras
-
- Posts: 382
- Joined: Thu Jun 05, 2014 2:14 pm
- Location: Iran
- Full name: Mehdi Amini
Cfish for Windows possible ?
Farewell.
-
- Posts: 1957
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Cfish for Windows possible ?
I as able to build perfectly fine on windows in my first attempt -- "make build ARCH=x86-64-modern"
I believe it is important that you have a POSIX version of gcc, for pthread reasons.
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.
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Cfish for Windows possible ?
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
Daniel Inführ - Software Developer
-
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Cfish for Windows possible ?
? CFish simply was faster than the according SF (by 15-20% IIRC) ... nothing to argue about.dangi12012 wrote: ↑Thu Dec 02, 2021 5:16 pmCFish was just to show what optimisations C CANNOT do? Because people think that C is faster
...snip...
-
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Cfish for Windows possible ?
Neither had any problems with Msys2 (a kind of posix emulation is used there) for all my compilations.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"
I believe it is important that you have a POSIX version of gcc, for pthread reasons.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.
-
- Posts: 325
- Joined: Tue Aug 31, 2021 10:32 pm
- Full name: tcusr
Re: Cfish for Windows possible ?
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 wrote: ↑Thu Dec 02, 2021 5:16 pmCFish 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.
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Cfish for Windows possible ?
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
Daniel Inführ - Software Developer
-
- Posts: 382
- Joined: Thu Jun 05, 2014 2:14 pm
- Location: Iran
- Full name: Mehdi Amini
Re: Cfish for Windows possible ?
Cfish , because I know C but not C++.dangi12012 wrote: ↑Thu Dec 02, 2021 5:16 pmCFish 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.
Farewell.
-
- Posts: 382
- Joined: Thu Jun 05, 2014 2:14 pm
- Location: Iran
- Full name: Mehdi Amini
Re: Cfish for Windows possible ?
IMHO translation might not be perfect. We may need a proper test here.Guenther wrote: ↑Thu Dec 02, 2021 5:34 pm? CFish simply was faster than the according SF (by 15-20% IIRC) ... nothing to argue about.dangi12012 wrote: ↑Thu Dec 02, 2021 5:16 pmCFish was just to show what optimisations C CANNOT do? Because people think that C is faster
...snip...
Farewell.
-
- Posts: 1957
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Cfish for Windows possible ?
No cygwin here.dangi12012 wrote: ↑Thu Dec 02, 2021 5:57 pmMy 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
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.