Read the debug configuration into the debug type 'me' The debug definition is placed in the main level of the musubi.lua file It can look like
debug = {
debugMode = true, -- default= false
-- Use a logging object to track output in individual files.
-- The output messages to this logging object are usually
-- generated by tem_debug calls.
logging = { level = 1, -- how detailed should the log be?
filename = 'dbg', -- to which file to write the log
root_only = .false. } -- should only root write msgs?
debugFiles = true, -- default= false
-- What to dump into debugFiles? --
dumpTreeIDs = true, -- default= false
dumpPropBits = true, -- default= false
dumpAuxLists = true, -- default= false
dumpDependencies = true, -- default= false
dumpState = true, -- default= false
dumpHaloState = true, -- default= false
-- end debugFiles --
debugDependencies = true, -- default= false
checkDependencies = true, -- default= false
checkNans = true, -- default= false
checkSteps = true, -- default= false
debugMesh = 'dbg/mesh_', -- default= ''
debugSource = true, -- default= false
debugRestart = true, -- default= false
traceMemory = true, -- default= false
}
Possible Options are - active = {true, false}\n activate or deactivate the complete debug mode. If deactivated, all subsequent definitions are ignored
: Check the following reference
- [[tem_debug_module:tem_debug_type.debugFiles]] = {true, false}
open debug files. They can be accessed by writing to the unit dbgUnit.
the dbgUnit is given in the tem_debug_module and simply needs to be included
into the use statements
use tem_debug_module, only: dbgUnit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_debug_type) | :: | me | debug type to store information |
|||
type(flu_State) | :: | conf | lua state |
|||
integer, | intent(in) | :: | rank | Rank of the calling process |
subroutine tem_load_debug(me, conf, rank)
! ---------------------------------------------------------------------------
!> debug type to store information
type(tem_debug_type) :: me
!> lua state
type(flu_state) :: conf
!> Rank of the calling process
integer, intent(in) :: rank
! ---------------------------------------------------------------------------
integer :: myrank
integer :: tc_handle
integer :: log_tab
integer :: iError
! ---------------------------------------------------------------------------
! tables inside the boundary table
me%active = .false.
myrank = rank
! Read the number of trackings in the lua file
call aot_table_open( L = conf, thandle = tc_handle, key = 'debug' )
call aot_table_open( L = conf, &
& parent = tc_handle, &
& key = 'logging', &
& thandle = log_tab )
if (log_tab /= 0) then
call tem_logging_load( conf = conf, &
& thandle = log_tab, &
& rank = myrank, &
& me = me%logger )
else
! Deactivate the logging, if there is no configuration for it.
! (Setting root_only to true and rank to -1 results in non participating
! processes for all processes.)
call tem_logging_init( me = me%logger, &
& level = 0, &
& root_only = .true., &
& rank = -1 )
end if
call aot_table_close(L = conf, thandle = log_tab)
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%active, &
& ErrCode = iError, &
& key = 'debugMode', &
& default = .false. )
if( me%active ) then
write(logUnit(1),*)
write(logUnit(1),*) ' ******** DEBUG MODE ACTIVATED **********'
write(logUnit(1),*)
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%debugFiles, &
& ErrCode = iError, &
& key = 'debugFiles', &
& default = .false. )
if( me%debugFiles ) then
write(logUnit(1),*) 'Opening debug files for each process ...'
endif
if( me%debugFiles ) then
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpTreeIDlists, &
& ErrCode = iError, &
& key = 'dumpTreeIDs', &
& default = .false. )
if( me%dumpTreeIDlists ) then
write(logUnit(1),*)' Writing a complete level-wise dump of the treeIDs'&
& //' to debug file '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpPropBits, &
& ErrCode = iError, &
& key = 'dumpPropBits', &
& default = .false. )
if( me%dumpPropBits ) then
write(logUnit(1),*)' Writing a complete level-wise PropertyBits'// &
& ' to debug file '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpAuxLists, &
& ErrCode = iError, &
& key = 'dumpAuxLists', &
& default = .false. )
if( me%dumpAuxLists ) then
write(logUnit(1),*)' Writing auxiliary lists to disk'//' to debug file '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpDependencies, &
& ErrCode = iError, &
& key = 'dumpDependencies', &
& default = .false. )
if( me%dumpDependencies ) then
write(logUnit(1),*) ' Writing dependencies to debug file '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpLevelwiseState, &
& ErrCode = iError, &
& key = 'dumpState', &
& default = .false. )
if( me%dumpLevelwiseState ) then
write(logUnit(1),*)' Writing state vector level-wise for each element' &
& //' to disk, also ghosts '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpHaloState, &
& ErrCode = iError, &
& key = 'dumpHaloState', &
& default = .true. )
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%debugDependencies, &
& ErrCode = iError, &
& key = 'debugDependencies', &
& default = .false. )
if( me%dumpDependencies ) then
write(logUnit(1),*) ' Debugging Dependencies: on'
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%checkDependencies, &
& ErrCode = iError, &
& key = 'checkDependencies', &
& default = .false. )
if( me%dumpDependencies ) then
write(logUnit(1),*) ' Check horizontal Dependencies: on '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%checkNaNs, &
& ErrCode = iError, &
& key = 'checkNans', &
& default = .false. )
if( me%checkNaNs ) then
write(logUnit(1),*) ' Checking for NaNs: on '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%checkEachAlgorithmicStep, &
& ErrCode = iError, &
& key = 'checkSteps', &
& default = .false. )
if( me%checkEachAlgorithmicStep ) then
write(logUnit(1),*)' Checking each algorithmic step and advancing time'//&
& ' afterwards '
endif
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%debugMesh, &
& ErrCode = iError, &
& key = 'debugMesh', &
& default = '' )
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpSource, &
& ErrCode = iError, &
& key = 'debugSource', &
& default = .false. )
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%debugRestart, &
& ErrCode = iError, &
& key = 'debugRestart', &
& default = .false. )
! Trace memory consumption?
! Must be done explicitely in the solvers
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%traceMemory, &
& ErrCode = iError, &
& key = 'traceMemory', &
& default = .false. )
if( me%traceMemory ) then
write(logUnit(1),*)' Tracing memory consumption (if implemented in the'//&
& ' solver) ... '
end if
call aot_get_val( L = conf, &
& thandle = tc_handle, &
& val = me%dumpBoundaries, &
& ErrCode = iError, &
& key = 'dumpBoundaries', &
& default = .false. )
! call tem_loadRestartConfig( controller = me%restart%controller, conf = conf, &
! key = 'debugStates', parent_table = tc_handle )
call aot_table_close(L=conf, thandle=tc_handle)
call tem_horizontalSpacer( fUnit = logUnit(1) )
end subroutine tem_load_debug