For HGM: Engine priority under Winboard/Polyglot

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

For HGM: Engine priority under Winboard/Polyglot

Post by Joost Buijs »

Yesterday during the ACCA tourney I found out that Winboard/Polyglot runs my engine in low priority. After changing this to normal priority I had a speedup of ~10% in nps.

Is there an option in the winboard.ini or polyglot.ini files to control this behaviour or do I have to modify Winboard cq Polyglot at the source code level? Polyglot itself is running in low priority as well, maybe the engine process get's the same priority as the parent process.

It would be nice if you can make an option in the Winboard engine settings to change the engine priority.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: For HGM: Engine priority under Winboard/Polyglot

Post by hgm »

The option is called -niceEngines, and on Windows -niceEngines 10 would give you "below normal". This is indeed how we configure it in the standard install. I guess the engine simply inherits the priority from Polyglot. (Which has an option for this too, btw.)

You must be running an awful lot of stuff on that PC that it uses 10% of your CPU power. (Of how many cores?)
ernest
Posts: 2041
Joined: Wed Mar 08, 2006 8:30 pm

Re: For HGM: Engine priority under Winboard/Polyglot

Post by ernest »

hgm wrote:You must be running an awful lot of stuff on that PC that it uses 10% of your CPU power
Indeed!!! 8-)
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: For HGM: Engine priority under Winboard/Polyglot

Post by Joost Buijs »

hgm wrote:You must be running an awful lot of stuff on that PC that it uses 10% of your CPU power. (Of how many cores?)
I,m just running the standard stuff on a 6 core machine. When the machine is idle e.g. the engine is not running I don't see any process activity at all, but still there is a difference of ~10% in nps between low priority and normal priority.
The operating system that exhibits this behaviour is Windows7 Enterprise x64.

I will take a look at the -niceEngines option. Thanks.
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: For HGM: Engine priority under Winboard/Polyglot

Post by Joost Buijs »

hgm wrote:The option is called -niceEngines, and on Windows -niceEngines 10 would give you "below normal".
/niceEngines 0 on the command line indeed does the trick, but when I change it in the winboard.ini file it doesn't do anything.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: For HGM: Engine priority under Winboard/Polyglot

Post by hgm »

You are probably changing it in the master settings file, then, in stead of the user-settings file. The latter overrules anything you specify in the master file, unless you write it behind the loading of the user file (the /settingsFile option in there). Then it would always overrule your saved settings. Anything before the /settingsFile line in the master file is only effective when you run WB for the first time, when here is no user settings file yet.

But I don't understand why you would have to touch the ini files at all. /niceEngines is a persistent option. So when you have used it once on the command line, the new value should automatically be saved in the settings file. Did you have Save Settings on Exit off?
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: For HGM: Engine priority under Winboard/Polyglot

Post by Joost Buijs »

hgm wrote:You are probably changing it in the master settings file, then, in stead of the user-settings file. The latter overrules anything you specify in the master file, unless you write it behind the loading of the user file (the /settingsFile option in there). Then it would always overrule your saved settings. Anything before the /settingsFile line in the master file is only effective when you run WB for the first time, when here is no user settings file yet.

But I don't understand why you would have to touch the ini files at all. /niceEngines is a persistent option. So when you have used it once on the command line, the new value should automatically be saved in the settings file. Did you have Save Settings on Exit off?
Yes, I tried to change it in the master file. Save settings on exit is on.
I really have no clue about Winboard i'm just using it to play on ICC.
I didn't know that there are separate user files and that things you specify on the command line are saved there as well. But now things are getting more clear.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: For HGM: Engine priority under Winboard/Polyglot

Post by hgm »

Well, it is more a matter of how we configured the install than a property of WinBoard itself. There is an option /settingsFile that can be used (e.g. on the command line) to specify a settings file for reading and later saving, and when you use that inside the default settings file, you redirect the saving/loading to another file, effectively making the default winboard.ini a master settings file that is never overwritten.

In the install we redirect to a file with a name that depends on the user (by using the meta symbol %APPDATA% in its pathname in Windows, and ~ for the users home directory in Linux), so that each user will have his settings saved in a private file. The redirection can be chained: a user could decide to edit another /settingsFile option in his user settings file, so that he now turns it into his own master settings file. This he can then use to specify options that would normally not be saved, or options to overrule the saved values, so that they become effectively volatile options with a default chosen by themselves.

It is a very powerful mechanism, really. You could also specify a settings file on the command line in a shortcut to invoke WinBoard for a special task. E.g. when you use WinBoard for playing your engine on ICC as well as running engine tournaments you would likely want completely different settings for those two tasks. So with the ICC shortcut you could specify a settings file that would then only be used for sessions on ICC. This allows you to tailor the configuration, and having it remembered on future ICC sessions without affecting the settings during engine tournaments. You could also use the settings files specified in the shortcut command line as master settings files, redirecting the saving to a common ICS settings file. In the master settings file you could then still put option settings that overrule the common settings, but apart from those options, an ICC session would remember what you did during your last FICS session, (say).
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: For HGM: Engine priority under Winboard/Polyglot

Post by Joost Buijs »

Ok, I see now where the user configuration file is stored. This is something I just didn't know.

When you store the main configuration files in %ALLUSERSPROFILE% or %PROGRAMDATA% it will not be necessary anymore to install Winboard in the root folder, but you can install it in Program Files instead.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: For HGM: Engine priority under Winboard/Polyglot

Post by hgm »

This could be a good idea. There was also some problem with the default saveGameFile, though, in the Program Files tree. People would specify a file in the WinBoard folder (because they were used to do that on old Windows systems), and then the games would get lost, because they did not have permission to create files there.

The idea of the current standard configuration was that people would install it in the folder where they had all their other Chess engines. So that the sub-folders Fairy-Max, Fruit, Pulsar etc. would simply be added to their engine collection.

Btw, normally it would not be needed to figure out where the user settings file actually is. (On many systems the user's AppData folder is hidden!) You could simply put the option you want to change on the 'command line' (i.e. give it as 'Additional option' in the WinBoard startup dialog), and on the next Save Settings it would automatically end up amongst the user settings. Only for 'list options', like the list of installed engines, it would be very inconvenient to do that, because you don't want to retype the entire list. So you really want to edit them. But this can be done during the session through menu items now, Engine -> Edit engine list, and then would find its way to the user settings file on saving. So it is almost never needed to have direct access to your user settings file.