[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jan 21 10:37:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #28211|0 |1
is obsolete| |
--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 43200
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43200&action=edit
Draft patch for BACK, slows down some cases
This patch implements the functionality, but there are still
issues with speed. Putting in the condition for back inside
a hot loop slows down things too much..
Here are some numbers:
program main
real, dimension(1000,1000) :: a
real, dimension(1000*1000) :: b
call random_number(a)
call cpu_time (t1)
print *,minloc(a)
call cpu_time (t2)
print *,t2-t1
call random_number(b)
call cpu_time (t1)
print *,minloc(b,dim=1)
call cpu_time (t2)
print *,t2-t1
end program main
"gfortran" is gcc-8 with the patch, "/usr/bin/gfortran" is gcc-7.
$ gfortran -O3 bench.f90 && ./a.out
4.58569974E-02
7.76470006E-02
$ gfortran -Ofast bench.f90 && ./a.out
4.58849967E-02
4.99750078E-02
$ /usr/bin/gfortran -O3 bench.f90 && ./a.out
3.56819928E-02
7.77039826E-02
$ /usr/bin/gfortran -Ofast bench.f90 && ./a.out
4.05109972E-02
4.98609543E-02
So, the inline version appears to be OK, the library version is slower.
More information about the Gcc-bugs
mailing list