Help with CLOP

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 8:22 pm
Location: Singapore

Help with CLOP

Post by arjuntemurnikar » Wed Feb 05, 2014 5:33 am

Hi,

I am having trouble starting CLOP on my linux desktop.

I am running cutechess-cli 6 and CLOP 0.0.9, both of which, I compiled myself.

When I run it from the GUI, I get the following log output:

Code: Select all

2014-02-04 21:21:27 ===== Starting: futility =====
2014-02-04 21:21:28 Run
2014-02-04 21:21:28 id = 5 (machine6); Seed = 0; Starting new sample
2014-02-04 21:21:28 id = 4 (machine5); Seed = 1; Starting new sample
2014-02-04 21:21:28 id = 3 (machine4); Seed = 2; Starting new sample
2014-02-04 21:21:28 id = 2 (machine3); Seed = 3; Starting new sample
2014-02-04 21:21:28 id = 1 (machine2); Seed = 4; Starting new sample
2014-02-04 21:21:28 id = 0 (machine1); Seed = 5; Starting new sample
2014-02-04 21:21:28 id = 5 (machine6); Seed = 0; Error: Permission denied
2014-02-04 21:21:28 id = 5 stopped. RunningProcessors = 5
2014-02-04 21:21:28 id = 4 (machine5); Seed = 1; Error: Permission denied
2014-02-04 21:21:28 id = 4 stopped. RunningProcessors = 4
2014-02-04 21:21:28 id = 3 (machine4); Seed = 2; Error: Permission denied
2014-02-04 21:21:28 id = 3 stopped. RunningProcessors = 3
2014-02-04 21:21:28 id = 1 (machine2); Seed = 4; Error: Permission denied
2014-02-04 21:21:28 id = 1 stopped. RunningProcessors = 2
2014-02-04 21:21:28 id = 2 (machine3); Seed = 3; Error: Permission denied
2014-02-04 21:21:28 id = 2 stopped. RunningProcessors = 1
2014-02-04 21:21:28 id = 0 (machine1); Seed = 5; Error: Permission denied
2014-02-04 21:21:28 id = 0 stopped. RunningProcessors = 0
2014-02-04 21:21:28 Stop
My CLOP file is as follows:

Code: Select all

#
# DummyExperiment.clop
#
# Example of experiment definition
#

# Name (used for .log and .dat files)
Name futility

# Script for running a game. See DummyScript.py for details.
Script ./clop-cutechess-cli.py

# Parameter(s) to be optimized
# <parameter_type> <name> <min> <max>
# <parameter_type> may be&#58;
#  LinearParameter
#  IntegerParameter
#  GammaParameter
#  IntegerGammaParameter
# For GammaParameter, quadratic regression is performed on log&#40;x&#41;
# Warning&#58; 123 and not 123.0 should be used for IntegerParameter
IntegerParameter RM1 -2000 1000
IntegerParameter RM2 -1000 1000

# This could be the list of machine names in a distributed experiment.
# In order to run 4 games in parallel, 2 on machine1, 2 on machine2&#58; 
Processor machine1
Processor machine2
Processor machine3
Processor machine4
Processor machine5
Processor machine6

# Call the script "Replications" times in a row with identical parameter values
# Replications may be used to alternate colors, for instance.
# Seed % Replications would indicate color.
Replications 2

# Parameters of statistical model of outcome
# For binary outcome &#40;Win/Loss, no draws&#41;, use "DrawElo 0"
# For chess, use "DrawElo 100"
DrawElo 100

# Regression parameters
# H 3 is recommended &#40;it is the default value&#41;
# Correlations may be "all" &#40;default&#41; or "none"
# Even if variables are not correlated "all" should work well. The problem is
# that the regression might become very costly if the number of variables is
# high. So use "Correlations none" only if you are certain parameters are
# independent or you have so many variables that "all" is too costly.
H 3
Correlations all
I am running the cutechess-cli.py script which I modified as follows:

Code: Select all

# Path to the cutechess-cli executable.
# On Windows this should point to cutechess-cli.exe
cutechess_cli_path = './cutechess-cli.sh'

# The engine whose parameters will be optimized
engine = 'cmd=stockfish proto=uci option.Threads=1'

# Format for the commands that are sent to the engine to
# set the parameter values. When the command is sent,
# &#123;name&#125; will be replaced with the parameter name and &#123;value&#125;
# with the parameter value.
engine_param_cmd = 'setoption name &#123;name&#125; value &#123;value&#125;'

# A pool of opponents for the engine. The opponent will be
# chosen based on the seed sent by CLOP.
opponents = &#91;
    'cmd=stockfish proto=uci option.Threads=1 name=base'
&#93;

# Additional cutechess-cli options, eg. time control and opening book
options = '-each tc=2+0.02 proto=uci restart=on -openings file=book5.epd format=epd order=random -draw movenumber=34 movecount=8 score=20 -resign movecount=4 score=400'
I read on another forum that you need to input the cutechess-cli.sh file (included in the package) instead of the executable, but I cannot find such a file in the cutechess-cli package I downloaded and compiled, so, I went ahead and created my own 'launcher' script:

Code: Select all

#!/bin/bash
./cutechess-cli -games 10000 -pgnout clopgames.pgn -resign movecount=3 score=400 -draw movenumber=34 movecount=8 score=20 -concurrency 7 -openings file=book5.epd format=epd order=random plies=16 -engine name=stockfish cmd=stockfish -engine name=base cmd=stockfish -each proto=uci option.Threads=1 option.OwnBook=false option.Hash=128 restart=on tc=2+0.02
..and I marked it as executable with

Code: Select all

chmod +x
It doesn't work. Any help is appreciated.

P.S. I tried linking it to the executable cutechess-cli, but that didn't work either.

Adam Hair
Posts: 3201
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Re: Help with CLOP

Post by Adam Hair » Wed Feb 05, 2014 11:05 am

I downloaded and use the 64-bit Linux binary provided at the cutechess GitHub repository. It included a library folder and a shell script (cutechess-cli.sh) to direct cutechess to the librarys.

arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 8:22 pm
Location: Singapore

Re: Help with CLOP

Post by arjuntemurnikar » Wed Feb 05, 2014 11:24 am

Oh, so thats where the script is at.

Alright. I downloaded the binary and copy-pasted the script file and the lib folder (just in case) into the same folder as clop. Everything else, same as above.

Didn't work.

I get the same log entry as above.

Help is appreciated.

Thanks

P.S. The script seems to work fine. When I launch ./cutechess-cli.sh in the terminal without any arguments, I get the following output:

Code: Select all

Warning&#58; At least two engines are needed.

Daniel Shawul
Posts: 3746
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

Re: Help with CLOP

Post by Daniel Shawul » Wed Feb 05, 2014 6:14 pm

I guess since you tried 'chmod' already, try 'dos2unix'. CLOP doesn't know about the script so it just echoes whatever it recieved. It only means the script is unexcutable.

You can also compile a simple executable which just prints 'W' and see if that works instead of the shell script.

Code: Select all

#include <stdio.h>
int main&#40;) &#123;
printf&#40;"W");
&#125;
In that case you know for sure it is the cutechess-cli.sh script.

arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 8:22 pm
Location: Singapore

Re: Help with CLOP

Post by arjuntemurnikar » Wed Feb 05, 2014 11:34 pm

I compiled the code you described and ran the program in terminal.

I get no output.

What does this mean?

I also would like to note that when I run clop, there is no activity in the task manager, and also no output.

I converted cutechess-cli.sh using dos2unix, but clop still doesn't run.

arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 8:22 pm
Location: Singapore

Re: Help with CLOP

Post by arjuntemurnikar » Wed Feb 05, 2014 11:43 pm

I would like to add that when I run games in cutechess, it works as normal. Output is shown.

jdart
Posts: 3816
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Help with CLOP

Post by jdart » Thu Feb 06, 2014 12:03 am

In the python file, "cmd=stockfish" will not work unless stockfish is on your PATH. Try specifying the full path to the executable.

Also note cutechess needs a library that is located in projects/lib under the cutechess directory. So LD_LIBRARY_PATH should include that directory. Probably you are doing this if you are able to run cutechess outside of CLOP.

--Jon

Daniel Shawul
Posts: 3746
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

Re: Help with CLOP

Post by Daniel Shawul » Thu Feb 06, 2014 1:16 am

What do you mean there is no output? It prints a "W" and exists. All that a script needs to do is print either "W","D", or "L" in the end. Cutechess is just a more elaborate of doing just that as far as Clop is concerned.

Here when I test it with Clop it runs so fast like a 1000 games per second , you might think it is hanging. Maybe a Sleep(500) would be a good idea to put before the printf. If you compiled it to dum.exe, you should put ./dum as the script in windows.

arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 8:22 pm
Location: Singapore

Re: Help with CLOP

Post by arjuntemurnikar » Thu Feb 06, 2014 1:24 am

Sorry there is output.

I mistyped it

Code: Select all

test
instead of

Code: Select all

./test
.

So now about CLOP, what do I do about the "permission denied"?

Daniel Shawul
Posts: 3746
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

Re: Help with CLOP

Post by Daniel Shawul » Thu Feb 06, 2014 3:19 am

arjuntemurnikar wrote:Sorry there is output.

I mistyped it

Code: Select all

test
instead of

Code: Select all

./test
.

So now about CLOP, what do I do about the "permission denied"?
So did it work with CLOP or did you just run it from the command line?

Do the same with a simple python program that prints "print 'W'" see if there is a difference. On windows you need to execute 'python dum.py'. For linux that might be also the case so in your shell script add a 'python' infront to see it works. If that doesn't work give the full path to the python /home/python27/python etc.

Code: Select all

# Script for running a game. See DummyScript.py for details. 
Script ./clop-cutechess-cli.py 
should be

Code: Select all

# Script for running a game. See DummyScript.py for details. 
Script python ./clop-cutechess-cli.py 
Also print some debugging stuff to a log file or stderr in the first lines of your python script and see if it is being executed.

Post Reply