Skip to content

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

Closed as not planned
@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 5.2878265 0.701558948
Grace 1.0241077 0.304776996
Xeon 1.4631462 0.285580993

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