Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing BEN on a Mac with M1 #60

Closed
ThorvaldAagaard opened this issue Aug 27, 2023 · 24 comments
Closed

Installing BEN on a Mac with M1 #60

ThorvaldAagaard opened this issue Aug 27, 2023 · 24 comments

Comments

@ThorvaldAagaard
Copy link
Collaborator

I have download the repository and installed all prereq's

When I start game.py all goes well until we get to using the double dummy solver, when I get the error libddds.so file not found - or more specific it finds it but report (not a mach-o file)

I assume it is because the libdds.so distributed here is the old x86-architecture

@ThorvaldAagaard
Copy link
Collaborator Author

I have compiled a version of libdds.so for M1, but without the boost libraries.

I will add the file to this repository

@ZiggerZZ
Copy link
Contributor

@ThorvaldAagaard I have a Mac with M2 and I have compiled libddds.so with the boost libraries. I can share the instructions if you want. I could open a PR to dds but it seems that they are not checking GitHub anymore.

@ThorvaldAagaard
Copy link
Collaborator Author

I think you should make a PR for DDS. I will follow up with the authors. I can see they have 10 PR's, so you are probably right they don't check GitHub

Can you add libdds.so for M2 to this site and make the platform change in dds.py - my platform is reported as darwin

@ZiggerZZ
Copy link
Contributor

How do you want to handle Windows, Linux and Mac?
Also, I don't know if my compiled libdds.so works on your machine.

@ZiggerZZ
Copy link
Contributor

I opened a PR #126 in dds repo. There are the instructions.

@ThorvaldAagaard
Copy link
Collaborator Author

If you look in dds.py you can see how Lorand implemented the first version, and fell free to make a better solution.

ddsis not providing any compiled modules, and looking at the repository endplay I can see they just included the dll

BEN is using the solution from https://github.com/Afwas/python-dds and a good platform solution could also be useful there.

I have no strong feelings about how it should be implemented

@ZiggerZZ
Copy link
Contributor

I'm using my compiled for Mac M2 libdds.so with python-dds too.
I've attached it here, you can try to see if it works on your machine.
libdds.so.zip

@ThorvaldAagaard
Copy link
Collaborator Author

I get an error message:
libdds.so' not valid for use in process: library load disallowed by system policy
and something about Apple not being able to check the file.

Googleing it it seems the file should be signed when from another source.

@ZiggerZZ
Copy link
Contributor

You can try to disable Apple checking or recompile it following the instructions in dds-bridge/dds#126.

I googled to see if I can change/sign libdds.so but I didn't find anything meaningful quickly.

@ThorvaldAagaard
Copy link
Collaborator Author

ThorvaldAagaard commented Aug 28, 2023

Googling a bit I found that just opening the file in Xcode would remove the protection attributes, so now it is almost being loaded as I hit the next error

/usr/lib/libboost_system.dylib' (no such file, not in dyld cache)

Is this something I should have installed or should it be included in the distribution?

https://support.apple.com/en-gb/guide/mac-help/mchleab3a043/mac

@ZiggerZZ
Copy link
Contributor

Can't tell you, I installed it with homebrew and then compiled.

@ThorvaldAagaard
Copy link
Collaborator Author

I can see in your PR you installed a few components but did not mention which. Seems to be the right way to go. Will you give me the module names?

@drk1806
Copy link

drk1806 commented Aug 28, 2023

So far I am in a similar situation as you Thorvald. I am using Apple Mac M1. I overrode the security exception but now getting this.

Referenced from: <4B11801E-B761-3627-9049-FC4C382AD230> /Users/jay/miniconda3/envs/ben-main/bin/libdds.so
Reason: tried: '/opt/homebrew/opt/boost/lib/libboost_system.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/boost/lib/libboost_system.dylib' (no such file), '/opt/homebrew/opt/boost/lib/libboost_system.dylib' (no such file), '/usr/local/lib/libboost_system.dylib' (no such file), '/usr/lib/libboost_system.dylib' (no such file, not in dyld cache)

@ThorvaldAagaard
Copy link
Collaborator Author

Try
brew install boost

@drk1806
Copy link

drk1806 commented Aug 28, 2023

Thanks. Had to do this,
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

and then
brew install boost.

Ben is working on my Apple Mac mini M1

@ThorvaldAagaard
Copy link
Collaborator Author

ThorvaldAagaard commented Aug 28, 2023

Great, now we just have to figure out, where to place that in the documentation. Perhaps Zigfrid will make a guide for Mac?

@drk1806
Copy link

drk1806 commented Aug 28, 2023

I am also eagaerly awaiting for the new UI you have been working on Thorvald. Images on cards would be greatly appreciated. Any update on that build?

@ZiggerZZ
Copy link
Contributor

What did you do? Just installed boost with brew and then used libdds.so that I attached earlier in this issue?

@drk1806
Copy link

drk1806 commented Aug 28, 2023

Yes, used your libdds.so and used the above 2 commands I mentioned. I then restarted gameserver.py.

@ThorvaldAagaard
Copy link
Collaborator Author

Yes, that was all I did, besides to open libdds.so in xcode to remove the protection

@ZiggerZZ
Copy link
Contributor

I'll open a PR with added instructions in Readme and modified dds.py.

@ThorvaldAagaard
Copy link
Collaborator Author

@drk1806 I am not working on a new UI, but more focusing on improving BEN's bidding an play.

@ZiggerZZ
Copy link
Contributor

opened PR #62
I kept darwin directory for storing libdss.so on Mac.

@drk1806 I'm working on a bridge UI and AI in a separate project. I'm keen on comparing ben with my AI once I finish the development!

@ThorvaldAagaard is ben's card play based purely on dds simulations, i.e. sampling 200 full states compatible with visible cards and history and picking the best action on average? Or there is some neural networks learning for card play as well?

@ThorvaldAagaard
Copy link
Collaborator Author

I haven't dived deep into the play yet, but BEN is using 8 neural network in total.

One for bidding, and one for bidding info. The last six are for playing.

BEN is sampling 4096 boards, and then filtering based on bidding, leads, actual card play and information from the neural networks. Then up to 100 boards are calculated with DDS. Perhaps Lorand can find time to a better description :-)

DDS is also used during bidding, when the neural network has no clear bid to make, and I am working to change the threshold based on the actual bidding, so we besides the nn also has some logic based on what we know from the bidding.

Closing with this comment as the PR from Zigfrid has solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants