TIL that the restrict keyword is part of C99 but not C++ also that it is not necessary in Fortran.
And this is why it's faster than C some-days for some-cases etc. but still actually faster.
Is there much going on with Fortran on GPU?
After 30 seconds of furious googling: https://developer.nvidia.com/cuda-fortran
My fingers can't type Fortran anymore, so I'm going to use C as an example.
Imagine you have this function:
In C, it's perfectly legal to call this like so: The C compiler has no choice but to iterate through the array one element at a time, doing things in the exact order that the source code spells out. No loop unrrolling or vectorization can occur.In Fortran, the compiler knows that the arrays are not aliased, so it can do much more reordering, unrolling, and vectorization to speed this code up.