5 ms·
LFortran compiles PRIMA
- andsoitis 2y agoLFortran is an alpha-stage modern, interactive LLVM-based Fortran compiler.
- froh 2y agothanks you've saved me looking it up myself
- pjmlp 2y agoNice milestone. Modern Fortran is no longer the FORTRAN from punch cards, having this compiler push maybe will help folks to write directly blazing performance Fortran code, instead of numerical code in Python.
- anta40 2y agoThe lang is still under development, the most current in in Fortran 2023: https://global.oup.com/academic/product/modern-fortran-explained-9780198876588?cc=us&lang=en& https://global.oup.com/academic/product/modern-fortran-expla...
- pjmlp 2y agoI am fully aware of it, however most recent revisions tend not to be adopted by all compilers, and honestly the large majority only cares about keeping existing code running. A bit like C23 and C++23 are here, and the large majority is a mix of C89, C99, C++11, and C++17, as what folks in the trenches care about. Or Java 8 versus Java 24, and so on. Fortran is in a similar position.
- rbanffy 2y agoHow many different platforms out there run Fortran code these days? I’m aware of it being very important in scientific computing (and compiling existing code is critical) but I don’t know many other use cases and different platforms requiring different compilers.
- pjmlp 2y agoIn many HPC cases you are using the platform tools, not gfortran. Also we have one use case that is responsible for OpenCL losing mindshare for scientific community, running Fortran on GPU. Thus I bet at least Intel, NVidia, AMD, Cray, IBM, being relevant ones. Yes, some of them are planning to eventually adopt LFortran to replace their own, like they did with clang, or at least are using LLVM nowadays.
- pklausler 2y agoI think that you're conflating LFortran with LLVM Flang.
- ok123456 2y agoEveryone using numpy.
- rbanffy 2y agoWhat compilers are used to build it might be relevant.
- ok123456 2y agoTypically gfortran and intel fortran.
- ggraphilia 2y agoIt may not be that simple on Windows : https://labs.quansight.org/blog/building-scipy-with-flang https://labs.quansight.org/blog/building-scipy-with-flang
- yjftsjthsd-h 2y agoI was given to believe that a lot of numerical code in python is fortran with a little bit of wrapper?
- pjmlp 2y agoDepends on the library, it is a mix of C, C++, Fortran, and using Python as JIT DSLs.
- rewqa 2y ago[flagged]
- fdfdsafa 2y ago[dead]
- erwiue 2y ago[dead]
- fadreqrew 2y ago[dead]
- actinium226 2y agoCongrats to Ondřej Čertík and the team working on LFortran, this is a big milestone!
- genphy1976 2y agoFor more information about LFortran, see - Wikipedia: https://en.wikipedia.org/wiki/LFortran https://en.wikipedia.org/wiki/LFortran - Homepage: https://lfortran.org https://lfortran.org - GitHub: https://github.com/lfortran/lfortran https://github.com/lfortran/lfortran If you like to play with it, see - LFortran in web browsers using WebAssembly: https://dev.lfortran.org https://dev.lfortran.org - LFortran in Compiler Explorer: https://godbolt.org/z/EfWvsY6Kh https://godbolt.org/z/EfWvsY6Kh
- genphy1976 2y agoIn case you appreciate LFortran and would like to sponsor its development, see - Become a sponsor to LFortran: https://github.com/sponsors/lfortran https://github.com/sponsors/lfortran - Open Collective: https://opencollective.com/lfortran https://opencollective.com/lfortran - NumFOCUS: https://numfocus.org/donate-to-lfortran https://numfocus.org/donate-to-lfortran
- ggraphilia 2y agoSee https://labs.quansight.org/blog/building-scipy-with-flang https://labs.quansight.org/blog/building-scipy-with-flang which was once discussed on HN at https://news.ycombinator.com/item?id=38196412 https://news.ycombinator.com/item?id=38196412
- ggraphilia 2y agoDiscussions on the Fortran Discourse: https://fortran-lang.discourse.group/t/lfortran-compiles-prima/9296 https://fortran-lang.discourse.group/t/lfortran-compiles-pri...
- quanto 2y ago> It utilizes a range of Modern Fortran features, including extensive use of optional variables, function pointer passing, and a randomized test driver, among others. Successfully compiling PRIMA requires a compiler with a robust and mature backend, as well as well-developed intermediate passes and a capable parser. I am not getting a full picture here. What's challenging about PRIMA code base? Does it use some advanced features that are difficult for a compiler to support? Are the mentioned features in the 2008 standard? What's actually impressive is that LFortran in alpha stage is only 2x slower than GFortran, which goes back decades.
- certik 2y agoIt was a lot of corner cases that we had to get right, it's the most advanced code that LFortran can compile. I think none of the features individually is difficult to support, but there were a lot of them.
- ggraphilia 2y agoFor PRIMA, see https://github.com/libprima/prima https://github.com/libprima/prima https://hn.algolia.com/?dateRange=all&page=0&prefix=true&query=Prima%20&sort=byPopularity&type=story https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
- genewitch 2y agoI'll have to benchmark a library-less Matmul with LFortran, to compare against flang, C, and python versions. Roughly: 8, 12, 18 units of time, respectively. Python only being twice as slow for the simplest matmul - how much of that is merely the interpreter startup time?