Thanks @septc ! Yeah, uhm, well I just try to do the same thing as @certik did in that thread, his code is,
program avx
implicit none
integer, parameter :: dp = kind(0.d0)
real(dp) :: t1, t2, r
call cpu_time(t1)
r = f(100000000)
call cpu_time(t2)
print *, "Time", t2-t1
print *, r
contains
real(dp) function f(N) result(r)
integer, intent(in) :: N
integer :: i
r = 0
do i = 1, N
r = r + sin(real(i,dp))
end do
end function
end program
If I do
r = sum(sin(dble([(i,i=1,N)])))
it is two times faster than using MKL’s vdsin as below
call vdsin(N,(dble([(i,i=1,N)])),j)
r = sum(j)