Comments (9)
Yes, clearing tp_move often will make sunfish play weaker.
Sunfish is currently quite inefficient with memory because it uses the standard python dictionaries, which store the whole position, rather than just the hash.
from sunfish.
How do you run it?
Are you saying it loses on time?
from sunfish.
How do you run it?
just fill the command pypy3 ./sunfish.py
in the setup window.
Are you saying it loses on time?
no, it seems when SunFish tries to reach higher depths, it consumes much CPU time .. even my computer clock (with seconds) freeezes and skips .. other processes are almost stuck - for a while .. after Sunfish made its move, CPU is normal again .. i know Python processes can have such behaviour in general .. btw. i use Xubuntu 22.04
from sunfish.
I mean, it uses 100% of one core while it thinks. All chess engines do that.
Are you perhaps running out of memory?
from sunfish.
Are you perhaps running out of memory?
i almost never have problems with memory, although normally i have several programs running .. but i checked the memory usage during play, and indeed : my memory (8 Gb total) is almost full .. so, thank you for suggesting, this could certainly be the cause -- eg. i never knew FireFox did take that much memory, having multiple tabs open ..
after closing a few applications, SunFish seems to run fine ..
after closing CuteChess (when the SunFish game ended) my OS made about 5 Gb memory free, that's a lot !? I guess it accumulated during play .. it that normal ?
from sunfish.
I always assumed sunfish was too slow to accumulate a lot of memory π
. It should free some every move.
How long games did you play?
from sunfish.
..It should free some every move..
i seems it doesn't .. i just did another test in CuteChess GUI : SunFish played a 20 minute game (per player), which can be considered "long", and i had very few applications open, using only 1.3 Gb of my max 7.6 .. while the game proceded, SunFish claimed upto ALL memory, leaving only 0.5 Gb at the end of the game .. the other engine is no Python and has a Hash option, which i set to 128 Mb .. letting this engine play with another non-Python one, the memory didn't increase at all until the end of their game .. however, another Python engine called PyGone (v1.5) somewhat has the same behaviour as SunFish : at the end of a (10 minute) game it had claimed about 2 Gb (and PyGone doesn't have a Hash option) .. after starting another game in CuteChess and then closing the tabs of the ended previous matches, memory is made free instantly - as you see in my graph screenshot .. doesn't (your) Python script free up memory after the game is finished ? Or should CuteChess do that ?
thanks again for pointing me to this memory issue concerning Python (chess engines) .. if you want more info, i can supply it.
from sunfish.
Ok, try to open sunfish.py
and after the line self.tp_score.clear()
(line 402) insert
if len(self.tp_move) > 10**6:
self.tp_move.clear()
and see if that helps!
(You could even try it with a lower number than 10^6 too.)
from sunfish.
that helps ! I did some test games again in CuteChess GUI, 20 minutes per player .. during the first game the memory usage climbed upto only 1.5 Gb .. so, i added a few code lines to log all moments .clear()
is done plus the length of self.tp_move
.. here's that data :
1366631
1645433
1108689
1061677
the .clear()
was done 4 times and the max length once was about 1.6 Gb - am i right?
if you decide to implement this in the main version, does it mean i discovered a bug ?
what is self.tp_move
anyway ? Some kind of Hash ? If so, then clearing it could also mean valuable data is lost and thus makes the engine play weaker afterwards ? Btw. you could create a UCI Hash option to set a max, because it's not fair : i gave only 128 Mb Hash to the other engine ..
from sunfish.
Related Issues (20)
- Support pondering
- βΉ SAINTGERMAIN
- chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 127) HOT 12
- 111
- sunfish
- removed
- Can we change the rules a bit and then run the engine. How well would it work?
- Three Check Chess variant HOT 2
- TCEC version ?
- CPU % remains after game ended
- Does not run on my iMac HOT 2
- Unable to locate engines.json file.
- Not able to run on Windows 10
- Sunfish keeps playing g1f3 illegally HOT 2
- Sunfish canβt handle end games, like KRK.
- Sunfish freezes after a while.
- experimental NNUE HOT 15
- about using pypy HOT 1
- Lichess - I'm not accepting challenges with this time control. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunfish.