A problem with my delphi engine in Windows XP

Archive of the old Parsimony forum. Some messages couldn't be restored. Limitations: Search for authors does not work, Parsimony specific formats do not work, threaded view does not work properly. Posting is disabled.

A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 26 Sep 2004, 23:25

Geschrieben von:/Posted by: Martin Giepmans at 27 September 2004 00:25:07:

I plan to release my Delphi engine SpiderChess as a winboard engine in the near future and I'm now working on the winboard protocol (it was incomplete till now, just enough to play games on ICS).
Last week Guenther Simon encountered a problem: when Spider plays another engine in winboard on one (single processor) pc that uses Windows XP something goes wrong if both engines have pondering on. Among other things:
- The other engine gets no processor time for pondering when it's Spiders turn.
- When Spider ponders it reacts very slow to input of the other engine. Till now it has as far as I know never been able to finish a game, it always loses on time.
The odd thing is that everything is okay on machines that run Windows ME or 98. And on an XP machine there is no problem when pondering is off.
Spider uses a thread that polls input.
I have no idea what the cause of the problem is. Does anybody know what is going on here?
I can of course simply tell users that they should leave pondering off when playing another engine on a single processor XP machine, that is probably better anyway.
But I don't like the idea of having "known issues" in the helpfile of my program. ;)
Thanks in advance,
Martin Giepmans
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Andrew Fan » 27 Sep 2004, 00:14

Geschrieben von:/Posted by: Andrew Fan at 27 September 2004 01:14:13:
Als Antwort auf:/In reply to: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Martin Giepmans at 27 September 2004 00:25:07:

Not sure if the followings will help but you are welcome to try/test:
1. Run winboard under Win95/98 mode compatible mode in XP.
2. Change the process scheduling methods to "Background services" mode
3. Add non-polling delays in your engine when pondering.
4. Convert to C/C++ .
Good luck.
Andrew.
I plan to release my Delphi engine SpiderChess as a winboard engine in the near future and I'm now working on the winboard protocol (it was incomplete till now, just enough to play games on ICS).
Last week Guenther Simon encountered a problem: when Spider plays another engine in winboard on one (single processor) pc that uses Windows XP something goes wrong if both engines have pondering on. Among other things:
- The other engine gets no processor time for pondering when it's Spiders turn.
- When Spider ponders it reacts very slow to input of the other engine. Till now it has as far as I know never been able to finish a game, it always loses on time.
The odd thing is that everything is okay on machines that run Windows ME or 98. And on an XP machine there is no problem when pondering is off.
Spider uses a thread that polls input.
I have no idea what the cause of the problem is. Does anybody know what is going on here?
I can of course simply tell users that they should leave pondering off when playing another engine on a single processor XP machine, that is probably better anyway.
But I don't like the idea of having "known issues" in the helpfile of my program. ;)
Thanks in advance,
Martin Giepmans
Andrew Fan
 

Re: A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 27 Sep 2004, 00:40

Geschrieben von:/Posted by: Martin Giepmans at 27 September 2004 01:40:08:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Andrew Fan at 27 September 2004 01:14:13:
Not sure if the followings will help but you are welcome to try/test:
1. Run winboard under Win95/98 mode compatible mode in XP.
2. Change the process scheduling methods to "Background services" mode
3. Add non-polling delays in your engine when pondering.
4. Convert to C/C++ .
Good luck.
Andrew.
4 is maybe the best solution, lol.
I'm not sure what you mean in 3. Could you eleborate?
Martin
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Steve Maughan » 27 Sep 2004, 12:40

Geschrieben von:/Posted by: Steve Maughan at 27 September 2004 13:40:46:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Andrew Fan at 27 September 2004 01:14:13:

Andrew,
4. Convert to C/C++ .
I'm sure it's not a problem with Delphi - there are plenty of Delphi engines that don't have a problem with XP e.g. Delfi and Monarch 2002


http://www.stevemaughan.com
Steve Maughan
 

Re: A problem with my delphi engine in Windows XP

Postby Andrew Fan » 27 Sep 2004, 12:52

Geschrieben von:/Posted by: Andrew Fan at 27 September 2004 13:52:15:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Martin Giepmans at 27 September 2004 01:40:08:

Hi Martin,
In XP, if two or more processes/threads has the same priority, they should get the same amount of time to run before being context switched. Could it be that your pondering thread is at a higher than normal priority?
I assume, of course, you are using multi-threaded code.
Non-polling delay can be a call to the OS' Sleep() function, which will cause a context switch. Peeking at the I/O channels for available input is polling, which uses CPU time, unless the peek can be blocked.
Not sure if Sleep() is called Sleep() in Delphi, haven't used Delphi for many many years.
Delphi is fine, I am just kidding.
Andrew.
Not sure if the followings will help but you are welcome to try/test:
1. Run winboard under Win95/98 mode compatible mode in XP.
2. Change the process scheduling methods to "Background services" mode
3. Add non-polling delays in your engine when pondering.
4. Convert to C/C++ .
Good luck.
Andrew.
4 is maybe the best solution, lol.
I'm not sure what you mean in 3. Could you eleborate?
Martin
Andrew Fan
 

Re: A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 27 Sep 2004, 18:25

Geschrieben von:/Posted by: Martin Giepmans at 27 September 2004 19:25:10:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Steve Maughan at 27 September 2004 13:40:46:
Andrew,
4. Convert to C/C++ .
I'm sure it's not a problem with Delphi - there are plenty of Delphi engines that don't have a problem with XP e.g. Delfi and Monarch 2002
I probably use a somewhat unusual method to connect to winboard.
I have never studied open source code (neither in C nor in Delphi) so many things in Spider are non standard, I guess.
In the code that you posted on CCC I saw that you seem to call the engine (chess. ..) in the polling routine. Spider doesn't do that. It puts the input in a global variable. The main thread (the engine) reads this variable when the node count is divisible by 16384 (a power of two) or continuously in an endless loop if it is in a waiting state.
Works fine, except with pondering on in win XP, for some reason.
And perhaps there is only a problem in winboard, not in other gui's (not sure about that yet).
I would like to try your method (direct calls in the polling routine, at least that is what I understood from your code) just to see if it avoids this XP problem.
But that would require a major restructuring of my program, not only the winboard part. Not really doable. ;)
Nice website, by the way.:)
Martin
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Dieter Bürßner » 27 Sep 2004, 20:23

Geschrieben von:/Posted by: Dieter Bürßner at 27 September 2004 21:23:29:
Als Antwort auf:/In reply to: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Martin Giepmans at 27 September 2004 00:25:07:

Perhaps I am totally wrong, but polling input sounds wrong to me for a multithreaded engine with one input thread. Instead of polling, you should just use "blocking" input functions!? When you have read a new line of input, you can notify the other thread. Why should one poll the device when at the start that thread was only created to handle the input? A thread that only polls might use lots of resources - it might call OS services many times per second.
Engines that don't use an extra thread of course will use some polling method. Typically the only poll every couple of thousands of nodes (for example) to not spend too much time for it.
As far as I know, pipes are quite different in Windows 95/98 and Windows NT/2000/XP. Possible that polling the device needs more resources, therefore.

Regards,
Dieter
Dieter Bürßner
 

Re: A problem with my delphi engine in Windows XP

Postby Olivier Deville » 27 Sep 2004, 20:57

Geschrieben von:/Posted by: Olivier Deville at 27 September 2004 21:57:14:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Martin Giepmans at 27 September 2004 19:25:10:
Andrew,
4. Convert to C/C++ .
I'm sure it's not a problem with Delphi - there are plenty of Delphi engines that don't have a problem with XP e.g. Delfi and Monarch 2002
I probably use a somewhat unusual method to connect to winboard.
I have never studied open source code (neither in C nor in Delphi) so many things in Spider are non standard, I guess.
In the code that you posted on CCC I saw that you seem to call the engine (chess. ..) in the polling routine. Spider doesn't do that. It puts the input in a global variable. The main thread (the engine) reads this variable when the node count is divisible by 16384 (a power of two) or continuously in an endless loop if it is in a waiting state.
Works fine, except with pondering on in win XP, for some reason.
And perhaps there is only a problem in winboard, not in other gui's (not sure about that yet).
I would like to try your method (direct calls in the polling routine, at least that is what I understood from your code) just to see if it avoids this XP problem.
But that would require a major restructuring of my program, not only the winboard part. Not really doable. ;)
Nice website, by the way.:)
Martin

Hi Martin
I wanted to run a gauntlet (SpiderChess vs. a bunch of other engines) on my XP machine with the Fritz GUI, but Spider hangs after the first game, and refuses to play the next games.
It seems the problem does not appear in my Win98 machine, the gauntlet is running now.
This should be no problem for ChessWar tournament, since the engines play only one game.
Olivier



ChessWar + AEGT
Olivier Deville
 

Re: A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 27 Sep 2004, 23:43

Geschrieben von:/Posted by: Martin Giepmans at 28 September 2004 00:43:46:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Dieter Bürßner at 27 September 2004 21:23:29:
Perhaps I am totally wrong, but polling input sounds wrong to me for a multithreaded engine with one input thread. Instead of polling, you should just use "blocking" input functions!? When you have read a new line of input, you can notify the other thread. Why should one poll the device when at the start that thread was only created to handle the input? A thread that only polls might use lots of resources - it might call OS services many times per second.
Engines that don't use an extra thread of course will use some polling method. Typically the only poll every couple of thousands of nodes (for example) to not spend too much time for it.
As far as I know, pipes are quite different in Windows 95/98 and Windows NT/2000/XP. Possible that polling the device needs more resources, therefore.

Regards,
Dieter
Perhaps there is a semantic confusion here. I think my input thread is in fact
"blocking".
The winboard version of Spider is not slower than the other version that uses it's own gui (this version is not multithreaded).
Martin
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 27 Sep 2004, 23:58

Geschrieben von:/Posted by: Martin Giepmans at 28 September 2004 00:58:44:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Olivier Deville at 27 September 2004 21:57:14:
Andrew,
4. Convert to C/C++ .
I'm sure it's not a problem with Delphi - there are plenty of Delphi engines that don't have a problem with XP e.g. Delfi and Monarch 2002
I probably use a somewhat unusual method to connect to winboard.
I have never studied open source code (neither in C nor in Delphi) so many things in Spider are non standard, I guess.
In the code that you posted on CCC I saw that you seem to call the engine (chess. ..) in the polling routine. Spider doesn't do that. It puts the input in a global variable. The main thread (the engine) reads this variable when the node count is divisible by 16384 (a power of two) or continuously in an endless loop if it is in a waiting state.
Works fine, except with pondering on in win XP, for some reason.
And perhaps there is only a problem in winboard, not in other gui's (not sure about that yet).
I would like to try your method (direct calls in the polling routine, at least that is what I understood from your code) just to see if it avoids this XP problem.
But that would require a major restructuring of my program, not only the winboard part. Not really doable. ;)
Nice website, by the way.:)
Martin

Hi Martin
I wanted to run a gauntlet (SpiderChess vs. a bunch of other engines) on my XP machine with the Fritz GUI, but Spider hangs after the first game, and refuses to play the next games.
It seems the problem does not appear in my Win98 machine, the gauntlet is running now.
This should be no problem for ChessWar tournament, since the engines play only one game.
Olivier
Oh boy, yet another XP problem ...
Never saw this under win ME.
Sorry, no idea what the cause is.
I think I will have to buy XP and install it on my machine, otherwise it's nearly impossible to figure out what's going on.
Would you be so kind to send me the pgn of the gauntlet on your win98 machine (if you have one) when it is finished?
Martin
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Martin Giepmans » 28 Sep 2004, 00:08

Geschrieben von:/Posted by: Martin Giepmans at 28 September 2004 01:08:13:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Andrew Fan at 27 September 2004 13:52:15:
Hi Martin,
In XP, if two or more processes/threads has the same priority, they should get the same amount of time to run before being context switched. Could it be that your pondering thread is at a higher than normal priority?
I assume, of course, you are using multi-threaded code.
Non-polling delay can be a call to the OS' Sleep() function, which will cause a context switch. Peeking at the I/O channels for available input is polling, which uses CPU time, unless the peek can be blocked.
Not sure if Sleep() is called Sleep() in Delphi, haven't used Delphi for many many years.
Delphi is fine, I am just kidding.
Andrew.
Not sure if the followings will help but you are welcome to try/test:
1. Run winboard under Win95/98 mode compatible mode in XP.
2. Change the process scheduling methods to "Background services" mode
3. Add non-polling delays in your engine when pondering.
4. Convert to C/C++ .
Good luck.
Andrew.
4 is maybe the best solution, lol.
I'm not sure what you mean in 3. Could you eleborate?
Martin
Thank you for your explanation Andrew. I don't have XP on my machine, so I've send a version with sleep() in it (yes, it is also called sleep in Delphi) to Guenther for a test. The result is negative, still the same problem.
I need aspirin .. ;)
Martin
Martin Giepmans
 

Re: A problem with my delphi engine in Windows XP

Postby Olivier Deville » 28 Sep 2004, 04:09

Geschrieben von:/Posted by: Olivier Deville at 28 September 2004 05:09:14:
Als Antwort auf:/In reply to: Re: A problem with my delphi engine in Windows XP geschrieben von:/posted by: Martin Giepmans at 28 September 2004 00:58:44:
Andrew,
4. Convert to C/C++ .
I'm sure it's not a problem with Delphi - there are plenty of Delphi engines that don't have a problem with XP e.g. Delfi and Monarch 2002
I probably use a somewhat unusual method to connect to winboard.
I have never studied open source code (neither in C nor in Delphi) so many things in Spider are non standard, I guess.
In the code that you posted on CCC I saw that you seem to call the engine (chess. ..) in the polling routine. Spider doesn't do that. It puts the input in a global variable. The main thread (the engine) reads this variable when the node count is divisible by 16384 (a power of two) or continuously in an endless loop if it is in a waiting state.
Works fine, except with pondering on in win XP, for some reason.
And perhaps there is only a problem in winboard, not in other gui's (not sure about that yet).
I would like to try your method (direct calls in the polling routine, at least that is what I understood from your code) just to see if it avoids this XP problem.
But that would require a major restructuring of my program, not only the winboard part. Not really doable. ;)
Nice website, by the way.:)
Martin

Hi Martin
I wanted to run a gauntlet (SpiderChess vs. a bunch of other engines) on my XP machine with the Fritz GUI, but Spider hangs after the first game, and refuses to play the next games.
It seems the problem does not appear in my Win98 machine, the gauntlet is running now.
This should be no problem for ChessWar tournament, since the engines play only one game.
Olivier
Oh boy, yet another XP problem ...
Never saw this under win ME.
Sorry, no idea what the cause is.
I think I will have to buy XP and install it on my machine, otherwise it's nearly impossible to figure out what's going on.
Would you be so kind to send me the pgn of the gauntlet on your win98 machine (if you have one) when it is finished?
Martin
Gauntlet still running, I got one bluescreen but hopefully all the games will be completed.
You will receive the games of course.
Olivier



ChessWar + AEGT
Olivier Deville
 


Return to Archive (Old Parsimony Forum)

Who is online

Users browsing this forum: No registered users and 74 guests