2 #include <boost/program_options.hpp>
3 #include <boost/lexical_cast.hpp>
4 #include "artdaq/Application/TaskType.hh"
5 #include "artdaq/DAQdata/Globals.hh"
6 #include "artdaq/Application/DispatcherApp.hh"
7 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh"
8 #include "artdaq/Application/LoadParameterSet.hh"
9 #include "artdaq/Application/MPI2/MPISentry.hh"
11 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
12 #include "cetlib_except/exception.h"
14 int main(
int argc,
char* argv[])
18 int const wanted_threading_level{ MPI_THREAD_FUNNELED };
20 MPI_Comm local_group_comm;
21 std::unique_ptr<artdaq::MPISentry> mpiSentry;
25 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::AggregatorTask, local_group_comm));
27 catch (cet::exception& errormsg)
29 TLOG_ERROR(
"DispatcherMain") << errormsg << TLOG_ENDL;
30 TLOG_ERROR(
"DispatcherMain") <<
"MPISentry error encountered in DispatcherMain; exiting..." << TLOG_ENDL;
34 fhicl::ParameterSet config = LoadParameterSet(argc, argv);
35 app_name = config.get<std::string>(
"application_name",
"Dispatcher");
36 std::string mf_app_name = artdaq::setMsgFacAppName(app_name, config.get<
int>(
"id"));
37 artdaq::configureMessageFacility(mf_app_name.c_str());
38 TLOG_DEBUG(app_name +
"Main") <<
"Setting application name to " << mf_app_name << TLOG_ENDL;
41 TLOG_INFO(app_name +
"Main") <<
"artdaq version " <<
50 TLOG_INFO(app_name +
"Main") <<
"Running Commmander Server" << TLOG_ENDL;
51 commander->run_server();
52 TLOG_INFO(app_name +
"Main") <<
"Commandable Server ended, exiting..." << TLOG_ENDL;
DispatcherApp is an artdaq::Commandable derived class which controls the DispatcherCore.
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.
std::unique_ptr< artdaq::CommanderInterface > MakeCommanderPlugin(const fhicl::ParameterSet &commander_pset, artdaq::Commandable &commandable)
Load a CommanderInterface plugin.