Stockfish Running 2 extra Threads

131 views
Skip to first unread message

RandyR

unread,
Mar 14, 2023, 10:54:00 AM3/14/23
to PicoChess
DIrk, Ghislain, Gerhard, or anyone,

I noticed that there are 2 a-stockf threads running even when the engine is selected to e.g Texel, all PicoTutor options are OFF and the webserver is disabled. Viewing with htop. This is using the latest code (except the spur fix). Any ideas what could be doing that? Am I forgetting something obvious?

Randy

RandyR

unread,
Mar 14, 2023, 11:02:59 AM3/14/23
to PicoChess
It looks like it's coming from picotutor.py. If I switch line 35 to b-texel, that runs 2 threads of texel with picotutor OFF.

Randy

Ghislain Bourgeois

unread,
Mar 14, 2023, 11:09:58 AM3/14/23
to PicoChess
Yes, the __init__ method initializes 2 engines, and there is a default engine provided. A quick fix would probably be to not instantiate picotutor at all when it is set to OFF. It would not work however if we dynamically turn off picotutor. Line 171 in picochess.py is where we instantiate it.

Another way to fix this would be to change picotutor to dynamically start the engines on first use.

I can take a stab at one of those solutions later today if you want.

Ghislain

Dirk

unread,
Mar 14, 2023, 11:29:58 AM3/14/23
to pico...@googlegroups.com
Hi Randy & Ghislain, 

You could do this but is it a problem at all? The threads shouldn’t consume any computing power unless the coach or watcher function are really enabled I think but of course that’s not best way (although if I remember correctly both engine threads should get the commands stop and quit when neither watcher nor coach is enabled).
It’s a long time ago I was working on that and should reworked some day cause it his now way too complicated ;-9

Dirk

-- 
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/picochess/3d6be1a9-d18e-405d-be31-26d67b6b8924n%40googlegroups.com.

Ghislain Bourgeois

unread,
Mar 14, 2023, 11:44:03 AM3/14/23
to PicoChess
Hi Dirk,

They seem to be taking a lot of memory for the low amount available on most RPi. On my DGTPi with Picotutor/Picocoach enabled, I see currently 5 a-stockf running. Out of those, the smallest memory usage is 89Mb, while the largest is 345Mb. The total usage of all the engines running at the moment is around 700Mb out of a maximum of 1024Mb total system memory. My system is even swapping a bit.

I think it is worth it to look more into this. I will take a look tonight.

Ghislain

Dirk

unread,
Mar 14, 2023, 11:50:04 AM3/14/23
to pico...@googlegroups.com
Yes then it makes even more sense.


By the way:
After reinstalling the requirements regarding spur/paraminko I now get the following warning when running picochess (fior tests manually):

pi@picochessweb:~/picochess $ sudo python3 picochess.py

/usr/local/lib/python3.9/dist-packages/paramiko/transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated

  "class": algorithms.Blowfish,


Do you know if we can ignore this?

Thanks Ghislain

RandyR

unread,
Mar 14, 2023, 12:07:29 PM3/14/23
to PicoChess
There's a workaround, but I didn't bother using it in my images. It's just a warning that can be ignored.

Randy

RandyR

unread,
Mar 14, 2023, 12:10:19 PM3/14/23
to PicoChess
We could possibly lower the default hash size. Haven't tested though.

Randy

Ghislain Bourgeois

unread,
Mar 14, 2023, 4:33:58 PM3/14/23
to PicoChess
I have just pushed a quick fix for this issue. It will not entirely fix the issue, because we will still be instantiating PicoTutor even if disabled, but at least with the configured engine. Before this fix, we always instantiated PicoTutor twice, once with only defaults values. I think the garbage collector in this case was not able to get rid of the engines processes.

This should already help a bit, but it would be great to not instantiate PicoTutor at all unless enabled in the configuration. I think however it will involve deeper changes.

Ghislain

Dirk

unread,
Mar 14, 2023, 5:42:55 PM3/14/23
to 'Dirk' via PicoChess
I think I have fixed the problem: If PicoWatcher and PicoCoach are both switched off then there won’t be any tutor engine initialization.

But we have to test this more carefully than I did….

When I can pull the changes from Ghislain in my repo (at the moment there are some minor conflicts) I will update it…

Dirk


Ghislain Bourgeois

unread,
Mar 14, 2023, 6:05:56 PM3/14/23
to 'Dirk' via PicoChess

Hi Dirk,

I fixed the conflict on my repo, so you should be able to pull in the changes now.

Ghislain

Dieter

unread,
Mar 25, 2023, 2:59:40 PM3/25/23
to PicoChess

>> /usr/local/lib/python3.9/dist-packages/paramiko/transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated

  "class": algorithms.Blowfish


Because of this error, I updated Paramiko to version 3.1.0. After that, the error message disappeared and I haven't noticed any effect on Picochess so far. Perhaps the requirements.txt should be adjusted in the repo.

Greetings
Dieter

Dirk

unread,
Mar 25, 2023, 4:10:42 PM3/25/23
to pico...@googlegroups.com
Yes, this works!
Thanks Dieter!

Dirk

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages