CFish

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

Moderators: hgm, Rebel, chrisw

Gusev
Posts: 1476
Joined: Mon Jan 28, 2013 2:51 pm

Re: CFish

Post by Gusev »

Is the solution/project for Visual Studio and MSVC available, by any chance?
Dann Corbit wrote:
Jouni wrote:There are 2 exes 182k and 645k. Which one is correct?
The 645K one is build with Mingw GCC 6.1, and it will require bitcount instruction for your CPU.

The smaller one is built with Microsoft Visual C++ and it should run on any 64 bit CPU

I guess that the Mingw one will be faster.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: CFish

Post by Dann Corbit »

Gusev wrote:Is the solution/project for Visual Studio and MSVC available, by any chance?
Dann Corbit wrote:
Jouni wrote:There are 2 exes 182k and 645k. Which one is correct?
The 645K one is build with Mingw GCC 6.1, and it will require bitcount instruction for your CPU.

The smaller one is built with Microsoft Visual C++ and it should run on any 64 bit CPU

I guess that the Mingw one will be faster.
It will take a LOT of work to rewrite for MSVC++
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: CFish

Post by Dann Corbit »

fantasmadel50 wrote:¿Como hago para utilizarlo en linux, con scid? gracias How do I use on linux, with scid? Thank you
I assume you have gcc installed.
There is a make file
Use that to build cfish.
Then install cfish as a UCI engine under scid.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: CFish

Post by Dann Corbit »

Linux:
When you just type make with the original makefile, what message do you see? You may need to remove my folder cfish, since the binary has the same name.

Windows
When you use my modified makefile, and just type make, what do you see?
I see this:

Code: Select all

Danniel@Danniel-PC MINGW64 /g/chess/Cfish-master/src
$ ls
benchmark.c  bmi2-fancy.c  cfish              Edit1  endgame.c   magic-fancy.c  main.c        material.h  movegen.c   movepick.h  position.c  search.c  tbprobe.c  timeman.c  types.h
bitbase.c    bmi2-fancy.h  cfish-modern.exe   Edit3  endgame.h   magic-fancy.h  Makefile      misc.c      movegen.h   ntsearch.c  position.h  search.h  tbprobe.h  timeman.h  uci.c
bitboard.c   bmi2-plain.c  cfish-vanilla.exe  Edit4  evaluate.c  magic-plain.c  Makefile.bak  misc.h      movegen2.c  pawns.c     psqt.c      tbcore.c  thread.c   tt.c       uci.h
bitboard.h   bmi2-plain.h  config.h           Edit5  evaluate.h  magic-plain.h  material.c    mk.bash     movepick.c  pawns.h     qsearch.c   tbcore.h  thread.h   tt.h       ucioption.c

Danniel@Danniel-PC MINGW64 /g/chess/Cfish-master/src
$ make

To compile Cfish, type:

make target ARCH=arch [COMP=compiler] [COMPCC=cc]

Supported targets:

build                   > Standard build
profile-build           > PGO build
strip                   > Strip executable
install                 > Install executable
clean                   > Clean up

Supported archs:

x86-64                  > x86 64-bit
x86-64-modern           > x86 64-bit with popcnt support
x86-64-bmi2             > x86 64-bit with pext support
x86-32                  > x86 32-bit with SSE support
x86-32-old              > x86 32-bit fall back for old hardware
ppc-64                  > PPC 64-bit
ppc-32                  > PPC 32-bit
armv7                   > ARMv7 32-bit
general-64              > unspecified 64-bit
general-32              > unspecified 32-bit

Supported compilers:

gcc                     > Gnu compiler (default)
mingw                   > Gnu compiler with MinGW under Windows
clang                   > LLVM Clang compiler
icc                     > Intel compiler

Simple examples. If you don't know what to do, you likely want to run:

make build ARCH=x86-64    (This is for 64-bit systems)
make build ARCH=x86-32    (This is for 32-bit systems)

Advanced examples, for experienced users:

make build ARCH=x86-64 COMP=clang
make profile-build ARCH=x86-64-modern COMP=gcc COMPCC=gcc-4.8

Follow the instructions for your machine and your compiler
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: CFish

Post by Dann Corbit »

I run this script to build the two binaries in the src folder:

Code: Select all

Danniel@Danniel-PC MINGW64 /g/chess/Cfish-master/src
$ cat mk.bash
make profile-build ARCH=x86-64-modern COMP=mingw
strip cfish.exe
mv cfish.exe cfish-modern.exe
make profile-build ARCH=x86-64 COMP=mingw
strip cfish.exe
mv cfish.exe cfish-vanilla.exe
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
fantasmadel50
Posts: 112
Joined: Thu Apr 30, 2015 7:36 pm

Re: CFish

Post by fantasmadel50 »

Thank you for your help Dann, it would be too much to ask that you could upload a tutorial on how to compile these files? From already thank you very much. Muchas Gracias por su ayuda Dann , Seria mucho pedir que usted pudiera subir un tutorial de como compilar este tipo de archivos ? Desde ya muchas gracias.
Gusev
Posts: 1476
Joined: Mon Jan 28, 2013 2:51 pm

Re: CFish

Post by Gusev »

Hi Dann,

I do see the instructions. However, I am trying to compile from within Code::Blocks using your Makefile as a custom Makefile, with the x86_64-6.2.0-win32-seh-rt_v5-rev0 compiler.

In general, I would like to be able to compile Cfish from an IDE (say, Code::Blocks), before I give it to my student to play with.

Dmitri
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: CFish

Post by Ras »

Gusev wrote:In general, I would like to be able to compile Cfish from an IDE
That's not the best idea for a couple of reasons, which is why makefiles or buildscripts are usually the preferred solution.

- People use many different IDEs on many different operating systems. Including build instructions for any possible IDE on any operating system is not feasible.

- IDEs have tons of click-through options. There are even IDEs that seriously auto-generate part of the code, which is the worst thing I've ever seen. The consequence is that nobody knows what binary will be generated. Apart from the build problem, this also undermines reliable bug reports.

- In case that the software is using any kind of checksum on itself, the order in which the IDE decides to feed the object files to the linker may vary. You'll end up with functionally equivalent binaries, but with different checksum. You cannot tell anymore whether two versions are the same or not.

- Besides, in case the software has any kind of bugs related e.g. to uninitialised variables, the linking order can influence how these bugs will manifest. Again, this undermines useful bug reports.

- An update of the IDE may or may not shuffle around options, alter them or whatever so that there is no real control over the binary.

- The preferred IDE may not be available 5 years from now. There are applications where you have to be able to reproduce the exact binary even after updating the whole operating system.

In my experience, students suffering from IDE-mania are quite likely to get these points wrong with their first serious project after graduating. So if they are to actually learn something about development, it would be really helpful to advise them about these pitfalls.
Gusev
Posts: 1476
Joined: Mon Jan 28, 2013 2:51 pm

Re: CFish

Post by Gusev »

My purpose of compiling Cfish in an IDE is not to create an executable. The purpose is to give a student something to read conveniently in the IDE that does not give him errors. It's frustrating to have to read code that doesn't seem to work properly. When I attempt to compile from the .cbp project, the line

#define CacheLineSize 64

generates an error,

D:\Users\Dmitri\Documents\CodeBlocks Projects\Cfish\Cfish-master\src\tt.h|101|error: expected declaration specifiers or '...' before numeric constant|

Why isn't this compiler letting me define a simple constant?
Ras wrote:
Gusev wrote:In general, I would like to be able to compile Cfish from an IDE
That's not the best idea for a couple of reasons, which is why makefiles or buildscripts are usually the preferred solution.

- People use many different IDEs on many different operating systems. Including build instructions for any possible IDE on any operating system is not feasible.

- IDEs have tons of click-through options. There are even IDEs that seriously auto-generate part of the code, which is the worst thing I've ever seen. The consequence is that nobody knows what binary will be generated. Apart from the build problem, this also undermines reliable bug reports.

- In case that the software is using any kind of checksum on itself, the order in which the IDE decides to feed the object files to the linker may vary. You'll end up with functionally equivalent binaries, but with different checksum. You cannot tell anymore whether two versions are the same or not.

- Besides, in case the software has any kind of bugs related e.g. to uninitialised variables, the linking order can influence how these bugs will manifest. Again, this undermines useful bug reports.

- An update of the IDE may or may not shuffle around options, alter them or whatever so that there is no real control over the binary.

- The preferred IDE may not be available 5 years from now. There are applications where you have to be able to reproduce the exact binary even after updating the whole operating system.

In my experience, students suffering from IDE-mania are quite likely to get these points wrong with their first serious project after graduating. So if they are to actually learn something about development, it would be really helpful to advise them about these pitfalls.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: CFish

Post by Dann Corbit »

If you have code::blocks installed, open the project in the cfish folder.
If it does not build, then adjust the path to the binaries for the compiler to be the path on your machine and the names of the files on your machine.

I just use the base name (gcc, g++, make, etc.)

If you use msys2, you will have to collect make because for some strange reason, make does not come with msys2 by default
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.