gfortran can't use vectorized functions.

Bug #1879092 reported by Mehdi Chinoune
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-10 (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Groovy
Fix Released
Undecided
Unassigned
glibc (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Balint Reczey
Groovy
Fix Released
Undecided
Unassigned

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!).

description: updated
tags: added: focal
Matthias Klose (doko)
tags: added: rls-ff-incoming rls-gg-incoming
tags: removed: rls-ff-incoming
tags: removed: rls-gg-incoming
Changed in glibc (Ubuntu Groovy):
status: New → Fix Committed
tags: added: id-5ee2520536beb468db5f4d3e
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glibc - 2.31-0ubuntu10

---------------
glibc (2.31-0ubuntu10) groovy; urgency=medium

  * Copy the fully conditionalized x86 variant for math-vector-fortran.h
    to /usr/include/finclude. On all architectures. LP: #1879092.
  * Backport x86 CET patches from the trunk.
  * debian/patches/git-updates.diff: update from upstream stable branch.
    - [23296] Data race in setting function descriptor during lazy binding
    - [25639] localedata: Some names of days and months wrongly spelt in Occitan
    - [25810] x32: Incorrect syscall entries with pointer, off_t and size_t
    - [25896] Incorrect prctl
    - [25902] Bad LOADARGS_N
    - [25966] Incorrect access of __x86_shared_non_temporal_threshold for x32
    - [25976] nss_compat: internal_end*ent may clobber errno, hiding ERANGE

 -- Matthias Klose <email address hidden> Thu, 11 Jun 2020 11:53:48 +0200

Changed in glibc (Ubuntu Groovy):
status: Fix Committed → Fix Released
Revision history for this message
Balint Reczey (rbalint) wrote :
Changed in glibc (Ubuntu Focal):
status: New → Confirmed
assignee: nobody → Balint Reczey (rbalint)
status: Confirmed → In Progress
Balint Reczey (rbalint)
description: updated
description: updated
Balint Reczey (rbalint)
description: updated
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Mehdi, or anyone else affected,

Accepted glibc into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/glibc/2.31-0ubuntu9.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in glibc (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (glibc/2.31-0ubuntu9.1)

All autopkgtests for the newly accepted glibc (2.31-0ubuntu9.1) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

prometheus-blackbox-exporter/0.13.0+ds-2 (armhf, amd64, ppc64el, s390x, arm64)
prometheus-pushgateway/1.0.0+ds-1 (armhf, amd64, ppc64el, s390x, arm64)
systemd/245.4-4ubuntu3.2 (s390x, amd64, ppc64el)
gfs2-utils/unknown (amd64)
hugo/0.68.3-1 (armhf, amd64, ppc64el, s390x, arm64)
grubzfs-testsuite/0.4.10 (amd64)
glibc/2.31-0ubuntu9.1 (armhf)
badger/2.0.1-3 (armhf, amd64, ppc64el, s390x, arm64)
resource-agents/1:4.5.0-2ubuntu2 (armhf)
etcd/3.2.26+dfsg-6 (amd64, ppc64el)
postgresql-multicorn/1.3.4-31-g9ff7875-3 (armhf, amd64, ppc64el, s390x)
gfs2-utils/3.2.0-3 (ppc64el, s390x, arm64)
scipy/1.3.3-3build1 (ppc64el)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#glibc

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Balint Reczey (rbalint) wrote :
Download full text (3.8 KiB)

Tested 2.31-0ubuntu9.1 on Focal:

root@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@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@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@ff-gfortran:~# gfortran -O3 -mavx2 vect_test.f90 -o test.x
root@ff-gfortran:~# nm ./test.x | grep sin
                 U sin@@GLIBC_2.2.5
                 U sinf@@GLIBC_2.2.5
root@ff-gfortran:~# sed -i 's/backports/proposed/' /etc/apt/sources.list
root@ff-gfortran:~# apt update -qq
48 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@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) .....

Read more...

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glibc - 2.31-0ubuntu9.1

---------------
glibc (2.31-0ubuntu9.1) focal; urgency=medium

  [ Michael Hudson-Doyle ]
  * Mark tst-getpw as XFAIL on arm64. (LP: #1869364)

  [ Matthias Klose ]
  * Copy the fully conditionalized x86 variant for math-vector-fortran.h
    to /usr/include/finclude. On all architectures. (LP: #1879092)

  [ Balint Reczey ]
  * debian/gbp.conf: Add initial configuration
  * debian/control.in/main: Add Vcs-* pointing to Ubuntu packaging repository
  * debian/debhelper.in/libc.preinst: Fix setting LDCONFIG_NOTRIGGER
    (LP: #1889190)
  * Fall back to calling nanosleep syscall when __clock_nanosleep returns
    EINVAL due to CLOCK_REALTIME not being supported (LP: #1871129)
  * debian/testsuite-xfail-debian.mk: XFAIL tst-getpw on armhf, too
    (LP: #1869364)
  * XFAIL stdlib/tst-getrandom (LP: #1891403)

  [ Dimitri John Ledkov ]
  * debian/patches/powerpc: Cherrypick upstream patches to support POWER10
    optimized library loading. LP: #1887989

 -- Balint Reczey <email address hidden> Mon, 17 Aug 2020 22:02:52 +0200

Changed in glibc (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for glibc has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

tags: added: fr-153
Changed in gcc-10 (Ubuntu):
status: New → Fix Released
Changed in gcc-10 (Ubuntu Focal):
status: New → Fix Released
Changed in gcc-10 (Ubuntu Groovy):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.