Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Real time' pondering output for GUI like Lizzie #1240

Closed
wants to merge 1 commit into from
Closed

'Real time' pondering output for GUI like Lizzie #1240

wants to merge 1 commit into from

Conversation

Cabu
Copy link

@Cabu Cabu commented Apr 23, 2018

Generate more output during the pondering phase to let GUI display that information in a more 'real time' fashion.

This should reduce the number of fork of the engine just for the sake of having more information out of it to display in GUI.

Generate more output during the pondering phase to let GUI display that
information in a more 'real time' fashion.
@featurecat
Copy link

Thanks. The ~begin and ~end outputs aren't FULLY necessary but we'll see what gcp thinks. something like newlines might be fine. of course, I like the ~begin flags 😁

last_update = elapsed_centis;

if (cfg_rt_log) {
myprintf("~begin\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random marker? Nah.


if (cfg_rt_log) {
myprintf("~begin\n");
dump_stats(m_rootstate, *m_root);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't threadsafe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to check if taking the root node lock early on in dump_stats still allows the engine to work. You'll get a performance dip every time you dump, but that's unavoidable.

Copy link
Member

@gcp gcp Apr 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that doesn't work, you can rewrite the "root moves" dumping part of dump_stats into a separate function and call that instead. You can't use the sort_root_moves code there though, you'll have to write some code that gets the top x moves and remember them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could I make it thread safe? Is there an existing lock I could use? What code should I use (I don't know enough C to know how to do it)?

@gcp
Copy link
Member

gcp commented Apr 23, 2018

I would advise designing this more like UCI works: the engine advertises a "dump_move_stats" command in list_commands, which the GUI uses to probe that capability.

That command could then either be send during the search (trickier to implement), or the GUI could send "dump_move_stats 10" to enable periodic dumping every xx centiseconds. You can then add some markers or whatever format you want for easy and flexible display/parsing, as it will only be sent when the GUI requests it.

Whatever you do do not add command line options! That's terrible design for these kind of features because you can't steer them without reloading the entire engine.

@Cabu
Copy link
Author

Cabu commented Apr 23, 2018

Does https://github.com/Cabu/leela-zero/tree/Lizzie2 could be the way to go?

@gcp
Copy link
Member

gcp commented Apr 23, 2018

If you want to handle the command while the search is running it needs special handling. That's why I said that this option is "trickier to implement".

@Cabu
Copy link
Author

Cabu commented Apr 23, 2018

For Lizzie use, the think function of the engine is not used, only the ponder function is used to generate the datas to display on the board. This make handling the command while the search is running is not a problem as ponder stop when e new command is send and can be re-lunch like for the time_left command (that what I have done in the new pull request #1242).

@Cabu Cabu closed this Apr 23, 2018
@Cabu Cabu deleted the Lizzie branch April 23, 2018 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants