-
Notifications
You must be signed in to change notification settings - Fork 325
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
Moco examples causing segmentation fault on M1 Mac #3168
Comments
Hi @DanielFNG, we are also encountering this issue with the new Macs. We don't have a solution yet, but we can update our progress here. |
Failures are all related to
casadi: in casadi file ipopt_interface.cpp L415
Still need to dig in further. Perhaps first thing I'll check is if the build instructions for OpenSim would default to x64 or arm64. Given that others are using the pre-built artifacts just fine, x64 through Rosetta is likely working, but maybe something here is building arm64 and ipopt doesn't like that. |
It seems like this might be an IPOPT problem. After a quick Google, I haven't found anyone with a similar issue though. |
Yes, whoops, should have made that clearer that this is NOT a casadi/troper problem but rather an IPOPT problem. I did find that default settings for our build instructions do create It seems like at least updated IPOPT packages will work natively with arm given that they're available on brew: https://formulae.brew.sh/formula/ipopt Do you update IPOPT versions all that much? |
No, we don't. In fact, for Windows, we use pre-built binaries that Chris hosts because no one else hosts them and building from source is a pain. |
Can we give error/warning early on rather than give users the false impression that this is working @carmichaelong ? |
It's a good question... unfortunately still investigating workarounds/fixes. Even if you check for architecture, |
Some promising signs for a workaround. This leads to no segfaults during run time, but some tests fail (some very narrowly). On a high level: 1. install metis using brew, 2. install IPOPT using coinbrew (which also installs MUMPS), 3. change the dependencies CMake to use IPOPT install folder from coinbrew Building dependencies
OpenSim Moco test errorsBuilding OpenSim and Moco should be the same at this point. Overall test errors as follows:
More details below. Mostly tropter failures, one casadi failure. @nickbianco would be interested in your thoughts on some of these test errors. test_generic_optimization
test_double_pendulum
testMocoInterface
testMocoTrack
|
Great progress @carmichaelong! Here are my thoughts: The The check on The
|
Thanks @nickbianco for the insight. I tried some quick things to debug a little, but unfortunately no fix from those. A quick(ish) summary:
Still some open questions with IPOPT/MUMPS versioning.
Possible next steps:
|
Turns out both IPOPT (3.13 vs 3.14) and MUMPS (4.10.0 vs 5.4.1) versioning explains the differences in tests. I built various combinations of these (see end of this post for some setup notes). Note that we currently use an even older version of IPOPT (3.12.8) that uses MUMPS 4.10.0. A big change between IPOPT 3.12 and 3.13 is that IPOPT no longer builds the dependencies MUMPS and Metis directly (i.e., does a monolithic build), so this is something to consider if we want to upgrade IPOPT. I'm using 3.13 here since it's easier to mix and match different versions without the monolithic build. Test resultstl;dr MUMPS 5.4.1 makes 2 of the tests fail, IPOPT 3.14 makes the other 2 fail. IPOPT 3.13 and MUMPS 4.10.0 passes all tests. IPOPT 3.13 (tag
IPOPT 3.13, MUMPS 5.4.1 (tag
IPOPT 3.14 (tag
Rough steps for building dependencies:
|
IPOPT 3.12.8 with pre-built MUMPS 4.10.0 can work too (this could let us avoid bumping IPOPT version to 3.13). Two important steps:
@aymanhab @nickbianco Could be good to discuss in a meeting what the right scope for fixing the dependencies setup could be for IPOPT. |
@DanielFNG Would you be able to test if the branch with some fixes for an ARM Mac build work for you? So far this should work for the C++ build (i.e,. hasn't been tested Java/Python wrapping). You can see some discussion about it in #3192, and some amended terminal instructions below.
|
Hello, apologies for the delay. I am having issues installing IPOPT in particular on this branch, with the following:
At one point I manually installed libcoinhsl in x86 mode to test different IPOPT linear solvers (ma57, ma97 etc) and I think this may be conflicting somehow (previously I was getting an error that it was trying to compile for arm64 but the libcoinhsl library was x86 - now it doesn't seem to install it correctly). I have tried clearing out the old libraries and rerunning all of these steps but no luck. I will update if I can later fix this on my machine. |
@DanielFNG Thanks for the feedback, sorry to hear libcoinhsl may be conflicting. A couple of ideas to work around:
|
Hello, I was unable to get this working with the HSL libraries. I couldn't get to the bottom of whether my own previous installation was conflicting or if OpenSim tries to install it as a dependency but it wasn't working for some reason? However, adding the options you specify above to the CMakeLists.txt file did skip the HSL step and the rest of the build and test worked as normal. All tests passed with this installation for me. However, I do then get an error when trying to run the final installation step:
The only files I have in the directory mentioned above are: On my machine, I end up with some libcoinmumps.dylib files in the dependencies install directory (under the 'mumps' folder) but none matching the exact filename listed above. To get around this I modified the cmake_install.cmake file in the build directory to exclude the reference to Tropter and everything else was able to install okay, and now when I run Moco executables they show as being 'Apple' format in Activity Monitor. I'm getting significantly better performance when running things natively so definitely think this is a worthwhile step for M1 users: (Image above generated from 5 Moco simulations using different sets of weights) |
I recently followed the install from source instruction on an M1 Mac so I could use a later version of the system Python when scripting. However, I've found that the Moco C++ examples are now no longer working. They seem to cause a segmentation fault at some point during the study.solve() call e.g:
It's not a general environment issue, because the plain OpenSim C++ examples compile and run just fine i.e in the simple optimization example:
I'm just wondering if there's any known issues when compiling from source on ARM or if there are any special steps to take in the compilation process. Is it recommended to compile for x86 in the meantime? Cheers!
The text was updated successfully, but these errors were encountered: