7 ms·
NNSA, Nvidia to create an open-source Fortran compiler front-end for LLVM
- brudgers 11y agoThe sponsoring organization is is NNSA rather than NASA. NNSA is the National Nuclear Security Administration and hence the association with Lawrence Livermore Labs.
- gh02t 11y agoI work for NNSA actually. There's a ton of codes in the nuclear engineering sector that are written in Fortran and it's the lingua franca of the industry, though C++ and Python are taking over for new projects. One of the biggest codes in the industry (MCNP) is an enormous chunk of Fortran with a lineage going back over 60 years. It'd be nice to see an LLVM frontend for Fortran; Intel has a stranglehold with ifort due to their excellent vectorization. Hopefully this project can provoke some competition.
- santaclaus 11y agoWhy is gfortran not viable? Vectorization is not as good as Intel?
- squidfood 11y agoYup. I'm working with weather code myself; in my code a matrix mult is ~25% faster on intel versus gfortran due to this. (edit: this is still within the range of "viable competition" to me though).
- jey 11y agoYou don't just call DGEMM from vendor BLAS?
- gh02t 11y agoActually, Intel's BLAS (in MKL) is probably an even better product. [On Intel hardware] MKL makes an enormous, borderline hard-to-believe magic level improvement even over the other tuned BLAS libraries like ATLAS. Gfortran is OK and ifort isn't insurmountably more advanced, but Intel definitely has the mindshare in the HPC market locked down and they do a lot to promote their technologies in that community. That is what really gives them the vice grip on the market. IBM is really the only other company with the same cachet in that market.
- porker 11y agoAny pointers you can give to resources on this please? I'm dabbling in satellite image processing and have it working in Python (numpy et al) on a single core, but want to try splitting the work across multiple cores as 80 minutes per image is a long time to wait!
- ovis 11y agoNeed more details on what you're doing, but many simple operations used in satellite image analysis are embarrassingly parallel. You could, for example, read in chunks or strips using GDAL, distribute them across multiple threads or cores, and get some speed-up. If much of the time is spent in numpy rather than Python, I think it should be non-blocking so the GIL won't get in your way.
- porker 11y agoIt's a friend's research project I'm tinkering with, so if I don't sound like I know what I'm doing I don't... :) The first step is masking out clouds (morphological erosion + more), and then applying a haze optimized transform to the image data. I'm confused about making code parallelisable when the transform of a pixel relies on neighbouring pixels - how do you remove boundary errors (take extra pixels, then crop off each strip before recombining I guess)? There must be something in-place to deal with boundary errors round the edge of the image, but so far I haven't grasped it! Numpy, Scipy, and particularly scikit-image are where the time is spent - my dabbling was originally to try and speed things up, but I've also become interested in understanding what is going on.
- ovis 11y agoYeah, when I need neighbouring pixels I extract overlapping chunks. As far as the edge of the scene - there aren't any perfect solutions that I know of. You could try to fudge it by modifying the algorithm to handle the edges with fewer pixels, or perhaps use data from different scenes as an approximation. Or you may simply lose the data there.
- gh02t 11y ago
- jabl 11y agoGFortran maintainer here. Please don't judge GFortran by the speed of the MATMUL intrinsic. The matmul implementation is really a bare-bones unoptimized version. If you want performance use the -fexternal-blas option and link in a tuned BLAS library such as MKL or OpenBLAS. The exception is if you have very small fixed-size matrices, then the code is inlined and should be faster than BLAS.
- squidfood 11y agoThanks! I should mention that these tests were for a specific (highly tuned for the specific job) production HPC machine, so I don't know how this compares to a more generic setup - unfair of me to generalize the results to every matrix multiplication. We developed off the production machine in GFortran, and it worked very very well for us - didn't do timing tests there, but anecdotally, in development the difference was unnoticeable.
- gh02t 11y agoOh cool! Thanks for your time maintaining Gfortran. I know I said Intel has a stranglehold, but personally I prefer using Gfortran where I can as I prefer open source. So thanks!
- saboot 11y agoI use MCNP very often. I'm curious if there are any goals or plans to transition it to something more maintainable? I once attempted to make my own modification regarding outputting more information but could not grok any of that code .. It looked completely alien coming from a C++ background.
- gh02t 11y agoMCNP is a very typical old-school Fortran code. It takes practice to get a feel for reading that stuff, but it has its own beauty once you get the hang of it. SCALE is mid-way into migrating to C++. AFAIK though MCNP isn't going to change.
- thearn4 11y agoNASA engineer here. Title typo aside, that actually sounds a lot like our legacy code-base. Though Python has been making a lot of inroads, thanks partly to f2py
- ThomPete 11y agoSure not only is the NNSA guy here to correct a mistake and add some valuable, the NASA guy is also here adding even more context. Man this community and it's diverse group of amazing people. I don't there is a single place on the internet as valuable as this community. Sometimes I just have to pinch myself...
- voidlogic 11y ago>Though Python has been making a lot of inroads I weep to think of of all the cycles wasted on expensive tax payer funded hardware due to using Python over much faster Intel Fortran. We are talking like orders of magnitude. I once ported a fellow undergrads astronomy program from Python to C+CUDA and it ran on their personal workstation in less than a day, when it had been using the department cluster for a week before :/ People often hate on Fortran because its old and creeky when it often as fast or faster than C...
- GFK_of_xmaspast 11y agoWhat about expensive tax payer funded scientists.
- gh02t 11y agoPython isn't necessarily replacing the hardcore number crunching code (at least in my industry). It's more becoming the glue code to wrap those libraries and make them more accessible. That and data processing. I don't see people running massive simulations on clusters using mpi4py or whatever (thank god). Even then, in a lot of cases programmer time is infinitely more expensive than CPU time, so it often still makes sense if Python is the more accessible choice.
- wnoise 11y ago> codes Scientist/engineer detected. In the standard programming dialect, "code" is a mass noun. "Program" or "library" is countable.
- gh02t 11y agoMathematician actually, though I have a degree in nuclear engineering as well. I'm familiar with the terminology, but thanks for the lesson. I spend the vast majority of my time as a developer, actually.
- mch82 11y agoReferring to Fortran programs as "codes" seems to be a common, possibly generational, way of talking about old software in the aerospace industry. I used to hear it around the office a lot. Some of "codes" date back to the late 1950s. It would be interesting to know more about how the language we use to speak about software has changed over time if anyone feels like sharing.
- gh02t 11y agoNot sure it's generational as I'm under 30 so I'm not that old :\. As far as I hear it used, "code(s)" is the standard term for what is loosely any large simulation package amongst people in the numerical community (which includes mathematicians and computer scientists alike, so it's not just an engineering thing).
- ms013 11y agoThe other fun one is people who refer to the input files for the simulation packages as "input decks" (aka, punched card decks). I occasionally get a funny look when talking to someone from outside the computational science community use that term. And I'm in my 30s - punched cards were history by the time I started using computers myself, so this kind of terminology isn't really generational - it seems to come from specific communities.
- 11y ago
- Kristine1975 11y agoHere's the announcement on the LLVM developer mailing list: http://lists.llvm.org/pipermail/llvm-dev/2015-November/092404.html http://lists.llvm.org/pipermail/llvm-dev/2015-November/09240... The resulting discussion contains a mini-FAQ: http://lists.llvm.org/pipermail/llvm-dev/2015-November/092438.html http://lists.llvm.org/pipermail/llvm-dev/2015-November/09243... (both via the LLVM Weekly newsletter: http://blog.llvm.org/2015/11/llvm-weekly-98-nov-16th-2015.html http://blog.llvm.org/2015/11/llvm-weekly-98-nov-16th-2015.ht...)
- cprayingmantis 11y agoMakes sense both Livermore and ORNL have a lot of older Fortran code that they still use.
- bsharitt 11y agoIt not just to use old Fortran code. Lot's of it is still being written in the scientific computing world.
- yeukhon 11y agoPretty sure a lot of FOTRAN code are compiled or wrapped around with C interface when I install numpy/scipy. I just don't remember which module to be exact.
- Fomite 11y agoThe ODE solvers are, IIRC.
- gh02t 11y agoMany others too. QUADPACK, LSODA, LAPACK, MINPACK etc.
- yeukhon 11y agoI guess pretty much linear algebra / matrix stuff will find FOTRAN useful then. Thank you guys for answers.
- gh02t 11y agoNot just LA, pretty much all numerical methods. Fortran is still a very natural and surprisingly pleasant language for numerics these days. It's just terrible at everything else... which is why it doesn't get much attention in the broader programming community I think. Fortran is in a somewhat unique niche- basically anybody who uses a computer uses a library written in Fortran (via BLAS) but very few people are aware of it, especially that it has continued to develop and is actively in usd. There are plenty of places (mostly related to parallel evaluation) where Fortran is state of the art. But speaking as someone mildly competent in it, it isn't something everybody needs to care about. It has its niche and is pretty awful at everything else, best left to its little island of programmers. Haskell is my favorite language and C++ or Python are what I use in a professional setting, but I won't hesitate to break out the good old `IMPLICIT NONE` if it is the right tool.
- s-macke 11y agoIf this is true I can also compile scientific software with emscripten to Javascript, which is then able to compile the Fortran libraries BLAS and LAPACK. I like to have one click live demos of such software. Speed and memory doesn't matter for demos.
- harveywi 11y agoYou can already compile BLAS/LAPACK/etc. to JavaScript, but you have to jump through some hoops. Proof of concept: https://github.com/harveywi/arpack-js https://github.com/harveywi/arpack-js
- s-macke 11y agoYes, by using f2c. For BLAS and LAPACK, this is a big effort and doesn't run out of the box. The cblas libraries are too old and don't contain new functions.
- deleted 11y ago[deleted]
- sunnyps 11y agoOK. You can stop dreaming now, come back to reality please. Sometimes this community is so cringeworthy.
- ThomPete 11y agoSorry that my happiness for this community makes you cringe :)
- sunnyps 11y agoIt's not your happiness that makes me cringe but the borderline cultish comment that there's no "single place on the internet as valuable as this community". Just reinforces the stereotype that this community is full of itself. It would be great if we could all be a bit more grounded.
- ThomPete 11y agoWhat on earth are you talking about? I have literally never ever expressed my happiness over this community before. But just because i mention something once after having been here for i don't know how many years I am suddenly cultish? It sounds more like a cultish anti-sentiment if anything.
- themartorana 11y agoSome people just look for parades to rain on.
- dang 11y agoThat was uncharitable. We detached this subthread from https://news.ycombinator.com/item?id=10578612 https://news.ycombinator.com/item?id=10578612 and marked it off-topic.
- tedks 11y agoGCC has had an open-source Fortran compiler front-end since always. The only possible reason for Nvidia to do this is because they want to have proprietary compiler addons someday. Remember that this was a predictable outcome when you're inevitably burned by this.
- kevinchen 11y agoGCC includes a Java frontend too, but do any serious Java shops use it? It's not just about having a feature, it's about implementing that feature well and making it easy for others to contribute their improvements.
- cwyers 11y agoOr, alternatively, Nvidia is doing this because their current CUDA compiler works with LLVM. And a possible reason that they built their CUDA infrastructure on LLVM is because the people making GCC privileged ideology over technical merit and made it much harder for tools (even open source or libre ones) to integrate with the compiler. Remember that this was a predictable outcome when you're inevitably burned by this.
- tedks 11y agoDoing a rewrite seems to me to always result in a cleaner codebase faster than the incremental refactoring. That said, GCC today is a lot easier to interop with than the GCC of pre-LLVM times. But, no amount of technical merit can save you when you don't have a free compiler anymore. Don't say Stallman didn't warn you, because he did, just like he warned you about all the other crap. Remember, when you're getting burned by this, that you chose to make snarky comments on the Internet instead of realizing what the moral path forward was and doing the ethical thing.
- Jerry2 11y agoHere is the link to a thread on GCC's mailing list discussing the move by NNSA: https://news.ycombinator.com/item?id=10578354 https://news.ycombinator.com/item?id=10578354 LLVM has a huge momentum now and it's negatively affecting GCC. GCC has been in trouble before but they got out of it by being the best free compiler available. I don't know how much longer they'll be able to sustain without making some changes.
- kevinchen 11y agoA choice quote from that thread: > Between 2000 and 2004, [g95 fortran] front-end was coupled to the rest of the infrastructure of the GNU Compiler Collection. This was not trivial (just as it will not be trivial to couple the PGI front-end to the LLVM infrastructure). They really don't get that LLVM's modularity is a strength...