Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/Main/WalkerDriver.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 WalkerDriver that drives Walker 9 : : \details WalkerDriver that drives Walker 10 : : */ 11 : : // ***************************************************************************** 12 : : 13 : : #include "Tags.hpp" 14 : : #include "WalkerPrint.hpp" 15 : : #include "WalkerDriver.hpp" 16 : : #include "Walker/InputDeck/Parser.hpp" 17 : : #include "Walker/CmdLine/CmdLine.hpp" 18 : : #include "Walker/InputDeck/InputDeck.hpp" 19 : : #include "TaggedTupleDeepPrint.hpp" 20 : : #include "Writer.hpp" 21 : : 22 : : #include "NoWarning/distributor.decl.h" 23 : : 24 : : namespace walker { 25 : : 26 : : extern ctr::InputDeck g_inputdeck; 27 : : extern CProxy_Distributor g_DistributorProxy; 28 : : 29 : : } // walker:: 30 : : 31 : : using walker::WalkerDriver; 32 : : 33 : 93 : WalkerDriver::WalkerDriver( const ctr::CmdLine& cmdline, int nrestart ) 34 : : // ***************************************************************************** 35 : : // Constructor 36 : : //! \param[in] cmdline Command line object storing data parsed from the command 37 : : //! line arguments 38 : : //! \param[in] nrestart Number of times restarted 39 : : // ***************************************************************************** 40 : : { 41 : : // All global-scope data to be migrated to all PEs initialized here (if any) 42 : : 43 : : // Create pretty printer 44 : : const auto& def = 45 : 93 : g_inputdeck_defaults.get< tag::cmd, tag::io, tag::screen >(); 46 [ + - ]: 93 : WalkerPrint print( cmdline.logname( def, nrestart ), 47 : 93 : cmdline.get< tag::verbose >() ? std::cout : std::clog, 48 [ + - ][ + - ]: 279 : std::ios_base::app ); 49 : : 50 : : // Parse input deck into g_inputdeck 51 [ + - ][ + - ]: 93 : print.item( "Control file", cmdline.get< tag::io, tag::control >() ); 52 [ + - ]: 186 : InputDeckParser inputdeckParser( print, cmdline, g_inputdeck ); 53 [ + - ][ + - ]: 93 : print.item( "Parsed control file", "success" ); 54 [ + - ]: 93 : print.endpart(); 55 : : 56 : : // Output command line object to file 57 [ + - ][ + - ]: 186 : auto logfilename = tk::walker_executable() + "_input.log"; 58 [ + - ]: 93 : tk::Writer log( logfilename ); 59 [ + - ][ + - ]: 93 : tk::print( log.stream(), "inputdeck", g_inputdeck ); 60 : : 61 : : // Instantiate Distributor chare on PE 0 which drives the time-integration of 62 : : // differential equations via several integrator chares. We only support a 63 : : // single type of Distributor class at this point, so no factory 64 : : // instantiation, simply fire up a Charm++ chare Distributor, which fires up 65 : : // integrators. Store proxy handle in global-scope to make it available to 66 : : // individual integrators so they can call back to Distributor. Since this 67 : : // is called inside the main chare constructor, the Charm++ runtime system 68 : : // distributes the handle along with all other global-scope data. 69 [ + - ][ + - ]: 93 : g_DistributorProxy = CProxy_Distributor::ckNew( 0 ); 70 : 93 : }