insarlab / PySolid

A Python wrapper for solid Earth tides
GNU General Public License v3.0
61 stars 7 forks source link

`f2py` appears to skip code in `solid.for` that is not supported for Mac M2s #65

Open scottstanie opened 11 months ago

scottstanie commented 11 months ago

forwarded from Paul Rosen (on trying to install it on an M2 machine):

F2py appears to be skipping code in solid.fort that is not supported, in my case an implied DO in a DATA statement that is common in old fortran. A possible solution is to modify the setup to use –std=legacy in gfortran, but I don’t know how robust that is for all compilers and all machines.

More details

Pip failed until I had Michael Aivazis guide me through what is actually happening with pip and we got the code to rebuild the source with the right pip command line switch (--no-binary). I ran f2py by hand in verbose mode and it told me that the compiler did not understand a particular implied do array definition so it was skipping the code! So I have no confidence that the code is actually correctly compiled. According to Aivazis, you must use –std=legacy to get old code like this to compile properly, but I have no idea how to do that with the pip infrastructure.

it might be solved now that you can Conda install it even for osx-arm... but it's probably a bad sign for future stability that a new macbook causes the standard compilation to fail.

yunjunz commented 11 months ago

Thank you @scottstanie for the info and forwarding. Could you update the notes regarding the --no-binary and -std=legacy options?

The long-term solution would be to translate the fotran code to python completely, as Piyush suggested before. This should not be a big project. UPDATE: I will try to work on this after #72.

I am a little bit hesitant going in this direction because the official code from IERS is still also in Fortran, based on which the solid.for is modified. Having a pure Python version seems to make it difficult to update together with the IERS version, although we have never done it in the current Fortran version neither.