{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/minigo/pulls/comments/233869573","pull_request_review_id":175382428,"id":233869573,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzg2OTU3Mw==","diff_hunk":"@@ -706,14 +729,220 @@ class Evaluator {\n   std::vector<std::thread> threads_;\n };\n \n+class GtpEvaluator {\n+  class GtpClient {\n+   public:\n+    GtpClient(char* const cmd_args[], float komi) : color_(Color::kBlack) {\n+      int in_pipe[2];   // minigo <- gnugo pipe\n+      int out_pipe[2];  // minigo -> gnugo pipe\n+\n+      MG_CHECK(pipe(in_pipe) == 0);\n+      MG_CHECK(pipe(out_pipe) == 0);\n+\n+      if (auto pid = fork()) {\n+        MG_CHECK(pid > 0);\n+      } else {\n+        MG_CHECK(close(in_pipe[0]) == 0);\n+        MG_CHECK(close(out_pipe[1]) == 0);\n+\n+        MG_CHECK(dup2(in_pipe[1], STDOUT_FILENO) >= 0);\n+        MG_CHECK(dup2(out_pipe[0], STDIN_FILENO) >= 0);\n+\n+        MG_CHECK(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0);\n+        MG_CHECK(execvp(cmd_args[0], cmd_args) == 0);\n+\n+        exit(0);\n+      }\n+\n+      MG_CHECK(close(in_pipe[1]) == 0);\n+      MG_CHECK(close(out_pipe[0]) == 0);\n+\n+      input_ = fdopen(in_pipe[0], \"r\");\n+      output_ = fdopen(out_pipe[1], \"w\");\n+      MG_CHECK(input_ && output_);\n+\n+      MG_CHECK(Send(absl::StrFormat(\"boardsize %d\", kN)));\n+      MG_CHECK(Send(\"komi \" + std::to_string(komi)));\n+    }\n+\n+    ~GtpClient() {\n+      fclose(input_);\n+      fclose(output_);\n+    }\n+\n+    bool Play(const Coord& move) {","path":"cc/main.cc","position":268,"original_position":268,"commit_id":"5b83e958ec4fa1d7c1a68c6f4639f8be9f829773","original_commit_id":"5b83e958ec4fa1d7c1a68c6f4639f8be9f829773","user":{"login":"chsigg","id":7523982,"node_id":"MDQ6VXNlcjc1MjM5ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/7523982?v=4","gravatar_id":"","url":"https://api.github.com/users/chsigg","html_url":"https://github.com/chsigg","followers_url":"https://api.github.com/users/chsigg/followers","following_url":"https://api.github.com/users/chsigg/following{/other_user}","gists_url":"https://api.github.com/users/chsigg/gists{/gist_id}","starred_url":"https://api.github.com/users/chsigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chsigg/subscriptions","organizations_url":"https://api.github.com/users/chsigg/orgs","repos_url":"https://api.github.com/users/chsigg/repos","events_url":"https://api.github.com/users/chsigg/events{/privacy}","received_events_url":"https://api.github.com/users/chsigg/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2018-11-15T14:44:47Z","updated_at":"2018-11-15T14:44:47Z","html_url":"https://github.com/tensorflow/minigo/pull/558#discussion_r233869573","pull_request_url":"https://api.github.com/repos/tensorflow/minigo/pulls/558","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/comments/233869573"},"html":{"href":"https://github.com/tensorflow/minigo/pull/558#discussion_r233869573"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/558"}},"in_reply_to_id":232767171},"pull_request":{"url":"https://api.github.com/repos/tensorflow/minigo/pulls/558","id":230219109,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwMjE5MTA5","html_url":"https://github.com/tensorflow/minigo/pull/558","diff_url":"https://github.com/tensorflow/minigo/pull/558.diff","patch_url":"https://github.com/tensorflow/minigo/pull/558.patch","issue_url":"https://api.github.com/repos/tensorflow/minigo/issues/558","number":558,"state":"open","locked":false,"title":"Add evaluation against external program using GTP protocol.","user":{"login":"chsigg","id":7523982,"node_id":"MDQ6VXNlcjc1MjM5ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/7523982?v=4","gravatar_id":"","url":"https://api.github.com/users/chsigg","html_url":"https://github.com/chsigg","followers_url":"https://api.github.com/users/chsigg/followers","following_url":"https://api.github.com/users/chsigg/following{/other_user}","gists_url":"https://api.github.com/users/chsigg/gists{/gist_id}","starred_url":"https://api.github.com/users/chsigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chsigg/subscriptions","organizations_url":"https://api.github.com/users/chsigg/orgs","repos_url":"https://api.github.com/users/chsigg/repos","events_url":"https://api.github.com/users/chsigg/events{/privacy}","received_events_url":"https://api.github.com/users/chsigg/received_events","type":"User","site_admin":false},"body":"This change allows --mode=eval to specify --gtp_client=\"/usr/games/gnugo -gtp\" (instead of --model_two) to play against an external program.\r\n\r\nIt starts one subprocess per --parallel_games and gtp-communicates with the external program through pipes.\r\n\r\nAdmittedly, the code is relatively messy. If you prefer, I can instead make this a patch to the MLPerf MiniGo  dependency.","created_at":"2018-11-12T17:51:49Z","updated_at":"2018-11-15T14:44:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"377e4cef6b9d293566920a8b4340ca6b5d0068c9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":832833043,"node_id":"MDU6TGFiZWw4MzI4MzMwNDM=","url":"https://api.github.com/repos/tensorflow/minigo/labels/size/L","name":"size/L","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/minigo/pulls/558/commits","review_comments_url":"https://api.github.com/repos/tensorflow/minigo/pulls/558/comments","review_comment_url":"https://api.github.com/repos/tensorflow/minigo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/minigo/issues/558/comments","statuses_url":"https://api.github.com/repos/tensorflow/minigo/statuses/5b83e958ec4fa1d7c1a68c6f4639f8be9f829773","head":{"label":"chsigg:gtp_eval","ref":"gtp_eval","sha":"5b83e958ec4fa1d7c1a68c6f4639f8be9f829773","user":{"login":"chsigg","id":7523982,"node_id":"MDQ6VXNlcjc1MjM5ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/7523982?v=4","gravatar_id":"","url":"https://api.github.com/users/chsigg","html_url":"https://github.com/chsigg","followers_url":"https://api.github.com/users/chsigg/followers","following_url":"https://api.github.com/users/chsigg/following{/other_user}","gists_url":"https://api.github.com/users/chsigg/gists{/gist_id}","starred_url":"https://api.github.com/users/chsigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chsigg/subscriptions","organizations_url":"https://api.github.com/users/chsigg/orgs","repos_url":"https://api.github.com/users/chsigg/repos","events_url":"https://api.github.com/users/chsigg/events{/privacy}","received_events_url":"https://api.github.com/users/chsigg/received_events","type":"User","site_admin":false},"repo":{"id":146749005,"node_id":"MDEwOlJlcG9zaXRvcnkxNDY3NDkwMDU=","name":"minigo-fork","full_name":"chsigg/minigo-fork","private":false,"owner":{"login":"chsigg","id":7523982,"node_id":"MDQ6VXNlcjc1MjM5ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/7523982?v=4","gravatar_id":"","url":"https://api.github.com/users/chsigg","html_url":"https://github.com/chsigg","followers_url":"https://api.github.com/users/chsigg/followers","following_url":"https://api.github.com/users/chsigg/following{/other_user}","gists_url":"https://api.github.com/users/chsigg/gists{/gist_id}","starred_url":"https://api.github.com/users/chsigg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chsigg/subscriptions","organizations_url":"https://api.github.com/users/chsigg/orgs","repos_url":"https://api.github.com/users/chsigg/repos","events_url":"https://api.github.com/users/chsigg/events{/privacy}","received_events_url":"https://api.github.com/users/chsigg/received_events","type":"User","site_admin":false},"html_url":"https://github.com/chsigg/minigo-fork","description":"An open-source implementation of the AlphaGoZero algorithm","fork":true,"url":"https://api.github.com/repos/chsigg/minigo-fork","forks_url":"https://api.github.com/repos/chsigg/minigo-fork/forks","keys_url":"https://api.github.com/repos/chsigg/minigo-fork/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chsigg/minigo-fork/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chsigg/minigo-fork/teams","hooks_url":"https://api.github.com/repos/chsigg/minigo-fork/hooks","issue_events_url":"https://api.github.com/repos/chsigg/minigo-fork/issues/events{/number}","events_url":"https://api.github.com/repos/chsigg/minigo-fork/events","assignees_url":"https://api.github.com/repos/chsigg/minigo-fork/assignees{/user}","branches_url":"https://api.github.com/repos/chsigg/minigo-fork/branches{/branch}","tags_url":"https://api.github.com/repos/chsigg/minigo-fork/tags","blobs_url":"https://api.github.com/repos/chsigg/minigo-fork/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chsigg/minigo-fork/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chsigg/minigo-fork/git/refs{/sha}","trees_url":"https://api.github.com/repos/chsigg/minigo-fork/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chsigg/minigo-fork/statuses/{sha}","languages_url":"https://api.github.com/repos/chsigg/minigo-fork/languages","stargazers_url":"https://api.github.com/repos/chsigg/minigo-fork/stargazers","contributors_url":"https://api.github.com/repos/chsigg/minigo-fork/contributors","subscribers_url":"https://api.github.com/repos/chsigg/minigo-fork/subscribers","subscription_url":"https://api.github.com/repos/chsigg/minigo-fork/subscription","commits_url":"https://api.github.com/repos/chsigg/minigo-fork/commits{/sha}","git_commits_url":"https://api.github.com/repos/chsigg/minigo-fork/git/commits{/sha}","comments_url":"https://api.github.com/repos/chsigg/minigo-fork/comments{/number}","issue_comment_url":"https://api.github.com/repos/chsigg/minigo-fork/issues/comments{/number}","contents_url":"https://api.github.com/repos/chsigg/minigo-fork/contents/{+path}","compare_url":"https://api.github.com/repos/chsigg/minigo-fork/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chsigg/minigo-fork/merges","archive_url":"https://api.github.com/repos/chsigg/minigo-fork/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chsigg/minigo-fork/downloads","issues_url":"https://api.github.com/repos/chsigg/minigo-fork/issues{/number}","pulls_url":"https://api.github.com/repos/chsigg/minigo-fork/pulls{/number}","milestones_url":"https://api.github.com/repos/chsigg/minigo-fork/milestones{/number}","notifications_url":"https://api.github.com/repos/chsigg/minigo-fork/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chsigg/minigo-fork/labels{/name}","releases_url":"https://api.github.com/repos/chsigg/minigo-fork/releases{/id}","deployments_url":"https://api.github.com/repos/chsigg/minigo-fork/deployments","created_at":"2018-08-30T12:50:49Z","updated_at":"2018-10-25T13:13:00Z","pushed_at":"2018-11-12T17:58:58Z","git_url":"git://github.com/chsigg/minigo-fork.git","ssh_url":"git@github.com:chsigg/minigo-fork.git","clone_url":"https://github.com/chsigg/minigo-fork.git","svn_url":"https://github.com/chsigg/minigo-fork","homepage":"","size":3151,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"fda1487dff94a710e9359f80c28d08d99d6c3e3c","user":{"login":"tensorflow","id":15658638,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjU4NjM4","avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"repo":{"id":119455332,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk0NTUzMzI=","name":"minigo","full_name":"tensorflow/minigo","private":false,"owner":{"login":"tensorflow","id":15658638,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjU4NjM4","avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tensorflow/minigo","description":"An open-source implementation of the AlphaGoZero algorithm","fork":false,"url":"https://api.github.com/repos/tensorflow/minigo","forks_url":"https://api.github.com/repos/tensorflow/minigo/forks","keys_url":"https://api.github.com/repos/tensorflow/minigo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/minigo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/minigo/teams","hooks_url":"https://api.github.com/repos/tensorflow/minigo/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/minigo/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/minigo/events","assignees_url":"https://api.github.com/repos/tensorflow/minigo/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/minigo/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/minigo/tags","blobs_url":"https://api.github.com/repos/tensorflow/minigo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/minigo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/minigo/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/minigo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/minigo/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/minigo/languages","stargazers_url":"https://api.github.com/repos/tensorflow/minigo/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/minigo/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/minigo/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/minigo/subscription","commits_url":"https://api.github.com/repos/tensorflow/minigo/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/minigo/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/minigo/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/minigo/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/minigo/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/minigo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/minigo/merges","archive_url":"https://api.github.com/repos/tensorflow/minigo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/minigo/downloads","issues_url":"https://api.github.com/repos/tensorflow/minigo/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/minigo/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/minigo/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/minigo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/minigo/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/minigo/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/minigo/deployments","created_at":"2018-01-29T23:29:07Z","updated_at":"2018-11-15T13:53:14Z","pushed_at":"2018-11-15T00:52:02Z","git_url":"git://github.com/tensorflow/minigo.git","ssh_url":"git@github.com:tensorflow/minigo.git","clone_url":"https://github.com/tensorflow/minigo.git","svn_url":"https://github.com/tensorflow/minigo","homepage":"","size":3318,"stargazers_count":2482,"watchers_count":2482,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":354,"mirror_url":null,"archived":false,"open_issues_count":61,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":354,"open_issues":61,"watchers":2482,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/558"},"html":{"href":"https://github.com/tensorflow/minigo/pull/558"},"issue":{"href":"https://api.github.com/repos/tensorflow/minigo/issues/558"},"comments":{"href":"https://api.github.com/repos/tensorflow/minigo/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/minigo/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/minigo/statuses/5b83e958ec4fa1d7c1a68c6f4639f8be9f829773"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"chsigg"}}