[patch, libfortran, RFC] Speed up cshift with array shift

Jerry DeLisle jvdelisle@charter.net
Tue Jun 20 18:28:00 GMT 2017


On 06/19/2017 03:34 PM, Thomas Koenig wrote:
> Hello world,
> 
> this is an RFC patch for speeding up the other part of cshift.
> No mathematical tricks this time, just new functions which
> copy the data types instead of using memcpy.
> 
> Performance improvement:
> 
>  cpu time cshift dim=1   0.277510017
>  cpu time do loop dim=1   0.201206982
>  cpu time cshift dim=2   0.514984965
>  cpu time do loop dim=2   0.515266180
>  cpu time cshift dim=3    1.01037502
>  cpu time do loop dim=3    1.03989792
> 
> vs (gcc 7 without the patch).
> 
>  cpu time cshift dim=1   0.492732018
>  cpu time do loop dim=1   0.188914001
>  cpu time cshift dim=2   0.601395011
>  cpu time do loop dim=2   0.462792039
>  cpu time cshift dim=3   0.942433834
>  cpu time do loop dim=3    1.07195783
> 
> for the attached test case. So, better if not quite the
> performance of straightforward DO loops.
> 

I am curious why the do loops are so much better. Are they being optimized
better? Do we need to turn on better optimization for these functions, such as
vectorize loops, etc.

Jerry



More information about the Fortran mailing list