tem_load_debug Subroutine

public subroutine tem_load_debug(me, conf, rank)

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

     use tem_debug_module, only: dbgUnit
  • tem_write_debugMesh = {true, false}
  • unit = {integer} debug unit to write to
  • checkEachAlgorithmicStep = {true, false} output debug output after each step in compute
  • dumpLevelwiseState = {true, false} write element state information to the debugFiles
  • dumpHaloState = {true, false} write halo state information to the debugFiles
  • tem_dumpTreeIDlists = {true, false} write all the treeIDs fluid, ghost, halo for each level in a nice way to the debug files
  • dumpPropBits = {true, false} write all the property bits to disk for all elements
  • dumpDependencies = {true, false} write the dependencies of the ghost elements to disk
  • checkDependencies = {true, false} check if the dependencies are correct by cross checking
  • dumpAuxLists = {true, false} write the auxiliary lists to the debug file, such as boundary element lists
  • dumpState = {true, false} write the contents of the state vectors to the debug file for all the elements of a process
  • dumpSource = {true, false} write out source debug statements to debug unit
  • dumpRestart = {true, false} write out restart debug info
  • traceMemory = {true, false} trace memory consumption
  • checkNaNs = {true, false} check the state array for NaNs

Arguments

Type IntentOptional AttributesName
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


Calls

proc~~tem_load_debug~~CallsGraph proc~tem_load_debug tem_load_debug proc~aot_table_open aot_table_open proc~tem_load_debug->proc~aot_table_open interface~tem_logging_init tem_logging_init proc~tem_load_debug->interface~tem_logging_init proc~aot_table_close aot_table_close proc~tem_load_debug->proc~aot_table_close proc~tem_logging_load tem_logging_load proc~tem_load_debug->proc~tem_logging_load interface~aot_get_val aot_get_val proc~tem_load_debug->interface~aot_get_val proc~tem_horizontalspacer tem_horizontalSpacer proc~tem_load_debug->proc~tem_horizontalspacer proc~tem_logging_init_primary tem_logging_init_primary interface~tem_logging_init->proc~tem_logging_init_primary proc~tem_logging_init_logger tem_logging_init_logger interface~tem_logging_init->proc~tem_logging_init_logger interface~aot_get_val~2 aot_get_val proc~tem_logging_load->interface~aot_get_val~2 proc~tem_logging_load->proc~tem_logging_init_primary proc~tem_logging_load->proc~tem_logging_init_logger proc~tem_logging_init_primary->proc~tem_logging_init_logger proc~tem_connect_tonull tem_connect_toNull proc~tem_logging_init_logger->proc~tem_connect_tonull proc~newunit newunit proc~tem_logging_init_logger->proc~newunit proc~tem_connect_tonull->proc~newunit

Called by

proc~~tem_load_debug~~CalledByGraph proc~tem_load_debug tem_load_debug proc~tem_debug_load_main tem_debug_load_main proc~tem_debug_load_main->proc~tem_load_debug

Contents

Source Code


Source Code

  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