LFortran can now build legacy and modern Minpack

It’s our 4th anniversary of open sourcing LFortran, and we are happy to announce that we can now compile both the legacy Minpack (verbatim from SciPy) and the modern Minpack (fortran-lang/minpack), and run correctly. This is a big milestone for us, and I am personally very happy with our progress so far. More details:

41 Likes

:wave: :wave:
Absolutely brilliant!

4 Likes

This is fantastic! Bravo! Thank @certik and the LFortran team for the enormous effort!

I look forward to seeing LFortran compiling my project PRIMA, which provides the modernized reference implementation of renowned optimization solvers by M. J. D. Powell for solving general nonlinear optimization problems without using derivatives.

One of the aforementioned solvers, COBYLA, is already included in SciPy. So I suppose LFortran will soon be able to compile it.

Arguably, COBYLA is among the most widely used optimization solvers in scientific and engineering communities. Unfortunately but unsurprisingly, the COBYLA in SciPy is implemented in fixed-form FOTRAN 77, and inevitably contains serious bugs. Fortunately, the inclusion of PRIMA into SciPy is under discussion and the main contributors of SciPy are positive about it. It will replace the buggy and unmaintained FORTRAN 77 version of COBYLA, and make the other solvers of Powell’s available to all SciPy users. That said, LFortran will encounter PRIMA in the (hopefully near) future anyway.

5 Likes

@zaikunzhang excellent, thanks for your efforts! You should try to get PRIMA into SciPy. Is that the first “modern” Fortran in SciPy? I don’t think SciPy uses any Fortran “modules” yet, correct?

I think if you succeed to get your modern Fortran code into SciPy, that might turn the tide on Fortran. So I think this is a big deal. What needs to happen to get it done? Ask for help on this forum, just start a thread, create a plan and ask people to join your efforts. With enough people it will go quick.

2 Likes

Thank you @certik for your support and encouragement, which mean a lot.

I do not know exactly the current status of other Fortran libraries in SciPy, but it seems yes, most of them seem to be FORTRAN, if not all. Such code, while being extremely precious, is essentially dead and will inevitably be eliminated if the Fortran community does not act quickly enough to modernize them and persuade the SciPy maintainers in continuing to use Fortran libraries as their engines for numerical computation. Recall the very recent discussion in the SciPy community about getting rid of the scipy.interpolative Fortran code. I am afraid that such discussions are contagious. In addition, with Python being such a vigorous community in the contemporary computing world, an epidemic in this community will soon become a pandemic.

According to the discussion on github/scipy/scipy, the major SciPy maintainers are positive about the inclusion of PRIMA solvers. After all, they know how popular and powerful Powell’s solvers (especially COBYLA) are, they have received considerable requests on the availability of Powell’s solvers beyond COBYLA, and they have been bugged/bothered/puzzled quite enough times by the FORTRAN 77 implementation of Powell’s solvers (see a recent discussion on the SciPy mailing list).

It would be great if getting PRIMA included in SciPy can “turn the tide on Fortran”. Then my endeavor, my time, and my loss due to this project will partially pay off.

Indeed, I do need significant help from this community — I do not know Python at all. My colleague and former student @ragonneau Tom is a Python expert, but he is too busy working on other projects. Therefore, I would need the community’s help with wrapping PRIMA in Python. We have done the wrapping for the FORTRAN 77 implementation of the same solvers under the PDFO project, which can serve as a good starting point.

If you want, you may also join the discussion on GitHub and share your thoughts. The last update of that thread was more than a month ago, because I have been too busy, and because I have not made any progress in that direction.

I will later start a new thread to introduce more about PRIMA. Before that, those who are interested may check its GitHub repo.

Many thanks again!

2 Likes