2 #include <boost/program_options.hpp>
3 #include <boost/lexical_cast.hpp>
4 #include "artdaq/Application/TaskType.hh"
5 #include "artdaq/Application/RoutingMasterApp.hh"
6 #include "artdaq/ExternalComms/xmlrpc_commander.hh"
7 #include "artdaq/Application/MPI2/MPISentry.hh"
9 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
10 #include "cetlib/exception.h"
11 #include "artdaq/DAQdata/Globals.hh"
13 int main(
int argc,
char* argv[])
19 int const wanted_threading_level{ MPI_THREAD_FUNNELED };
21 MPI_Comm local_group_comm;
22 std::unique_ptr<artdaq::MPISentry> mpiSentry;
26 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::RoutingMasterTask, local_group_comm));
28 catch (cet::exception& errormsg)
30 TLOG_ERROR(
"RoutingMasterMain") << errormsg << TLOG_ENDL;
31 TLOG_ERROR(
"RoutingMasterMain") <<
"MPISentry error encountered in RoutingMasterMain; exiting..." << TLOG_ENDL;
37 std::string usage = std::string(argv[0]) +
" -p port_number -n name <other-options>";
38 boost::program_options::options_description desc(usage);
41 (
"port,p", boost::program_options::value<unsigned short>(),
"Port number")
42 (
"name,n", boost::program_options::value<std::string>(),
"Application Nickname")
43 (
"help,h",
"produce help message");
45 boost::program_options::variables_map vm;
48 boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).run(), vm);
49 boost::program_options::notify(vm);
51 catch (boost::program_options::error
const& e)
53 TLOG_ERROR(
"Option") <<
"exception from command line processing in " << argv[0] <<
": " << e.what() << TLOG_ENDL;
59 std::cout << desc << std::endl;
63 if (!vm.count(
"port"))
65 TLOG_ERROR(
"Option") << argv[0] <<
" port number not supplied" << std::endl <<
"For usage and an options list, please do '" << argv[0] <<
" --help'" << TLOG_ENDL;
69 std::string name =
"RoutingMaster";
72 name = vm[
"name"].as<std::string>();
73 TLOG_DEBUG(name +
"Main") <<
"Setting application name to " << name << TLOG_ENDL;
77 TLOG_DEBUG(name +
"Main") <<
"artdaq version " <<
The MPISentry class initializes and finalizes the MPI context that the artdaq applciations run in...
int rank() const
Get the MPI rank of the application.
static artdaq::PackageBuildInfo getPackageBuildInfo()
Gets the version number and build timestmap for artdaq.
void configureMessageFacility(char const *progname, bool useConsole=true)
Configure and start the message facility. Provide the program name so that messages will be appropria...
The xmlrpc_commander class serves as the XMLRPC server run in each artdaq application.
void setMsgFacAppName(const std::string &appType, unsigned short port)
Set the message facility application name using the specified application type and port number...
RoutingMasterApp is an artdaq::Commandable derived class which controls the RoutingMasterCore state m...