10 ms·
Fortran Standard Library
- azhenley 6y agoIf Fortran has been around for this long without a standard library, then what do people use now? Does each compiler have its own? Are they very different? Is there much of a need for this since it hasn't existed for 60+ years?
- AlexeyBrin 6y ago> If Fortran has been around for this long without a standard library, then what do people use now? The actual language, for example most of the functionality that in C is considered to be in the standard library (like I/O operations, mathematical functions) is implemented in the language in Fortran's case. If the language is not enough for your particular case, you can use third party library like BLAS, LAPACK ...
- walshemj 6y agoBack when I worked with Fortran we tended to buy our library's from NAG https://www.nag.co.uk/content/nag-library https://www.nag.co.uk/content/nag-library or Gino F for graphics
- sampo 6y ago> then what do people use now? Language has basic string type (character array, really) and basic file access. People would use NetCDF or HDF libraries for reading and writing big numeric datasets. Algorithms, people would write their own when needed. For linear algebra, BLAS, LAPACK and (sometimes Intel MKL) is de facto standard, it's just not called a standard library.
- fortran-guy 6y agoI also tend to use `iso_c_binding` a fair amount these days if I need something in `stdlib`.
- gnufx 6y agoIt's probably worth pointing out that LAPACK/BLAS is a strictly Fortran77 interface, which isn't ideal. Unfortunately there's no de facto standard modern interface available.
- colechristensen 6y agoMuch is built in to the language spec, which then becomes a definition debate about what constitutes a standard library, not a useful debate in this context. There are many popular "standard" libraries that people use like BLAS and LAPACK and domain specific code for say, mesh generation. Also, most Fortran code is used for numerical calculation, most of what you need for that is already there. As for compilers, there are still regularly released Fortran standards. The first proposal for what became Fortran was in 1953! The first compilers came a few years later. This was still on punch cards, and details of the syntax still remain from that era. Most of the standards are real standards and come with a date, Fortran 66, Fortran 90, etc. There have also been many branded releases tied to compilers. There are definitely differences in compilers on the edges, and the results you get can differ from one to another. But mostly they are the same with some compilers adding features specific to themselves. Is there a need for this? Well there is some very commonly done linear algebra which you either have to write yourself or pick out a library, so it does make some sense to have these things standardized and included which would ease some burden. Here's a reference to built in functions for a specific compiler: http://docs.nscl.msu.edu/ifc/intelfor_lib.pdf http://docs.nscl.msu.edu/ifc/intelfor_lib.pdf
- leephillips 6y agoFortran is so old that at first it was used without an operating system; in a sense the Fortran compiler was the operating system.
- colechristensen 6y agoMoreso it was proposed as a language abstracted away from programming computers in assembly on punchcards.
- atrettel 6y agoFortran has some aspects of a standard library already, though compared to other languages the shelves are rather bare, let's say. It wasn't until Fortran 2003 that there was a standard way to get command line arguments. Before then different compilers had different ways to do that. Most users of Fortran are only looking to crunch numbers. That's their application, and for that application Fortran already comes with everything you need, including a large standard library of mathematical functions and operations. I would argue that many users do not have much of a need for anything beyond multidimensional arrays, to be honest. I only know two people who have implemented linked lists in Fortran, for example. That said, it would be nice if Fortran had a good standard library. I would appreciate if Fortran had assertions, for example.
- overheadnoise 6y agoIn my experience as a researcher in computational numerics, the “standard library” is going to be defined by the in-house code that I use. That code is going to use other scientific libraries like for example PETSc, Atlas/blas/mkl, MPI in the background, but the typically researcher isn’t going to be exposed to that because their focus is on setting up the equation Ax = b and writing the algorithm to solve it for x.
- colechristensen 6y agoInteresting. I'd also like to see compiled a curated list of standard Fortran libraries, that is commonly used and hopefully academically peer reviewed and part of prominent published work. Scientific programming in fields that have significant Fortran legacy is often a matter of writing new code to build upon or adapt existing experimentally verified code for new studies. An annotated library of notable code and details about it with references to publications could be very valuable. Unfamiliar to most developers, scientific programming has the quirk that the more code you write, the more your experiment becomes about the code instead of your actual thesis. This is one of the reasons Fortran stays relevant, decades of code and experiment built up as a foundation for something new.
- walshemj 6y agoNAG Numerical Algorithms group has been around for decades
- colechristensen 6y agoIs it only a paid product? That would have some resistance in academia, both for openness and funding reasons.
- walshemj 6y agoYes though it was founded by a consortium of UK universities :-) but its far cheaper (and has less bugs) that paying some one to write your own. Same reason that writing your own crypto is a bad idea.
- bobochan 6y agoYes. I have been in academia for over twenty years and having access to NAG has always been a given.
- gnufx 6y agoHo, ho. I've been told by a NAG representative that we should pay them to talk to our own academics who actually do the serious linear algebra! Also I was told they were contracted to do the old AMD proprietary BLAS, which was inferior to OpenBLAS, and has been dropped in favour of BLIS. I don't wish to slight the general quality of their stuff, though. Their Fortran compiler is notable in this context. You don't get the large scale parallel libraries from NAG anyway.
- non-entity 6y agoHow many people are writing new Fortran code? I know it has its niches, and is used in some popular numerical Python packages, but what about outside that? I've seen it mentioned in a few job postings for government contractors or "scientific programmer" (more of a PhD scientist who happens to program) roles, but typically listed in a way that makes it look like an HR person took a list of the tech a company used in the last few decades and make them all listed as requirements.
- zwieback 6y agoI wonder about the same thing. When I graduated in 1985 Fortran was already described more or less like you just did. However, when I recently dug down through the NumPy/SciPy stack to understand some details I saw a lot of Fortran code. Some popular algorithms seem to exist only as Fortran with various language interfaces on top. So I don't think there are very many new projects being started but the presence of so much critical code in Fortran will extend its lifetime some more.
- jarvist 6y agoThe vast majority of time on research supercomputers is used in running Fortran codes. (Click on 'languages' https://www.archer.ac.uk/status/codes/ https://www.archer.ac.uk/status/codes/ , this is the UK national facility.) And yes, as you've noticed almost all linear algebra is written in Fortran (BLAS, LAPACK, ScaLAPACK), so no matter what language you've written something to do some useful computation in, it's likely that most of the cycles are spent in Fortran!
- atrettel 6y agoI'm writing new Fortran right now, actually. I know a lot of people who still write Fortran, though all of them work in scientific or engineering fields. I view Fortran as only good for number crunching, but for that purpose it is difficult to beat in many respects. Fortran is very common in supercomputing applications, though C and C++ are also very common. I know a lot of people who view Fortran as antiquated, and I understand their criticisms. I prefer other programming languages in general, but all programming languages are just tools and Fortran is a good tool in some circumstances.
- 6y ago
- cat199 6y agono real skin in the game, but basing this on a preprocessor language that requires python seems curious (if still pragmatic).. realize that fortran has a long history of being used with preprocessing, but usually these have been standalone tools AFAIK anyone have any insight here?
- certik 6y agoI am one of the authors. We will pre-generate the files into a tarball, so that end users do not have to worry about generating it or have Python installed. Also we'll probably rewrite the preprocessing tool to C++ for robustness and speed. The reason we use it is that we need some easy way to generate the subroutines to work with any array dimension. There are not many other good options.
- burfog 6y agoIt's another project with a cancel-culture CoC that will be used by low-contribution people to railroad other people out of the project. Enabling those who value political fights over productivity is unwise. As a matter of policy, I stay clear of such projects. Just the last week there was a project that missed out on major optimization because I won't touch it.
- tikej 6y agoCould you explain what is cancel-culture Code of Conduct? I looked at it and didn’t find anything that would let railroading people out of the project so I’m curious what is wrong with it
- burfog 6y agoIt would be fine if all people were reasonable and uninterested in causing political commotion to score a win. Of course, in that case there would be no conduct issues to deal with. So when you read it, don't think "Of course it wouldn't be used that way." (same as when a law is passed) For a person with malice, that Code of Conduct is a very effective weapon. People will claim offense, sometimes even 3rd-party offense over things said long ago or outside the project. Others will follow the CoC maliciously or, at best, robotically. The political fight takes over the mailing lists, factions form, and actual productive contributors leave or are tossed out.
- thosakwe 6y agoReading this comment, one has to wonder what its actual relevance to the content is. Is the code of conduct somehow more important than the actual library itself?
- protomyth 6y agoI would say burfog thinks so. It is basically another license on the code and we have seen decades of debate on those. Never mind patent grants in license or as a separate document. CoC is another social contract and will probably be of increasing importance as cases of their use happen.