[Bug 1879092] Re: gfortran can't use vectorized functions.
Balint Reczey
1879092 at bugs.launchpad.net
Mon Sep 14 20:56:06 UTC 2020
Tested 2.31-0ubuntu9.1 on Focal:
root at ff-gfortran:~# cat > vect_test.f90
program test_vect
implicit none
integer, parameter :: n = 64*1024**2
integer :: i
integer(8) :: t1, t2, t0
real(8) :: tic
!
real, allocatable :: a32(:), b32(:)
real(8), allocatable :: a64(:), b64(:)
!
allocate( a32(n), a64(n))
allocate( b32(n), b64(n))
!
call random_number(a32 )
call random_number(a64 )
!
call system_clock(t0, tic)
!
do i = 1, n
b32(i) = sin(a32(i))
end do
!
call system_clock(t1)
print*, (t1-t0)/tic
!
do i = 1, n
b64(i) = sin(a64(i))
end do
!
call system_clock(t2)
print*, (t2-t1)/tic
!
end program test_vect
root at ff-gfortran:~# dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=============-============-=================================
ii libc6:amd64 2.31-0ubuntu9 amd64 GNU C Library: Shared libraries
root at ff-gfortran:~# dpkg -l libc6 | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=============-============-=================================
ii libc6:amd64 2.31-0ubuntu9 amd64 GNU C Library: Shared libraries
root at ff-gfortran:~# gfortran -O3 -mavx2 vect_test.f90 -o test.x
root at ff-gfortran:~# nm ./test.x | grep sin
U sin@@GLIBC_2.2.5
U sinf@@GLIBC_2.2.5
root at ff-gfortran:~# sed -i 's/backports/proposed/' /etc/apt/sources.list
root at ff-gfortran:~# apt update -qq
48 packages can be upgraded. Run 'apt list --upgradable' to see them.
root at ff-gfortran:~# apt install -qq libc6 libc-bin locales
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libc-dev-bin libc6-dev
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc-bin libc-dev-bin libc6 libc6-dev locales
5 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
Need to get 9807 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Preconfiguring packages ...
(Reading database ... 35617 files and directories currently installed.)
Preparing to unpack .../libc6-dev_2.31-0ubuntu9.1_amd64.deb ...
Unpacking libc6-dev:amd64 (2.31-0ubuntu9.1) over (2.31-0ubuntu9) ...
Preparing to unpack .../libc-dev-bin_2.31-0ubuntu9.1_amd64.deb ...
Unpacking libc-dev-bin (2.31-0ubuntu9.1) over (2.31-0ubuntu9) ...
Preparing to unpack .../libc6_2.31-0ubuntu9.1_amd64.deb ...
Unpacking libc6:amd64 (2.31-0ubuntu9.1) over (2.31-0ubuntu9) ...
Setting up libc6:amd64 (2.31-0ubuntu9.1) ...
(Reading database ... 35616 files and directories currently installed.)
Preparing to unpack .../locales_2.31-0ubuntu9.1_all.deb ...
Unpacking locales (2.31-0ubuntu9.1) over (2.31-0ubuntu9) ...
Preparing to unpack .../libc-bin_2.31-0ubuntu9.1_amd64.deb ...
Unpacking libc-bin (2.31-0ubuntu9.1) over (2.31-0ubuntu9) ...
Setting up libc-bin (2.31-0ubuntu9.1) ...
Setting up locales (2.31-0ubuntu9.1) ...
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
Setting up libc-dev-bin (2.31-0ubuntu9.1) ...
Setting up libc6-dev:amd64 (2.31-0ubuntu9.1) ...
Processing triggers for man-db (2.9.1-1) ...
root at ff-gfortran:~# gfortran -O3 -mavx2 vect_test.f90 -o test.x
root at ff-gfortran:~# nm ./test.x | grep sin
U _ZGVdN4v_sin@@GLIBC_2.22
U _ZGVdN8v_sinf@@GLIBC_2.22
root at ff-gfortran:~#
** Tags removed: verification-needed verification-needed-focal
** Tags added: verification-done verification-done-focal
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-10 in Ubuntu.
https://bugs.launchpad.net/bugs/1879092
Title:
gfortran can't use vectorized functions.
Status in gcc-10 package in Ubuntu:
New
Status in glibc package in Ubuntu:
Fix Released
Status in gcc-10 source package in Focal:
New
Status in glibc source package in Focal:
Fix Committed
Status in gcc-10 source package in Groovy:
New
Status in glibc source package in Groovy:
Fix Released
Bug description:
[Impact]
After ubuntu-glibc maintainers changed "math-vector-fortran.h" install
directory (LP#1861353), gfortran can no longer use it.
[Test Case]
This the old (good) behavior Ubuntu 19.10 gcc-9.2.1 glibc 2.30
$ gfortran -O3 -mavx2 vect_test.f90 -o test.x
$ nm ./test.x | grep sin
U _ZGVdN4v_sin@@GLIBC_2.22
U _ZGVdN8v_sinf@@GLIBC_2.22
After that change : Ubuntu 20.04 gcc-9.3.0 glibc 2.31
$ gfortran -O3 -mavx2 vect_test.f90 -o test.x
$ nm ./test.x | grep sin
U sin@@GLIBC_2.2.5
U sinf@@GLIBC_2.2.5
$ cat vect_test.f90
program test_vect
implicit none
integer, parameter :: n = 64*1024**2
integer :: i
integer(8) :: t1, t2, t0
real(8) :: tic
!
real, allocatable :: a32(:), b32(:)
real(8), allocatable :: a64(:), b64(:)
!
allocate( a32(n), a64(n))
allocate( b32(n), b64(n))
!
call random_number(a32 )
call random_number(a64 )
!
call system_clock(t0, tic)
!
do i = 1, n
b32(i) = sin(a32(i))
end do
!
call system_clock(t1)
print*, (t1-t0)/tic
!
do i = 1, n
b64(i) = sin(a64(i))
end do
!
call system_clock(t2)
print*, (t2-t1)/tic
!
end program test_vect
Verbose:
Ubuntu 19.10
$ gfortran -O3 -mavx2 -v vect_test.f90 -o test.x
...
/usr/lib/gcc/x86_64-linux-gnu/9/f951 vect_test.f90 -quiet -dumpbase vect_test.f90 -mavx2 -mtune=generic -march=x86-64 -auxbase vect_test -O3 -version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/9/finclude -fpre-include=/usr/include/finclude/math-vector-fortran.h -o /tmp/cc2E2K8s.s
...
Ubuntu 20.04
$ gfortran -O3 -mavx2 -v vect_test.f90 -o test.x
...
/usr/lib/gcc/x86_64-linux-gnu/9/f951 vect_test.f90 -quiet -dumpbase vect_test.f90 -mavx2 -mtune=generic -march=x86-64 -auxbase vect_test -O3 -version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/9/finclude -o /tmp/cc4swJwz.s
...
[Other Info]
As you can see gfortran is not preincluding "math-vector-fortran.h" file on Ubuntu 20.04.
A workaround is to copy "math-vector-fortran.h" to /usr/include/finclude (which is empty!).
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-10/+bug/1879092/+subscriptions
More information about the foundations-bugs
mailing list