Closed owenchak closed 2 years ago
Hi, it appears that stockfish uses 1 thread by default. How would I set the UCI thread option?
I've tried manually changing engine.New as follows but it didn't make any difference
func New(path string, opts ...func(e *Engine)) (*Engine, error) { path, err := exec.LookPath(path) if err != nil { return nil, fmt.Errorf("uci: executable not found at path %s %w", path, err) } rIn, wIn := io.Pipe() rOut, wOut := io.Pipe() cmd := exec.Command(path) cmd.Stdin = rIn cmd.Stdout = wOut var options = make(map[string] Option) options["Threads"] = Option{ Name: "Threads", Type: OptionSpin, Default: "2", Min: "2", Max: "4", Vars: []string{}, } e := &Engine{cmd: cmd, in: wIn, out: rOut, mu: &sync.RWMutex{}, logger: log.New(os.Stdout, "uci", log.LstdFlags), options: options} for _, opt := range opts { opt(e) } go e.cmd.Run() return e, nil }
It seems that CmdSetOption does what you want:
CmdSetOption
e := engine.New(...) e.Run(CmdSetOption{Name: "Threads", Value: "2"})
@owenchak does this solve your issue?
Hi, it appears that stockfish uses 1 thread by default. How would I set the UCI thread option?
I've tried manually changing engine.New as follows but it didn't make any difference