Perft helpers

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Re: Perft helpers

Post by JuLieN »

Don wrote:The perft software is in place now that I have a server. I am going to do a test run now with perft(12) to verify that everything is working correctly and to make any further adjustments.

So I need volunteers to run clients for me. You will need only the client, a perft binary and configuration file which I will supply.

To start with I need people with Linux 64 bit - but the GUI can quickly be made to work with windows and I will have to compile a perft binary for windows too - but one step at a time. I want to check out the windows client first before I ask for help on the windows side.

So who has 64 bit linux and wants to start running the client? emails me at dailey.don@gmail.com

Don
As soon as you have a Mac Intel build, count me in Don! :)

(I have a four-cores Core i5 Mac.)
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Perft helpers

Post by Don »

JuLieN wrote:
Don wrote:The perft software is in place now that I have a server. I am going to do a test run now with perft(12) to verify that everything is working correctly and to make any further adjustments.

So I need volunteers to run clients for me. You will need only the client, a perft binary and configuration file which I will supply.

To start with I need people with Linux 64 bit - but the GUI can quickly be made to work with windows and I will have to compile a perft binary for windows too - but one step at a time. I want to check out the windows client first before I ask for help on the windows side.

So who has 64 bit linux and wants to start running the client? emails me at dailey.don@gmail.com

Don
As soon as you have a Mac Intel build, count me in Don! :)

(I have a four-cores Core i5 Mac.)
I have 3 perft binaries now, the one I did and 2 very fast ones. None of them are Mac - but I'll see if I can convince the other two contributors to make a mac version. I could make a mac version of mine as I have access to a loaner machine but it's almost a waste of time to run mine when there are 2 much faster versions available.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Perft helpers

Post by Don »

The Perft(12) dry run is now 75% complete and going well.

The web page predicts a completion date of Oct 22, which is tomorrow. That is probably based on a sudden increase in clients, we now have two fast perft binaries and things are running smoother due to some bug fixes.

At peak we had well over 25 results per second coming in. Since the number of root positions are fixed, this would support getting perft(14) in less than a week. I think 60 per second would do it in less than 2 days. So it's just a question of how many clients can "feed" the server - each client doing perft(8) calculations. Of course it will take a lot more clients to keep the server busy since the perft(8) calculations are orders of magnitude more expensive. Unless we can get hundreds of CPU's on this it will still probably take several months.

One of the perft binaries has MP support so 1 client running with MP=4 and a big hash table will outperform 4 separate clients running with 1 core.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Perft helpers

Post by rbarreira »

I'm wondering about some of the technical details:

1- Did you implement the idea mentioned in the other thread, using different hash keys for each run in order to detect computational errors better? And if yes, is each run still reproducible (i.e. do you record the hash keys) in order to be able to detect cheaters?

2- Do you make sure that people can't send work units that weren't assigned to them?

3- Is it an optimized perft client, or something like what Steve was using which spent lots of time calculating non-perft stuff?

If the technical fundamentals of how the project works are sound I'll probably contribute some CPU time.
User avatar
Ajedrecista
Posts: 2098
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Perft helpers.

Post by Ajedrecista »

Hello Don:
Don wrote:The Perft(12) dry run is now 75% complete and going well.

The web page predicts a completion date of Oct 22, which is tomorrow. That is probably based on a sudden increase in clients, we now have two fast perft binaries and things are running smoother due to some bug fixes.

At peak we had well over 25 results per second coming in. Since the number of root positions are fixed, this would support getting perft(14) in less than a week. I think 60 per second would do it in less than 2 days. So it's just a question of how many clients can "feed" the server - each client doing perft(8) calculations. Of course it will take a lot more clients to keep the server busy since the perft(8) calculations are orders of magnitude more expensive. Unless we can get hundreds of CPU's on this it will still probably take several months.

One of the perft binaries has MP support so 1 client running with MP=4 and a big hash table will outperform 4 separate clients running with 1 core.

Don
The perft binary with MP support sounds good... is it made by Paul Byrne? He is always a warrantee regarding perft.

I may help in this project (it is not sure yet), though my contribution will be minimal. Sometimes, I have access to an Intel i5-760 (2.8 GHz, quad core) with Windows XP 32-bit and 4 GB of RAM, so I guess that the biggest size of hast table I can use is 2 GB... is it enough big when you say the following?
Don wrote:One of the perft binaries has MP support so 1 client running with MP=4 and a big hash table will outperform 4 separate clients running with 1 core.
Other question is the calculation time of an average perft(8): I know that they can be too big or too small depending on the position, but more less in average how much time can take a single perft(8) in an Intel i5 using four cores and 2 GB of hash? I think that I usually can not use that i5 more than fifty minutes per session, so actually it is a very modest contribution: surely less than three hours per week!

Any screenshot of the used GUI would be much appreciated. Thank you very much for your efforts! :)

Regards from Spain.

Ajedrecista.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Perft helpers

Post by Don »

rbarreira wrote:I'm wondering about some of the technical details:

1- Did you implement the idea mentioned in the other thread, using different hash keys for each run in order to detect computational errors better? And if yes, is each run still reproducible (i.e. do you record the hash keys) in order to be able to detect cheaters?
That is a perft binary issue, my client uses 128 bit keys so I don't consider it an issue, but I know that Paul's binary changes the zobrist table for every run - so if one run gets a collision the next will probably be correct.

I take a few measures to protect against cheating, but nothing is foolproof, including the best cryptography. I have to strike a balance between practicality and paranoia. Here is what I have done:

Your client cannot post results without a valid password. The passwords are private and only the server and the user have them. Yes, the network could be "sniffed" and keys revealed since the pass in the clear - however if some key is stolen in order to corrupt the results we will notice that one user is producing incorrect results and limit the damage. I can always throw out these results since I track results by user.

I also track results by perft binary. In other words the server knows which user and which binary produced each result. The client actually checksums the client and sends the checksum and the server rejects any result that does not come from an approved client. This can be defeated fairly easily by a good engineer, but it will take a purposeful effort to do so and even if it is I will know which user it is coming from.

In theory nobody would want to invest a huge amount of time to sabotage the results - but stranger things have happened.

The plan is to run the calculation twice, each using different binaries for the perft calculation. Right now I am not doing that for perft(12) and I have not decided whether to do these runs concurrently or not. There is a serious load balancing issue involved too, if everyone want to run the fastest and best perft client there will be no one running the slower verification client or client(s.) So I will either have to throw out results or force people to use a specific client. Imagine having to schedule the same work over and over against until someone happens to run it with a different client and you will see that this is a load balancing issue.

A simple solution is to do the entire calculation once, then partition the result by which perft binary was used. It would be simple to set up multiple servers and the users would be instructed about which client they should NOT use and directed to the appropriate server. For example if there are 6 million gperftd results I would run those 6 million over again and inform the users that they cannot use the gperftd binaries. The server would simply reject result that were sent from those binaries. In fact that is automatic anyway, it's just a configuration issue.

A more clever solution is let the server try to detect which binary each user is using. It knows this, so it could attempt to track this and could be smart enough to send appropriate assignments. But if some users are setting up instances using different binaries then this would be defeated. But even if there were not, we still have the load balancing issue, if one binary is far more popular than another (perhaps) slower one, then at some point we will run out of assignments for this binary and be left with a minority of users running the slower clients but having to do the majority of the calculations - not a good situation.

Since I don't plan to be too obsessive about this and spend a huge amount of time, I will probably do the run once, then partition the 9,000,000 + positions into separate cases and set up multiple servers for verifying with different clients. Each server would reject one particular client but not the others. That is simple and effective.

During this verification pass we would be getting statistics on how often any particular perft "went wrong" and if there were any problem users - we would probably find that out very quickly.

There is little motivation for someone to cheat since they will get flagged anyway, they would not be slowing down legitimate users at all, they would be just wasting their own time and their own CPU time. The worse case is that for every bogus record they insert we would have to do 2 additional searches. I cannot imagine anyone investing a lot of time and CPU resources and their own electric bill (money) just to slow down our calculation.

The most malicious thing that could happen is that someone uses a binary that is returning the wrong results and can use the same binary for additional calculations while pretending it's a different binary. Then a real error could slip in, but even in this case we would almost surely see that errors were coming from a single user. In such a case I would flag that user and throw out all his results. It's not likely that this would be a very big percentage of the results.

By the way, for each binary there are 2 platforms, Linux and Windows. I have identified the specific binary and also a "family" because if there is a bug for any given authors binary, it's more than likely in both platforms - and even if it isn't we have the means to analyze it. (It could turn out that only the Windows, or only the Linux version has the bug too.)

2- Do you make sure that people can't send work units that weren't assigned to them?
No. The model I use is that the server is just organizing the work. If someone wants to send me a million results that is ok with me. They will still be checked and verified and they will be ignored if they are not one of the legitimate positions. The server is robust with respect to multiple records and such. In fact after a server stop and restart it's likely that some results were assigned twice - the server doesn't care and it does not affect the calculation. In fact the server (or the off-line process that is) already checks these records to make sure the node counts match.

3- Is it an optimized perft client, or something like what Steve was using which spent lots of time calculating non-perft stuff?
i don't know much about Steve's perft binary.

If the technical fundamentals of how the project works are sound I'll probably contribute some CPU time.
The real test is when someone ELSE, independent of us, does a perft(14) and either comes up with the same numbers or different ones. If they are different then it doesn't mean ours are wrong. It just means one of us is wrong!

Right now I am praying that the perft(12) comes out right the first time. We will probably know within 2 or 3 days.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Perft helpers

Post by rbarreira »

Don wrote: No. The model I use is that the server is just organizing the work. If someone wants to send me a million results that is ok with me. They will still be checked and verified and they will be ignored if they are not one of the legitimate positions. The server is robust with respect to multiple records and such. In fact after a server stop and restart it's likely that some results were assigned twice - the server doesn't care and it does not affect the calculation. In fact the server (or the off-line process that is) already checks these records to make sure the node counts match.
Don, thanks for your detailed reply. I'll re-read it again later, for now just a small follow-up question on this:

Imagine two different users send a result for some work unit and they agree on the perft result for that work unit, even though the server did not assign this work unit to either user (or just to one of them). Will the server still assign this work unit to other clients, or will it assume that all is fine since it has two matching results for that work unit?
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Perft helpers.

Post by Don »

Here is a screenshot as you requested. It is a calculation in progress, you will notice some moves have not been filled in yet. Most of them finish in 2 or 3 seconds and it loads up another and continues.

With perft(8) it will take much longer of course.

Image

With perft(8) it will take much longer of course but you should still see a move appear with nodes counts every several seconds. I will do a timing later when I get a chance to get a feeling for how long this will take on average - but it will vary a lot.


Ajedrecista wrote:Hello Don:
Don wrote:The Perft(12) dry run is now 75% complete and going well.

The web page predicts a completion date of Oct 22, which is tomorrow. That is probably based on a sudden increase in clients, we now have two fast perft binaries and things are running smoother due to some bug fixes.

At peak we had well over 25 results per second coming in. Since the number of root positions are fixed, this would support getting perft(14) in less than a week. I think 60 per second would do it in less than 2 days. So it's just a question of how many clients can "feed" the server - each client doing perft(8) calculations. Of course it will take a lot more clients to keep the server busy since the perft(8) calculations are orders of magnitude more expensive. Unless we can get hundreds of CPU's on this it will still probably take several months.

One of the perft binaries has MP support so 1 client running with MP=4 and a big hash table will outperform 4 separate clients running with 1 core.

Don
The perft binary with MP support sounds good... is it made by Paul Byrne? He is always a warrantee regarding perft.

I may help in this project (it is not sure yet), though my contribution will be minimal. Sometimes, I have access to an Intel i5-760 (2.8 GHz, quad core) with Windows XP 32-bit and 4 GB of RAM, so I guess that the biggest size of hast table I can use is 2 GB... is it enough big when you say the following?
Don wrote:One of the perft binaries has MP support so 1 client running with MP=4 and a big hash table will outperform 4 separate clients running with 1 core.
Other question is the calculation time of an average perft(8): I know that they can be too big or too small depending on the position, but more less in average how much time can take a single perft(8) in an Intel i5 using four cores and 2 GB of hash? I think that I usually can not use that i5 more than fifty minutes per session, so actually it is a very modest contribution: surely less than three hours per week!

Any screenshot of the used GUI would be much appreciated. Thank you very much for your efforts! :)

Regards from Spain.

Ajedrecista.
Image
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Perft helpers

Post by Don »

rbarreira wrote:
Don wrote: No. The model I use is that the server is just organizing the work. If someone wants to send me a million results that is ok with me. They will still be checked and verified and they will be ignored if they are not one of the legitimate positions. The server is robust with respect to multiple records and such. In fact after a server stop and restart it's likely that some results were assigned twice - the server doesn't care and it does not affect the calculation. In fact the server (or the off-line process that is) already checks these records to make sure the node counts match.
Don, thanks for your detailed reply. I'll re-read it again later, for now just a small follow-up question on this:

Imagine two different users send a result for some work unit and they agree on the perft result for that work unit, even though the server did not assign this work unit to either user (or just to one of them). Will the server still assign this work unit to other clients, or will it assume that all is fine since it has two matching results for that work unit?
I have not fully settled on a policy, but right now my plan was to require the results come from separate binary families, not necessarily different users. . But the data is available for this. If we notice that some user is wrong more than others, we could easily check all the records of this user where there is not verification by other users and simply rerun them - only allowing other users to verify.

The funny thing is that I originally envisioned this as a perft calculation where the important thing was verification for technical reasons (hash collisions, bug, etc) but not to verify people. But I have put more effort into that than the calculation!
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: Perft helpers

Post by rbarreira »

Don wrote:
rbarreira wrote:
Don wrote: No. The model I use is that the server is just organizing the work. If someone wants to send me a million results that is ok with me. They will still be checked and verified and they will be ignored if they are not one of the legitimate positions. The server is robust with respect to multiple records and such. In fact after a server stop and restart it's likely that some results were assigned twice - the server doesn't care and it does not affect the calculation. In fact the server (or the off-line process that is) already checks these records to make sure the node counts match.
Don, thanks for your detailed reply. I'll re-read it again later, for now just a small follow-up question on this:

Imagine two different users send a result for some work unit and they agree on the perft result for that work unit, even though the server did not assign this work unit to either user (or just to one of them). Will the server still assign this work unit to other clients, or will it assume that all is fine since it has two matching results for that work unit?
I have not fully settled on a policy, but right now my plan was to require the results come from separate binary families, not necessarily different users. . But the data is available for this. If we notice that some user is wrong more than others, we could easily check all the records of this user where there is not verification by other users and simply rerun them - only allowing other users to verify.

The funny thing is that I originally envisioned this as a perft calculation where the important thing was verification for technical reasons (hash collisions, bug, etc) but not to verify people. But I have put more effort into that than the calculation!
The problem that I'm thinking of is two users who are in fact the same person sending matching results for a work unit they did not calculate at all. This is the easiest cheat I can think of, if it's possible then it's really easy to be malicious.