News for hackers. Stuff that matters.
Re:Why physicists still use Fortran (2015) by dahart on Sunday October 15, 2017 @11:48AM (#15477617)
> Interestingly, C/C++ beats Fortran on all but two of the benchmarks, although they are fairly close on most.

I think this is fairly recent that C/C++ wins. I don’t know how recent exactly, but I remember a colloquium not too long ago by a compiler researcher who said that cross-compiling to Fortran and then optimizing almost always produced faster code than the C/C++ compiler could. Fortran is apparently easier to optimize.

Re:Why physicists still use Fortran (2015) by quadruplebond on Sunday October 15, 2017 @12:00PM (#15477674)
For science codes, where Fortran is still used, the most expensive pieces (think DGEMM Kernel) are largely written in architecture dependent ASM anyways so programming language doesn't have that much of an effect on the most time critical pieces of large HPC programs.

If a specific function is important enough it will be hand optimized in a way that the language doesn't really matter. Sometimes that means calling MKL, or using Cuda, or writing your own assembly.

Re:Why physicists still use Fortran (2015) by pletnes on Sunday October 15, 2017 @01:18PM (#15478036)
DGEMM doesn’t necessarily win over MATMUL for small matrices. Useful in e.g rotation matrices in finite element codes, and lots of other areas. Since matmul can be done with inlined loops, you also avoid the function call overhead, but it looks like a function call which is good for readability.
Re:Why physicists still use Fortran (2015) by quadruplebond on Sunday October 15, 2017 @06:49PM (#15479784)
Yeah small and skinny matrix multiplies are an active area of research.
Re:Why physicists still use Fortran (2015) by nejenendn on Sunday October 15, 2017 @12:28PM (#15477826)
Fortran is easier to optimize compared to c/++ if you don’t use restrict for the c end. If you do use restrict (iirc) the compilers are competitive.
Re:Why physicists still use Fortran (2015) by noobermin on Sunday October 15, 2017 @03:42PM (#15478900)
What I don't get is why someone doesn't make a superb template library with C++ that hides the restricts; it would make writing performant codes in C++ easier and you'd get the host of what C++ has to offer
Re:Why physicists still use Fortran (2015) by quadruplebond on Sunday October 15, 2017 @06:44PM (#15479761)
Eigen isn’t good enough? You can offload some stuff to MKL with it also.
Re:Why physicists still use Fortran (2015) by pjmlp on Sunday October 15, 2017 @01:51PM (#15478177)
Kind of, compilers don't enforce correct use of restrict which opens the doors to strange errors, as it is UB if they actually do overlap.

Which is the main reason why ANSI C++ members are not keen in having restrict in C++.

Re:Why physicists still use Fortran (2015) by nejenendn on Sunday October 15, 2017 @02:30PM (#15478416)
Agreed. However, C++ pragmatically does have restrict in both clang and g++, which is still useful in cases where you can deductively prove the lack of aliasing.
Re:Why physicists still use Fortran (2015) by pjmlp on Sunday October 15, 2017 @04:08PM (#15479026)
There are more compilers out there, although I do agree in the context of HPC, those are probably the most used ones.
Re:Why physicists still use Fortran (2015) by vram22 on Sunday October 15, 2017 @01:37PM (#15478106)
It say something like that here:

https://en.wikipedia.org/wiki/Restrict