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

Enforce parallelism of at most 4 for match games to reduce short game bias. #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lc0_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func checkLc0() {
}
}

func (c *cmdWrapper) launch(networkPath string, otherNetPath string, args []string, input bool) {
func (c *cmdWrapper) launch(networkPath string, otherNetPath string, args []string, input bool, parallelismLimitOverride int) {
dir, _ := os.Getwd()
c.Cmd = exec.Command(path.Join(dir, "lc0"))
// Add the "selfplay" or "uci" part first
Expand All @@ -268,6 +268,11 @@ func (c *cmdWrapper) launch(networkPath string, otherNetPath string, args []stri
c.Cmd.Args = append(c.Cmd.Args, parts...)
}
parallelism := *parallel
if parallelismLimitOverride > 0 {
if parallelism <= 0 || parallelism > parallelismLimitOverride {
parallelism = parallelismLimitOverride
}
}
if *backopts != "" {
// Check agains small token blacklist, currently only "random"
tokens := regexp.MustCompile("[,=().0-9]").Split(*backopts, -1)
Expand Down Expand Up @@ -417,7 +422,10 @@ func playMatch(httpClient *http.Client, ngr client.NextGameResponse, baselinePat
params = append(params, "--training=true")
params = append(params, "--visits=800")
c := createCmdWrapper()
c.launch(candidatePath, baselinePath, params /* input= */, false)
// Enforce a parallelism of at most 4 for match games - to reduce the level of 'short game' bias.
// Match games use parameter settings that utilize more gpu than a single game in training,
// so 4 should be enough to get decent saturation.
c.launch(candidatePath, baselinePath, params /* input= */, false, 4)
trainDirHolder := make([]string, 1)
trainDirHolder[0] = ""
defer func() {
Expand Down Expand Up @@ -569,7 +577,7 @@ func train(httpClient *http.Client, ngr client.NextGameResponse,
params = append([]string{"selfplay"}, params...)
params = append(params, "--training=true")
c := createCmdWrapper()
c.launch(networkPath, otherNetPath, params /* input= */, false)
c.launch(networkPath, otherNetPath, params /* input= */, false, 0)
trainDirHolder := make([]string, 1)
trainDirHolder[0] = ""
defer func() {
Expand Down