Quinoa all test code coverage report
Current view: top level - Main - InciterDriver.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 26 28 92.9 %
Date: 2021-11-09 15:14:18 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/Parser.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                 :        233 : 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                 :        233 :   InciterPrint print( cmdline.logname( def, nrestart ),
      46                 :        233 :                       cmdline.get< tag::verbose >() ? std::cout : std::clog,
      47         [ -  + ]:        233 :                       std::ios_base::app );
      48                 :            : 
      49 [ +  - ][ +  - ]:        466 :   print.item( "Non-blocking migration, -" + *kw::nonblocking::alias(),
         [ +  - ][ -  - ]
      50 [ +  - ][ +  - ]:        466 :                cmdline.get< tag::nonblocking >() ? "on" : "off" );
      51 [ +  - ][ +  - ]:        466 :   print.item( "Benchmark mode, -" + *kw::benchmark::alias(),
         [ +  - ][ -  - ]
      52 [ +  + ][ +  - ]:        412 :                cmdline.get< tag::benchmark >() ? "on" : "off" );
      53                 :            : 
      54                 :        233 :   auto lbfreq = cmdline.get< tag::lbfreq >();
      55         [ -  + ]:        233 :   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 [ +  - ][ +  - ]:        699 :   print.item( "Load-balancing frequency, -" + *kw::lbfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      60                 :        233 :                std::to_string(cmdline.get< tag::lbfreq >()) );
      61                 :            : 
      62                 :        233 :   auto rsfreq = cmdline.get< tag::rsfreq >();
      63         [ -  + ]:        233 :   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 [ +  - ][ +  - ]:        699 :   print.item( "Checkpoint/restart frequency, -" + *kw::rsfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      68         [ +  - ]:        233 :                std::to_string(cmdline.get< tag::rsfreq >()) );
      69                 :            : 
      70                 :            :   // Parse input deck into g_inputdeck
      71 [ +  - ][ +  - ]:        466 :   print.item( "Control file", cmdline.get< tag::io, tag::control >() );
                 [ +  - ]
      72                 :            :   g_inputdeck = g_inputdeck_defaults;   // overwrite with defaults if restarted
      73         [ +  - ]:        233 :   InputDeckParser inputdeckParser( print, cmdline, g_inputdeck );
      74 [ +  - ][ +  - ]:        466 :   print.item( "Parsed control file", "success" );
                 [ +  - ]
      75                 :            :   print.endpart();
      76                 :            : 
      77                 :            :   // Output command line object to file
      78 [ +  - ][ +  - ]:        233 :   auto logfilename = tk::inciter_executable() + "_input.log";
                 [ -  - ]
      79         [ +  - ]:        233 :   tk::Writer log( logfilename );
      80 [ +  - ][ +  - ]:        466 :   tk::print( log.stream(), "inputdeck", g_inputdeck );
      81                 :        233 : }
      82                 :            : 
      83                 :            : void
      84                 :        233 : InciterDriver::execute() const
      85                 :            : // *****************************************************************************
      86                 :            : //  Run inciter
      87                 :            : // *****************************************************************************
      88                 :            : {
      89                 :            :   // Instantiate Transporter chare on PE 0 which drives time-integration
      90                 :        233 :   CProxy_Transporter::ckNew( 0 );
      91                 :        233 : }

Generated by: LCOV version 1.14