13 ms·
I 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, thoug
by gh02t 11y ago
I 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