Closed as not planned
Closed as not planned
Description
The execution of the following codes is slower than GFortran.
- test.f90
module d
type mytype1
integer :: x,y,z
end type
type mytype2
integer :: x,y
type(mytype1) :: t
end type
interface assignment(=)
module procedure :: swap
end interface
contains
pure subroutine swap(lhs,rhs)
type(mytype2), intent(in) :: rhs
type(mytype2), intent(out) :: lhs
lhs%x = rhs%y
lhs%y = rhs%x
lhs%t = rhs%t
end subroutine
end module
subroutine ddsnnn005(lhs,rhs)
use d
type(mytype2) :: rhs
type(mytype2) :: lhs
lhs = rhs
end subroutine
- main.f90
use d
implicit none
integer, parameter :: count = 10000
integer :: i,j,k
type(mytype2) :: t1,t2
real :: start_t, end_t
interface
subroutine ddsnnn005(lhs,rhs)
use d
type(mytype2) :: rhs
type(mytype2) :: lhs
end subroutine
end interface
call cpu_time(start_t)
do i=1,count
do j=1,count
call ddsnnn005(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 | 26.61019 | 0.325082988 |
Grace | 4.2784247 | 0.0608319975 |
Xeon | 5.6451816 | 0.107244000 |