BYU-PRISM / GEKKO

GEKKO Python for Machine Learning and Dynamic Optimization
https://machinelearning.byu.edu
Other
594 stars 104 forks source link

gekko on apple arm m1 #109

Closed bjrnfrdnnd closed 3 years ago

bjrnfrdnnd commented 3 years ago

Hi,

When trying to use Gekko in off-line mode on a new MacBook Pro, I get the error:

Error: dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib Referenced from: /opt/homebrew/Caskroom/miniforge/base/envs/bondora_webhook/lib/python3.8/site-packages/gekko/bin/apm_mac Reason: image not found

Apparently, app_mac tries to find libquadmath.0.dylib in /usr/lib which is not there.

I used brew install gcc which installed gcc 10, including libraries into /opt/homebrew/lib/gcc/10. In that location, there is no libquadmath.0.dylib.

So seemingly, there or at least three problems: There is no GCC 9 There is no libquadmath in GCC 10 Stuff is installed in /opt/homebrew and not in /usr/lib

I found several references targeting that issue, but no solution. Apparently, there might be a problem with GCC not yet fully compatible with ARM (https://www.gitmemory.com/issue/BYU-PRISM/GEKKO/102/757256706) There is an experimental version of GCC for ARM on http://hpc.sourceforge.net, but there is no libquadmath. Apparently, I am not the only one having that problem: https://stackoverflow.com/questions/65641834/dyld-library-not-loaded-usr-local-opt-gcc-lib-gcc-9-libquadmath-0-dylib, https://stackoverflow.com/questions/66852721/problem-with-gfortran-unable-to-obtain-libquadmath-for-mac-big-sur)

There are two workarounds suggested: a) use remote=False -> not practical for me, as I have to solve thousands of little problems b) use a local apmonitor server: I followed the instructions on https://apmonitor.com/wiki/index.php/Main/APMonitorServerLinux to install a Linux server, but I did not succeed: several commands on that page are wrong (e.g. sudo chmod -R www-data:www-data /var/www/html/ should be sudo chown -R www-data:www-data /var/www/html/), and there is no lib directory on https://github.com/APMonitor/apm_server apm_linux that could be copied to /usr/lib) I Succeeded installing the apm server without the lib copy, running the Python test code failed because no results.csv was produced. I also followed these instructions: https://groups.google.com/g/apmonitor/c/YYXjlelD5gw?pli=1 (the referenced gz file contains a lib directory), but still no results.csv is produced.

At this moment, I am at a complete loss how to use gekko/apmonitor on m1 Mac or how to use a Linux server.

Is there any solution to these problems?

APMonitor commented 3 years ago

I'm working on an M1 / ARM compatible executable but it should work to get the linux server working. It should be available with the next release of Gekko (maybe) if the GCC compilers work.

It look like you may be on an Ubuntu server. The instructions are for a CentOS / RedHat Linux server. You don't need the /usr/lib files because IPOPT is not included with that executable. There is also the Windows server option.

bjrnfrdnnd commented 3 years ago

Thank you. Do you have a time frame when the M1 / ARM Version will be available?

I am on an Ubuntu server. The instructions on the page https://apmonitor.com/wiki/index.php/Main/APMonitorServerLinux are both for Ubuntu and RedHat/CentOS.

Do you mind trying to help me installing a local server? I can give you the commands I used and the errors/observations that follow.

APMonitor commented 3 years ago

I'm still trying to get the full gcc setup working. I also need gfortran and need to try that. I don't have a timeline yet because some of the things like compiler development for M1 are not in my direct scope.

APMonitor commented 3 years ago

The new executable is compiled on the Apple M1 processor. Please let us know if there are any issues with running with remote=False.

bjrnfrdnnd commented 3 years ago

Hi, It works. thanks