[patch, libfortran] Speed up cshift for dim > 1
Jerry DeLisle
jvdelisle@charter.net
Fri Jun 16 17:19:00 GMT 2017
On 06/14/2017 12:41 PM, Thomas Koenig wrote:
> Hello world,
>
> the attached patch implements a blocked algorithm for
> improving the speed of cshift for dim > 1.
>
> It uses the fact that
>
> integer, dimension (n1,n2,n3) :: a, b
>
> b = cshift(a,shift,3)
>
> is identical, as far as the memory locations is concerned.
>
> integer, dimension (n1*n2*n3) :: c, d
> d = cshift(c, shift*n1*n2, 1)
>
> The speedup is quite large; from being really slow for
> dim > 1, this patch makes it go even faster.
>
> Below there are some comparisons for the attached benchmark,
> do-1.f90. gfortran-7 uses the old library version.
>
> Interestingly, the library version is also much faster
> than an implementation of straight DO loops.
>
> Regression-tested. OK for trunk?
>
OK for trunk.
Thanks,
Jerry
More information about the Fortran
mailing list