How is number of threads to use written on Android versions of Stockfish? Whole communication works but somehow I still can't change number of threads. I even have working code for PC version of Stockfish where changing number of threads works.

This is what I do:

SendLine("setoption name Threads value " + threads.ToString());

And this is what I get as a reply from Stockfish...

"Unknown command: setoption name Threads value 3"

When I send the same line with multiPV, Stockfish does everything as expected, sending desired number of PVs.

Is there something to consider when changing number of threads? Something that must be done prior to sending this command? Or is another command expected?

EDIT: I checked that when I "later" send meaningless line 'setoption name abc value true' it returns different text "No such option: abc". While the engine is silent when sending number of threads "later". So I expect it actually works after some time, so my question is, what must be done before sending command to change number of threads? As on the very initialisation it doesn't work for me.


I'm not sure what exactly happened, but looking through the source code, it appears your first token (setoption) is corrupted or not read properly.

Have you modified the code yourself? If so, please revert all your changes. Please double and triple check the source code where you compile Stockfish.

As on the very initialisation it doesn't work for me.

You don't need to initialise anything to make SF work. The common uci is absolutely useless (look in the source code to convince yourself). There is nothing you should need to do to initalize the engine.

I believe the problem was in how you compiled the engine. There's not enough information here for me to give you a complete answer.

| improve this answer | |
  • I am using the precompiled binaries of SF9 which are part of public download. I didn't do anything with the source code. If I recall, there's no line I am sending to SF prior to the non working setoption statement. It starts to work after set position, go infinite and stop commands. – hoacin Sep 26 '18 at 6:18
  • 1
    @hoacin If that's the case, why not send the options only after giving the initial position? Problem solved! – SmallChess Sep 26 '18 at 6:26

Stockfish ignores any first command I send to him. Don't know why. Probably I do something wrong when I initialize I/O redirection. This works perfectly to me.

stockfish.SendLine("Hello Stockfish!");
stockfish.SendLine("setoption name Threads value " + threads.ToString());

Just posting this answer as setting up number of threads as first command is quite logical thing to do. Stockfish replying "Unknown command: setoption name Threads value 3" is pretty misleading, taking into account that rest of communication works.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.