incomp-flame-post/code/benchmark_transpose.f90
ignis 78fbedc9a1
All checks were successful
CI Test Suite / run-tests (push) Successful in 1m14s
Deploy Documentation / build-and-deploy (push) Successful in 56s
feat: implement transpose block size auto-tuning and benchmark
- Added benchmark_transpose.f90 to measure blocked transpose performance.
- Added tune_blocksize.py to auto-detect grid sizes, benchmark valid block size candidates, and apply the optimal value.
- Updated makefile to support benchmark targets and default BLOCKSIZE=16 based on autotuning.
- Saved tuning results and system specifications to tuning_results.md.
2026-06-05 13:25:17 +00:00

73 lines
1.5 KiB
Fortran

program benchmark_transpose
use m_parameters
use m_calculate
implicit none
real*8, allocatable, dimension(:,:,:) :: aaa, bbb
integer :: ierr, iter, num_iters
real*8 :: t1, t2
character(len=32) :: arg
! Read command-line arguments for grid sizes
if (command_argument_count() >= 3) then
call get_command_argument(1, arg)
read(arg, *) nxp
call get_command_argument(2, arg)
read(arg, *) nyp
call get_command_argument(3, arg)
read(arg, *) nzp
else
! Default matching test_calculate
nxp = 512
nyp = 256
nzp = 256
end if
! Read iteration count
num_iters = 10
if (command_argument_count() >= 4) then
call get_command_argument(4, arg)
read(arg, *) num_iters
end if
l_0 = 2.0
hyp = l_0 * pi / REAL(nyp)
hxp = hyp
hzp = hyp
allocate(aaa(nxp, nyp, nzp), stat=ierr)
if (ierr /= 0) then
print *, "Error allocating array aaa"
stop 1
end if
allocate(bbb(nxp, nyp, nzp), stat=ierr)
if (ierr /= 0) then
print *, "Error allocating array bbb"
stop 1
end if
! Initialize dummy data
call random_number(aaa)
call m_calculate_init
! Warmup run
call ddx(bbb, aaa)
! Benchmark runs
call cpu_time(t1)
do iter = 1, num_iters
call ddx(bbb, aaa)
end do
call cpu_time(t2)
! Print execution time per call in seconds
print '(F10.6)', (t2 - t1) / num_iters
call m_calculate_finalize
deallocate(aaa)
deallocate(bbb)
end program benchmark_transpose