Quinoa all test code coverage report
Current view: top level - Main - InciterDriver.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 26 28 92.9 %
Date: 2024-04-29 14:42:33 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 37 110 33.6 %

           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                 :        195 : 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                 :            :     g_inputdeck_defaults.get< tag::cmd, tag::io, tag::screen >();
      45                 :        195 :   InciterPrint print( cmdline.logname( def, nrestart ),
      46                 :        195 :                       cmdline.get< tag::verbose >() ? std::cout : std::clog,
      47         [ -  + ]:        195 :                       std::ios_base::app );
      48                 :            : 
      49 [ +  - ][ +  - ]:        390 :   print.item( "Non-blocking migration, -" + *kw::nonblocking::alias(),
         [ +  - ][ -  - ]
      50 [ +  - ][ +  - ]:        390 :                cmdline.get< tag::nonblocking >() ? "on" : "off" );
      51 [ +  - ][ +  - ]:        390 :   print.item( "Benchmark mode, -" + *kw::benchmark::alias(),
         [ +  - ][ -  - ]
      52 [ +  + ][ +  - ]:        318 :                cmdline.get< tag::benchmark >() ? "on" : "off" );
      53                 :            : 
      54                 :        195 :   auto lbfreq = cmdline.get< tag::lbfreq >();
      55         [ -  + ]:        195 :   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 [ +  - ][ +  - ]:        585 :   print.item( "Load-balancing frequency, -" + *kw::lbfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      60                 :        195 :                std::to_string(cmdline.get< tag::lbfreq >()) );
      61                 :            : 
      62                 :        195 :   auto rsfreq = cmdline.get< tag::rsfreq >();
      63         [ -  + ]:        195 :   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 [ +  - ][ +  - ]:        585 :   print.item( "Checkpoint/restart frequency, -" + *kw::rsfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      68         [ +  - ]:        195 :                std::to_string(cmdline.get< tag::rsfreq >()) );
      69                 :            : 
      70                 :            :   // Parse input deck into g_inputdeck
      71 [ +  - ][ +  - ]:        390 :   print.item( "Control file", cmdline.get< tag::io, tag::control >() );
                 [ +  - ]
      72                 :            :   g_inputdeck = g_inputdeck_defaults;   // overwrite with defaults if restarted
      73                 :            : 
      74         [ +  - ]:        195 :   LuaParser luaparser( print, cmdline, g_inputdeck );
      75 [ +  - ][ +  - ]:        390 :   print.item( "Parsed lua file", "success" );
                 [ +  - ]
      76                 :            : 
      77                 :            :   print.endpart();
      78                 :            : 
      79                 :            :   // Output command line object to file
      80 [ +  - ][ +  - ]:        195 :   auto logfilename = tk::inciter_executable() + "_input.log";
                 [ -  - ]
      81         [ +  - ]:        195 :   tk::Writer log( logfilename );
      82 [ +  - ][ +  - ]:        390 :   tk::print( log.stream(), "inputdeck", g_inputdeck );
      83                 :        195 : }
      84                 :            : 
      85                 :            : void
      86                 :        193 : InciterDriver::execute() const
      87                 :            : // *****************************************************************************
      88                 :            : //  Run inciter
      89                 :            : // *****************************************************************************
      90                 :            : {
      91                 :            :   // Instantiate Transporter chare on PE 0 which drives time-integration
      92                 :        193 :   CProxy_Transporter::ckNew( 0 );
      93                 :        193 : }

Generated by: LCOV version 1.14