Quinoa all test code coverage report
Current view: top level - Main - InciterDriver.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 29 31 93.5 %
Date: 2024-11-22 08:51:48 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 36 82 43.9 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Main/InciterDriver.cpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Inciter driver
       9                 :            :   \details   Inciter driver.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include "InciterPrint.hpp"
      14                 :            : #include "InciterDriver.hpp"
      15                 :            : #include "Inciter/InputDeck/LuaParser.hpp"
      16                 :            : #include "Inciter/CmdLine/CmdLine.hpp"
      17                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      18                 :            : #include "TaggedTupleDeepPrint.hpp"
      19                 :            : #include "Writer.hpp"
      20                 :            : 
      21                 :            : #include "NoWarning/transporter.decl.h"
      22                 :            : 
      23                 :            : namespace inciter {
      24                 :            : 
      25                 :            : extern ctr::InputDeck g_inputdeck;
      26                 :            : extern ctr::InputDeck g_inputdeck_defaults;
      27                 :            : 
      28                 :            : } // inciter::
      29                 :            : 
      30                 :            : using inciter::InciterDriver;
      31                 :            : 
      32                 :        189 : InciterDriver::InciterDriver( const ctr::CmdLine& cmdline, int nrestart )
      33                 :            : // *****************************************************************************
      34                 :            : //  Constructor
      35                 :            : //! \param[in] cmdline Command line object storing data parsed from the command
      36                 :            : //!   line arguments
      37                 :            : //! \param[in] nrestart Number of times restarted
      38                 :            : // *****************************************************************************
      39                 :            : {
      40                 :            :   // All global-scope data to be migrated to all PEs initialized here (if any)
      41                 :            : 
      42                 :            :   // Create pretty printer
      43                 :            :   const auto& def =
      44                 :        189 :     g_inputdeck_defaults.get< tag::cmd, tag::io, tag::screen >();
      45         [ +  - ]:        189 :   InciterPrint print( cmdline.logname( def, nrestart ),
      46                 :        189 :                       cmdline.get< tag::verbose >() ? std::cout : std::clog,
      47 [ +  - ][ +  - ]:        567 :                       std::ios_base::app );
      48                 :            : 
      49 [ +  - ][ +  - ]:        189 :   print.item( "Non-blocking migration, -" + *kw::nonblocking::alias(),
      50 [ -  + ][ +  - ]:        189 :                cmdline.get< tag::nonblocking >() ? "on" : "off" );
      51 [ +  - ][ +  - ]:        189 :   print.item( "Benchmark mode, -" + *kw::benchmark::alias(),
      52 [ +  + ][ +  - ]:        189 :                cmdline.get< tag::benchmark >() ? "on" : "off" );
      53                 :            : 
      54                 :        189 :   auto lbfreq = cmdline.get< tag::lbfreq >();
      55 [ +  - ][ -  + ]:        189 :   if ( lbfreq < kw::lbfreq::info::expect::lower ||
      56                 :            :        lbfreq > kw::lbfreq::info::expect::upper ) {
      57 [ -  - ][ -  - ]:          0 :     Throw( "Load-balancing frequency should be greater than 0." );
                 [ -  - ]
      58                 :            :   }
      59 [ +  - ][ +  - ]:        189 :   print.item( "Load-balancing frequency, -" + *kw::lbfreq::alias(),
                 [ +  - ]
      60         [ +  - ]:        378 :                std::to_string(cmdline.get< tag::lbfreq >()) );
      61                 :            : 
      62                 :        189 :   auto rsfreq = cmdline.get< tag::rsfreq >();
      63 [ +  - ][ -  + ]:        189 :   if ( rsfreq < kw::rsfreq::info::expect::lower ||
      64                 :            :        rsfreq > kw::rsfreq::info::expect::upper ) {
      65 [ -  - ][ -  - ]:          0 :     Throw( "Checkpoint/restart frequency should be greater than 0." );
                 [ -  - ]
      66                 :            :   }
      67 [ +  - ][ +  - ]:        189 :   print.item( "Checkpoint/restart frequency, -" + *kw::rsfreq::alias(),
                 [ +  - ]
      68         [ +  - ]:        378 :                std::to_string(cmdline.get< tag::rsfreq >()) );
      69                 :            : 
      70                 :            :   // Parse input deck into g_inputdeck
      71 [ +  - ][ +  - ]:        189 :   print.item( "Control file", cmdline.get< tag::io, tag::control >() );
      72         [ +  - ]:        189 :   g_inputdeck = g_inputdeck_defaults;   // overwrite with defaults if restarted
      73                 :            : 
      74         [ +  - ]:        378 :   LuaParser luaparser( print, cmdline, g_inputdeck );
      75 [ +  - ][ +  - ]:        189 :   print.item( "Parsed lua file", "success" );
      76                 :            : 
      77         [ +  - ]:        189 :   print.endpart();
      78                 :            : 
      79                 :            :   // Output command line object to file
      80 [ +  - ][ +  - ]:        378 :   auto logfilename = tk::inciter_executable() + "_input.log";
      81         [ +  - ]:        189 :   tk::Writer log( logfilename );
      82 [ +  - ][ +  - ]:        189 :   tk::print( log.stream(), "inputdeck", g_inputdeck );
      83                 :        189 : }
      84                 :            : 
      85                 :            : void
      86                 :        187 : InciterDriver::execute() const
      87                 :            : // *****************************************************************************
      88                 :            : //  Run inciter
      89                 :            : // *****************************************************************************
      90                 :            : {
      91                 :            :   // Instantiate Transporter chare on PE 0 which drives time-integration
      92                 :        187 :   CProxy_Transporter::ckNew( 0 );
      93                 :        187 : }

Generated by: LCOV version 1.14