Skip to content

Add initial benchmark for fftpack #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions example/bench1.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
program bench1
use fftpack, only: zffti, zfftf, zfftb
implicit none
integer, parameter :: dp = kind(0.d0)
complex(dp), allocatable :: z(:)
real(dp), allocatable :: w(:), x(:)
real(dp) :: err, time_init, time_forward, time_backward, t1, t2
integer :: N

N = 1024*1014*16

allocate(x(N), z(N), w(4*N+15))
call random_number(x)
z = x

print *, "Initializing"
call cpu_time(t1)
call zffti(N, w)
call cpu_time(t2)
time_init = t2-t1

print *, "Forward"
call cpu_time(t1)
call zfftf(N, z, w)
call cpu_time(t2)
time_forward = t2-t1

print *, "Backward"
call cpu_time(t1)
call zfftb(N, z, w)
call cpu_time(t2)
time_backward = t2-t1
print *, "Done"

err = maxval(abs(x-real(z/N,dp)))
print *
print *, "Error: ", err
print *, "Init time: ", time_init
print *, "Forward time: ", time_forward
print *, "Backward time: ", time_backward
end program
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["netlib", "fftpack", "fft"]
[build]
auto-executables = false
auto-tests = false
auto-examples = false
auto-examples = true

# Original test
[[test]]
Expand Down