Skip to content

[Flang] Assignments for arrays of a derived type are slower than GFortran #121127

Open
@yus3710-fj

Description

@yus3710-fj

The execution of the following codes is slower than GFortran.

  • test.f90
module d
  type mytype1
    integer :: x,y,z
  end type
end module

subroutine ddannn042(lhs,rhs)
  use d
  type(mytype1) :: rhs(:)
  type(mytype1) :: lhs(:)
  lhs = rhs
end subroutine
  • main.f90
use d
implicit none

integer, parameter :: count = 4000
integer :: i,j,k
type(mytype1) :: t1(100),t2(100)
real :: start_t, end_t
interface
  subroutine ddannn042(lhs,rhs)
    use d
    type(mytype1) :: rhs(:)
    type(mytype1) :: lhs(:)
  end subroutine
end interface

call cpu_time(start_t)
do i=1,count
  do j=1,count
    call ddannn042(t1,t2)
  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 205.93236 0.724337995
Grace 34.432254 0.307622015
Xeon 51.895687 0.285207003

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions