Skip to content

Commit

Permalink
Add reframe exx_runonly test and write output to screen for reframe b…
Browse files Browse the repository at this point in the history
…enchmarks

Add exx timers to perflog
  • Loading branch information
connoraird committed May 17, 2024
1 parent 261b687 commit f4b5057
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 19 deletions.
125 changes: 125 additions & 0 deletions benchmarks/reframe/exx_runonly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Import modules from reframe and excalibur-tests
import reframe as rfm
import reframe.utility.sanity as sn

class ConquestBaseBenchmark(rfm.RunOnlyRegressionTest):

# Run configuration
## Mandatory ReFrame setup
valid_systems = ['-gpu']
valid_prog_environs = ['default']

## Executable
executable_opts = ['']

## Scheduler options
time_limit = '30m'

conquest_base_dir = variable(str, value='foo')

@run_after('setup')
def setup_variables(self):
self.executable = f"{self.conquest_base_dir}/bin/Conquest"
self.num_cpus_per_task = self.num_cpus_per_task_param
self.env_vars['OMP_NUM_THREADS'] = f'{self.num_cpus_per_task}'

if self.current_partition.scheduler.registered_name == 'sge':
# `self.num_tasks` or `self.num_cpus_per_task` may be `None`, here
# we default to `1` if not set.
num_tasks = self.num_tasks or 1
num_cpus_per_task = self.num_cpus_per_task or 1
# Set the total number of CPUs to be requested for the SGE scheduler.
# Set to a full node size to reduce runtime variance.
self.extra_resources['mpi'] = {'num_slots': self.current_partition.processor.num_cpus} #num_tasks * num_cpus_per_task}

@sanity_function
def validate_solution(self):
return sn.assert_found(r'Total run time was:.*', self.stdout)

@performance_function('s', perf_key='Runtime')
def extract_runtime_perf(self):
return sn.extractsingle(r'Total run time was:\s+(\S+)\s+seconds', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_setup_runtime')
def extract_exx_setup_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_setup time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_fetch_runtime')
def extract_exx_fetch_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_fetch time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_evalpao_runtime')
def extract_exx_evalpao_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_evalpao time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_poisson_runtime')
def extract_exx_poisson_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_poisson time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_accumul_runtime')
def extract_exx_accumul_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_accumul time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_allocat_runtime')
def extract_exx_allocat_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_allocat time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_dealloc_runtime')
def extract_exx_dealloc_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_dealloc time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_kernel_runtime')
def extract_exx_kernel_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_kernel time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('s', perf_key='exx_exx_total_runtime')
def extract_exx_total_runtime_perf(self):
return sn.extractsingle(r'Time spent in exx_total time:\s=\s+(\S+)\s+s', self.stdout, 1, float)

@performance_function('MB', perf_key='Memory')
def extract_memory_perf(self):
return sn.extractsingle(r'Max total mem use is\s+(\S+)\s+MB', self.stdout, 1, float)

@rfm.simple_test
class test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0_4_SCF(ConquestBaseBenchmark):

tags = {"test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0.4_SCF"}
num_tasks = 2
num_cpus_per_task_param = parameter([1,2,4,8])

@run_before('run')
def get_input(self):
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0.4_SCF/C_PBE_SZP_CQ.ion .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0.4_SCF/Conquest_coord .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0.4_SCF/Conquest_input .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0ERI_fullSZP_0.4_SCF/H_PBE_SZP_CQ.ion .")

@rfm.simple_test
class test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0_2(ConquestBaseBenchmark):

tags = {"test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0.2"}
num_tasks = 2
num_cpus_per_task_param = parameter([1,2,4,8])

@run_before('run')
def get_input(self):
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0.2/C_PBE_DZP_CQ.ion .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0.2/Conquest_coord .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0.2/Conquest_input .")
self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/test_EXX_isol_C2H4_4proc_PBE0CRI_fullDZP_0.2/H_PBE_DZP_CQ.ion .")

# @rfm.simple_test
# class Water64(ConquestBaseBenchmark):

# tags = {"water64"}
# num_tasks = 8
# num_cpus_per_task = 4

# @run_before('run')
# def get_input(self):
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/Conquest_input .")
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/H2O_coord.in .")
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/H_SZ.ion .")
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/H_SZP.ion .")
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/O_SZ.ion .")
# self.prerun_cmds.append(f"cp {self.conquest_base_dir}/benchmarks/water_64mols/O_SZP.ion .")
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
IO.Title isolated C2H4 with PBE0
IO.Coordinates Conquest_coord
IO.FractionalCoordinates T
IO.Iprint 1
IO.Iprint 0
IO.WriteOutToFile F
IO.Iprint_exx 4
IO.TimingOn T

## General Parameters
General.NumberOfSpecies 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ IO.Title isolated C2H4 with PBE0
IO.Coordinates Conquest_coord
IO.FractionalCoordinates T
IO.Iprint 0
IO.WriteOutToFile F
IO.Iprint_exx 4
IO.TimingOn T

## General Parameters
General.NumberOfSpecies 2
Expand Down
43 changes: 25 additions & 18 deletions src/exx_kernel_default.f90
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ subroutine get_X_matrix( exxspin, scheme, backup_eris, niter, siter, level )
use exx_poisson, only: exx_scal_rho_3d, exx_ewald_rho, exx_ewald_pot
use exx_types, only: isf_order, ngrid
!
use input_module, only: fdf_boolean
!
!**<lat>** ISF Poisson solver Will be available in the forthcoming version
!use Poisson_Solver, only: createBeylkin
!
Expand Down Expand Up @@ -212,24 +214,29 @@ subroutine get_X_matrix( exxspin, scheme, backup_eris, niter, siter, level )
!
if ( iprint_exx > 3 ) then
!
if ( (niter == 1 .and. scheme == 3) .or. (niter == siter + 1 .and. (scheme == 1 .or. scheme == 2 ) )) then
call io_assign(unit_timers_write)
call get_file_name('exx_timers',numprocs,inode,file_exx_timers)
open(unit_timers_write,file=file_exx_timers)
!
call io_assign(unit_memory_write)
call get_file_name('exx_memory',numprocs,inode,file_exx_memory)
open(unit_memory_write,file=file_exx_memory)
!
else

!inquire(file=filename3, exist=exist)
!if ( exist ) then
open(unit_timers_write,file=file_exx_timers,status='old', position='append')
open(unit_memory_write,file=file_exx_memory,status='old', position='append')
!else
! open(unit_timers_write,file=filename3,status='new')
!end if
if (fdf_boolean('IO.WriteOutToFile',.true.)) then
if ( (niter == 1 .and. scheme == 3) .or. (niter == siter + 1 .and. (scheme == 1 .or. scheme == 2 ) )) then
call io_assign(unit_timers_write)
call get_file_name('exx_timers',numprocs,inode,file_exx_timers)
open(unit_timers_write,file=file_exx_timers)
!
call io_assign(unit_memory_write)
call get_file_name('exx_memory',numprocs,inode,file_exx_memory)
open(unit_memory_write,file=file_exx_memory)
!
else

!inquire(file=filename3, exist=exist)
!if ( exist ) then
open(unit_timers_write,file=file_exx_timers,status='old', position='append')
open(unit_memory_write,file=file_exx_memory,status='old', position='append')
!else
! open(unit_timers_write,file=filename3,status='new')
!end if
end if
else
unit_timers_write = 6
unit_memory_write = 6
end if
!
end if
Expand Down

0 comments on commit f4b5057

Please sign in to comment.