Poker-AI.org http://poker-ai.org/phpbb/ |
|
What is currently the fastest hand evaluator in C/C++? http://poker-ai.org/phpbb/viewtopic.php?f=24&t=3049 |
Page 1 of 1 |
Author: | mediacalc [ Sat May 27, 2017 2:50 pm ] |
Post subject: | What is currently the fastest hand evaluator in C/C++? |
I searched the forum and surprisingly this question hasn't been asked yet. I've read through the pandora's box that's in the archive and impressive speeds were achieved. I've seen this too https://github.com/ashelly/PET but tried one of them (SpecialK) and could not reproduce anything close to the speed shown on a comparable system through Python ctypes (0.1MH/S achieved vs the 24MH/s shown). I tried Python directly using lookups on the 126MB "HandRanks.dat" table but could only achieve ~0.12MH/S. So the question is: In C or C++, what is the fastest hand evaluator for 5 or 7 (or even 6) cards that does not rely on a large lookup table? (Large being defined as anything >10MB) Side note: The library would probably be wrapped for Python use for machine learning so technically C or C++ isn't a great requirement although I am more familiar with those languages. Thank you |
Author: | spears [ Sat May 27, 2017 6:15 pm ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
Sorry, don't know the answer to your question, but I am suspicious of the results presented at https://github.com/ashelly/PET . I've just tested my java version of the twoplustwo evaluator and get 136 Mh/s vs his 21 Mh/s, on roughly comparable machines Quote: I tried Python directly using lookups on the 126MB "HandRanks.dat" table but could only achieve ~0.12MH/S. My evaluator does this too, so it looks like your performance problem is something to do with Python |
Author: | mediacalc [ Sat May 27, 2017 11:20 pm ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
spears wrote: Sorry, don't know the answer to your question, but I am suspicious of the results presented at https://github.com/ashelly/PET . I've just tested my java version of the twoplustwo evaluator and get 136 Mh/s vs his 21 Mh/s, on roughly comparable machines Quote: I tried Python directly using lookups on the 126MB "HandRanks.dat" table but could only achieve ~0.12MH/S. My evaluator does this too, so it looks like your performance problem is something to do with Python Yeah the results aren't ideal but they're the only one of its kind I found. Do you know of any other poker evaluator test comparisons? Second, I'm surprised by your speeds in relation to mine. Python's performance isn't great in general but I would have thought for a simple case like this it wouldn't be off by a few factors. A few things to note are that my speed were with "random" lookups with a comparison. So I was pitting AsTs vs 3s3c (what should be close to a perfect flip) on a random 5-card board. I was doing one initial lookup of the board, then using the integer returned to do two additional lookups for hero and villain each. Also, something I read on StackOverflow with regards to the 2p2 LUT: "The [2p2 LUT] algorithm has very poor locality of reference, execution time is going to be dominated by the speed of the memory bus since the array is too large to fit in the cache.". So there might be other factors at play here? (My CPU is a Core i3 4350, what's yours?) I'll try some other evaluators out in the meantime, (this one looks promising for now https://github.com/zekyll/OMPEval - also has an included comparison) |
Author: | nefton [ Sun May 28, 2017 2:31 am ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
viewtopic.php?f=24&t=2390&start=20#p7205 |
Author: | spears [ Sun May 28, 2017 8:43 am ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
I assume you have found these java comparisons: Enumeration http://www.poker-ai.org/archive/www.pok ... &sk=t&sd=a Random http://www.poker-ai.org/archive/www.pok ... 913#p28913 and the wayback machine http://web.archive.org/web/201001052021 ... -poker-bot I think the evaluation methodology of the random test is flawed and shows the twoplustwo based evaluators in an unreasonably poor light. You can do monte carlo simulation without reseting the state in the LUT, so I would expect to get results much closer to the enumeration results My cpu = Q8200 @2.33GHz and the test was an enumeration of hand ranks. Because this is so simple, once you start doing something useful like finding the chance of a hand winning the speed drops dramatically, but that is true of all the evaluators. I don't know much about Python but guess it's an order of magnitude slower than C. Maybe calls from Python to C are slow. If I was after a small memory C++ evaluator I'd take a look at poker stove. Why do you need a small LUT? |
Author: | mediacalc [ Sun May 28, 2017 11:45 am ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
nefton wrote: http://poker-ai.org/phpbb/viewtopic.php?f=24&t=2390&start=20#p7205 Speed? spears wrote: I assume you have found these java comparisons: ... I think the evaluation methodology of the random test is flawed and shows the twoplustwo based evaluators in an unreasonably poor light. You can do monte carlo simulation without reseting the state in the LUT, so I would expect to get results much closer to the enumeration results My cpu = Q8200 @2.33GHz and the test was an enumeration of hand ranks. Because this is so simple, once you start doing something useful like finding the chance of a hand winning the speed drops dramatically, but that is true of all the evaluators. I don't know much about Python but guess it's an order of magnitude slower than C. Maybe calls from Python to C are slow. If I was after a small memory C++ evaluator I'd take a look at poker stove. Why do you need a small LUT? What do you mean by resetting the state of the LUT? You mean reloading the table each iteration? Yes, so I can confirm it's not related to my CPU. You're likely right that it's a problem with Python and I'll have to fiddle with it to see how fast I can get it to go. I don't really need a small LUT at this time but one of the reasons for a fast hand evaluator is for use in machine learning. So I thought if I were ever to stick it on a server for computing power, the memory/disk usage should be as low as possible. |
Author: | spears [ Sun May 28, 2017 3:14 pm ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
Quote: What do you mean by resetting the state of the LUT? To "navigate" the LUT you start with an empty hand. Then you find a state corresponding to a single card, then the state corresponding to two cards, etc until you find the state corresponding to seven cards whereupon you can find the hand rank. But suppose you are on the flop and you have hero and villains hole cards. Then you find the state for the flop and hole cards just once. If you are just finding the hand rank of random 7 card hands you have to start from no cards, aka "reset the state" |
Author: | nefton [ Sun May 28, 2017 3:22 pm ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
3 Mh/s |
Author: | mediacalc [ Sun May 28, 2017 6:01 pm ] |
Post subject: | Re: What is currently the fastest hand evaluator in C/C++? |
spears wrote: Quote: What do you mean by resetting the state of the LUT? To "navigate" the LUT you start with an empty hand. Then you find a state corresponding to a single card, then the state corresponding to two cards, etc until you find the state corresponding to seven cards whereupon you can find the hand rank. But suppose you are on the flop and you have hero and villains hole cards. Then you find the state for the flop and hole cards just once. If you are just finding the hand rank of random 7 card hands you have to start from no cards, aka "reset the state" I see, I didn't know that was the methodology |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |