b-inary / desktop-postflop

[Development suspended] Advanced open-source Texas Hold'em GTO solver with optimized performance
GNU Affero General Public License v3.0
234 stars 59 forks source link

cross platform support #1

Closed guilipan closed 1 year ago

guilipan commented 2 years ago

I noticed that this project is using tauri,so it's possible to support macos? ^_^

b-inary commented 2 years ago

The Tauri framework supports macOS, but some issues need to be resolved to support macOS.

  1. The biggest problem is that I do not have a macOS machine: I cannot check if the distributed binary is working as expected.
  2. The current implementation relies on IndexedDB to store ranges and configurations: a friend of mine reported that IndexedDB, which works on Safari, does not seem to work on Tauri on macOS.
  3. It is difficult to distribute a binary for aarch64 architecture (M1/M2 Mac): the friend also reported that the cross-compiled build for aarch64 by GitHub Actions is shown as "damaged" and cannot be executed.

For these reasons, we currently distribute only Windows builds. However, we would be happy if we could distribute a build for macOS as well, so any contributions are welcome.

ivp5 commented 1 year ago

rust nightly on a mac with m1 builds a perfectly executable binary

ivp5 commented 1 year ago

Test with 10 threads on 3betFast config to 0.1% threshold runs in ~14 seconds (15 with compression).

guilipan commented 1 year ago

well done buddy

b-inary commented 1 year ago

Sorry for the late response.

rust nightly on a mac with m1 builds a perfectly executable binary

Thanks for your report! That's good news. I'm eagerly awaiting the GitHub-hosted M1 Mac runner to be offered, but it seems to be in the "future" category on the roadmap (the timing of provision is not fixed).

Test with 10 threads on 3betFast config to 0.1% threshold runs in ~14 seconds

That's very fast. My 16-thread Ryzen 7 3700X takes ~29 seconds, and my 32-thread Ryzen 9 5950X takes ~22 seconds without compression. I guess I should buy a new MacBook....

b-inary commented 1 year ago

I decided not to distribute binaries for macOS because I am not enrolled in the Apple Developer Program and cannot sign the app. Apparently, on M1/M2 Macs, we cannot launch unsigned apps straightforwardly.

That said, I have confirmed that I can build and run the app as expected on macOS as well. If you want to use the app on macOS, please build it yourself.

(Performance notes) 3betpotFAST, no all-in replacements, 32-bit FP mode, 0.1% exploitability

tnfru commented 1 year ago

Great Repo! I see the problem with releasing on apple, but what about Linux? Any plans on that? I would be willing to run tests on Pop-OS (very similar to Ubuntu).

b-inary commented 1 year ago

I don't also own a Linux machine, but on my WSL2 Kali Linux (a Debian-based distribution) environment, I confirmed that the app seems to work as expected (although the fonts might need some adjustment). If there is a demand, I will try to distribute the Linux bundle (.deb and AppImage) from the next version.

Edit: The current source code does not support Linux because src-tauri/src/main.rs does not have the os_name macro. If you want to build now, please add the following code to src-tauri/src/main.rs for workaround.

#[cfg(target_os = "linux")]
#[tauri::command]
fn os_name() -> String {
    "windows".to_string()  // not typo
}
b-inary commented 1 year ago

Now Linux builds are distributed. I have performed minimal testing, but if you don't mind, please let me know if you could use the app.

If there are no problems with the Linux builds, I would like to close this issue.

tnfru commented 1 year ago

Thank you for the great release. Works out of the box for me!

tnfru commented 1 year ago

Very impressive solver!

Discovered two things that don't work for me, not sure if this is Linux related or a different issue.

  1. When entering 4 cards as Board I can not select a River card [1]. I can see select betting / raising but I don't get strategy / EV values for the possible hands. Do I misunderstand the GUI or is this OS related?
  2. Groups for saved ranges don't seem to work - I can not add ranges to a group.

[1] image

My System Information btw:

OS: Pop!_OS 22.04 LTS x86_64 Kernel: 6.0.12-76060006-generic CPU: 11th Gen Intel i7-1165G7 (8) @ 2.800GHz GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 24GB Ram

b-inary commented 1 year ago

Thanks for your report! 1. was a stupid bug and has been fixed in v0.2.2. 2. is probably a matter of usage (I know the UI is not good but I'm putting it off).

  1. First add a group.
  2. Select the group by clicking on it.
  3. Enter a range and "Save".
tnfru commented 1 year ago

The UI is great. The solver looks really good and everything is intuitive. I really love the project. Thank you for solving every request so nicely and fast.

I have two more questions:

  1. So a range can not be moved to a group only when I create it, not afterwards?
  2. Where are the saved ranges? The new binary loads it but I can't seem to find it.

cheers!

b-inary commented 1 year ago

Thank you for the compliment!

  1. Currently, moving ranges to another group is not supported. I plan to implement drag-and-drop operation in the future, but I cannot guarantee when it will be.
  2. The web and desktop versions use the same system called IndexedDB (of course the domain is different). So, the data is not available explicitly. In my environment, the data seems to be located in /home/<username>/.local/share/b-inary.desktop-postflop directory.
tnfru commented 1 year ago

Thanks for the answers.

One last question, If I may. Are there any plans to make GPU support some time in the future? As far as I understand it rust isn't perfectly supportive of GPUs yet, but would you say there is large amounts of parallel computing which could benefit from a GPU?

Insane how your projects don't have more stars.

b-inary commented 1 year ago

In my Ryzen 7 3700X environment, the following evaluate method consumes about 70% of the execution time.

https://github.com/b-inary/postflop-solver/blob/8eefab68e5e9b839504ceac9aa7f2d136f656889/src/game.rs#L177-L183

To my knowledge, we cannot expect GPUs to improve performance because this method itself is neither suitable for parallelization nor GPU processing (for example, it requires a sequential process for showdown). Therefore, we are currently adopting an approach to perform independent evaluations in parallel. So, at present, the answer is no.

Edit: I recall having read a paper that claims to have accelerated the evaluation with GPUs. However, I have no idea how to do it at present. https://arxiv.org/abs/2007.10442

We are a bit off-topic, so I would like to close this issue. Please submit a new issue if you want to continue the conversation. The status of support for each platform is as follows:

vesper8 commented 1 year ago

@b-inary I have a Mac and am happy to hear from you that it seems relatively simple to build the app yourself and it works well once you do. Would it be possible for you to share some very simple instructions of the steps needed to build the app yourself?

I imagine.. clone the repo, open it in Xcode.. select some options and press build. I have Xcode but I've never done anything like this.. a few simple steps added here, or the Readme ideally, would go a long way to make sure your Mac users can enjoy the fruits of your efforts, until a point in the future you may decide to to distribute a Mac binary.

@ivp5 pinging you as well as I think you managed to build it and get it working on Mac judging from your comment above, so if you could share how you did that it would be very helpful indeed!

Many thanks!!

b-inary commented 1 year ago

First, you need to install Rust and Node.js on your machine. You will also need to add the Rust nightly channel and make it the default:

$ rustup install nightly
$ rustup default nightly

Then, clone the repository and run the following commands in that directory:

$ npm install
$ npm run tauri build

That's it! You can find the application in the src-tauri/target/release/bundle/macos/ directory. Please feel free to comment if you have any problems.

vesper8 commented 1 year ago

Got it working! I already had Rust installed and I guess it was causing a conflict.

I removed the old Rust by doing

brew remove rust

rm -rf ~/.cargo

Then I reinstalled rust from scratch and ran the above steps again and this time it worked :)