help for a linux develop environment

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: help for a linux develop environment

Post by michiguel »

elcabesa wrote:hi, I use Linux at home for everything but chess development and I'd like to change the state of the things.

I mainly use kubuntu and as you can image kde.
1) what development environment can you suggest? I was thinking about Eclipse, so I can reuse it for windows too.
2) what compilers are available for linux? I'd like to test my engine with more than one compiler and have it work in a deterministic way, giving always the same result independent from the compiler
3) what chess testing environment are available in linux? i'd like to test the engine with cutechess, but I also would like to test it against pgn/epd file.

thank you all for your help
1) I use gedit, grep. I rarely use a debugger, but when I do, I first drink a dos XX and then use gdb. Generally my asserts catches them or I use printfs or I have switches that allow to spit debug info. I tossed the GUI when I moved to Linux. I found they get in the way for me. I have everything in scripts that do exactly what I want, without forgetting to check any box. My scripts are in Ruby, and I do not use make, I use Rake (Ruby make). These two are EXTREMELY friendly and powerful.

2) I use gcc, clang, icc (intel), and mingw64 to cross compile to windows. I cross compile to android too. I set the warnings to the max and I program in such a way that I get no warning. I think there is one or two I silence in Intel that are really bogus.

I cannot emphasize how much I love git.

3) cutechess-cli wrapped in scripts + ordo, xboard when i want to see some games.

Oh, once in while, a humbling experience with splint is useful, and doxygen to see how messy the program is becoming.

Miguel
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: help for a linux develop environment

Post by lucasart »

Rein Halbersma wrote:
bob wrote: For linux there are two good choices. GCC has been around for ever, is being actively developed using the open-source model, and works just fine on linux. Intel's C compiler is free for non-commercial use on linux (you have to look to find it on intel's web site, but it is there). It will produce a faster executable than gcc if you are running on an intel platform, if you use AMD you might get slower code.
3 good choices, actually: Clang is at least as good as gcc, especially if you are doing C++11, in which area Intel is lagging quite a bit.
My experience is that clang is measurably slower than gcc, and it is especially broken for C++11.

On what machine, operating system, version did you notice that clang was "at least as good" as gcc ?

When I use the clang from the latest Ubuntu repo, a simple

Code: Select all

#include <chrono>
in the code is enough to cause a non sensical compiler error (inside the chrono header). Nothing wrong with the code, and gcc compiles it perfectly. A lot of the standard headers can't be #include'd by clang in C++11.

Perhaps the problem is in the Debian or Ubuntu repo, but really I don't have time to figure out this kind of stuff. I want a compiler that is easy to install (sudo apt-get ...) and that just works reliably and produces fast code.

Clang may be the future, and perhaps it will be better than GCC in a few years. But in the _present_ GCC is the only sane choice (I don't even consider Intel and Microsoft's because they are not free software, anyway they suck in comparison to gcc).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Rein Halbersma
Posts: 771
Joined: Tue May 22, 2007 11:13 am

Re: help for a linux develop environment

Post by Rein Halbersma »

lucasart wrote:
Rein Halbersma wrote:
bob wrote: For linux there are two good choices. GCC has been around for ever, is being actively developed using the open-source model, and works just fine on linux. Intel's C compiler is free for non-commercial use on linux (you have to look to find it on intel's web site, but it is there). It will produce a faster executable than gcc if you are running on an intel platform, if you use AMD you might get slower code.
3 good choices, actually: Clang is at least as good as gcc, especially if you are doing C++11, in which area Intel is lagging quite a bit.
My experience is that clang is measurably slower than gcc, and it is especially broken for C++11.

On what machine, operating system, version did you notice that clang was "at least as good" as gcc ?
Linux Mint 15 64-bit, Clang 3.3 and Clang SVN trunk, both downloaded using sudo apt-get as explained below. My very heavily C++11 dependent code runs about 10% faster on Clang than on g++ 4.8.1 (which I also upgraded to using a backport from the upcoming Ubuntu 13.10 release).
When I use the clang from the latest Ubuntu repo, a simple

Code: Select all

#include <chrono>
in the code is enough to cause a non sensical compiler error (inside the chrono header). Nothing wrong with the code, and gcc compiles it perfectly. A lot of the standard headers can't be #include'd by clang in C++11.
IIRC, the Ubuntu 13.04 raring release / Mint 15 have Clang 3.2 as default, and that should be equivalent in terms of C++11 features to the installed g++ 4.7. Note that if you use an older Ubuntu (12.10 or 12.04) or Mint (14 / 13) you will get Clang 3.0 and that is not a mature C++11 compiler, so that could explain your <chrono> errors.
Perhaps the problem is in the Debian or Ubuntu repo, but really I don't have time to figure out this kind of stuff. I want a compiler that is easy to install (sudo apt-get ...) and that just works reliably and produces fast code.
Just follow the extremely simple instructions at http://llvm.org/apt/ You only need to add a single line to your repository list, and sudo apt-get will allow you to install either Clang 3.3 (latest stable release) or Clang SVN trunk (which will be Clang 3.4 later this year). Really, this is not rocket science.
Clang may be the future, and perhaps it will be better than GCC in a few years. But in the _present_ GCC is the only sane choice (I don't even consider Intel and Microsoft's because they are not free software, anyway they suck in comparison to gcc).
In every respect (speed, C++11 feature completeness), Clang 3.2 and Clang 3.3 are at least as good as g++ 4.7 and g++ 4.8.

Note that on Linux the Intel compiler is free, and on Windows the Microsoft Visual C++ express compiler is also free. I agree that they lack in C++11 features, but other than that, they are just fine speed wise. Did you try the VS2103RC already?
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: help for a linux develop environment

Post by Don »

elcabesa wrote:I'd like to use c++ and some c++11 feature like portable thread library.

I'd give a check to qt-creator since I like qt too :)

I already use git and have an account with code.google, i relly need a version management and branch manager :)

what about game and automatic testing of an engine? in windows I was used to use cutechess and arena
I just recently wrote a go language tester for chess. It's command line driven and pretty cool. I may be sharing it soon. I need to make a few more improvements before it's release-ready however. Here is a sample of how to run the first 5 openings (2 games per opening) in it's build in database of 35000+ openings:

drd@greencheeks ~/u/goTester $ ./auto -help
Usage of ./auto:
-cpus=4: Number of CPUs for test
-eindex=9: Index of last opening
-pgn="auto.pgn": Path of PGN file
-r="": Reference program invocation
-rinc=0.03: Reference program increment
-rmain=3: Reference program main time
-rn="": Name of reference player
-sindex=0: Index of first opening
-t="": Target program invocation
-tinc=0.03: Target program increment
-tmain=3: Target program main time
-tn="": Name of target player
drd@greencheeks ~/u/goTester $
drd@greencheeks ~/u/goTester $ ./auto -cpus=4 -sindex=0 -eindex=4 -pgn=test.pgn -t ./kt-1094.00 -r ./kt-1094.01
3 -1 5022585 4.4604 10.7414 5436841 4.5473 11.3966 Checkmate
0 1 5553943 4.6130 11.3881 6320318 4.7685 10.9104 Checkmate
2 1 5743131 4.6361 11.3333 5414748 4.8811 10.1212 Checkmate
1 0 10076912 7.5032 11.1083 9531876 7.5358 11.1847 Draw by repetition
6 1 5729323 4.6960 11.4648 6509273 4.8795 11.2113 Checkmate
4 -1 4546368 5.1867 9.7763 5463547 5.1427 9.6974 Checkmate
5 -1 6023420 5.4351 8.6484 5834929 5.3986 9.0769 Checkmate
7 -1 5222059 4.8041 10.2273 5979591 4.6812 11.0606 Checkmate
9 -1 8272192 6.3785 9.9739 7869124 6.4093 11.0174 Draw by 50 move rule
8 1 13756278 7.3008 16.4276 14858777 7.1288 16.9803 Draw by 50 move rule
drd@greencheeks ~/u/goTester $
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.