Skip to content

[Flang] Assignments for integer arrays with FORALL/WHERE are slower than GFortran #121129

Closed as not planned
@yus3710-fj

Description

@yus3710-fj

The execution of the following codes is slower than GFortran.

  • test.f90
subroutine dianfn008(lhs,rhs,n)
  integer :: rhs(:)
  integer :: lhs(:)
  integer i,n
  forall(i=1:n)
    lhs(i) = rhs(i)
  end forall
end subroutine
  • main.f90
implicit none

integer, parameter :: count = 10000
integer :: i,j,k,a1(100),a2(100)
real :: start_t, end_t
interface
  subroutine dianfn008(lhs,rhs)
    integer :: rhs(:)
    integer :: lhs(:)
  end subroutine
end interface

call cpu_time(start_t)
do i=1,count
  do j=1,count
    call dianfn008(a1,a2)
  end do
end do
call cpu_time(end_t)

print *, end_t - start_t
end
  • commands
$ flang -Ofast -mcpu=native test.f90 main.f90 && ./a.out # for A64FX/Grace
$ flang -Ofast -march=native test.f90 main.f90 && ./a.out # for Xeon
Flang [s] GFortran [s]
A64FX 3.5503642 2.57492518
Grace 0.7966712 0.821618974
Xeon 0.7875499 0.659658015

Metadata

Metadata

Assignees

No one assigned

    Labels

    flangFlang issues not falling into any other categoryperformancequestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions