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-mpich-plugin/Application/MPISentry.hh"
10 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
11 #include "cetlib_except/exception.h"
13 int main(
int argc,
char* argv[])
17 int const wanted_threading_level{ MPI_THREAD_FUNNELED };
19 MPI_Comm local_group_comm;
20 std::unique_ptr<artdaq::MPISentry> mpiSentry;
24 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::DispatcherTask, local_group_comm));
26 catch (cet::exception& errormsg)
28 TLOG_ERROR(
"DispatcherMain") << errormsg ;
29 TLOG_ERROR(
"DispatcherMain") <<
"MPISentry error encountered in DispatcherMain; exiting..." ;
35 fhicl::TableFragment<artdaq::CommanderInterface::Config> commander_config;
36 fhicl::Atom<std::string> application_name{ fhicl::Name{
"application_name" }, fhicl::Comment{
"Name of the application for metrics and logging" },
"Dispatcher" };
37 fhicl::TableFragment<artdaq::PortManager::Config> portsConfig;
40 fhicl::ParameterSet config = LoadParameterSet<Config>(argc, argv,
"DispatcherMain",
"This is the Dispatcher's main executable (MPI version)");
41 app_name = config.get<std::string>(
"application_name",
"Dispatcher");
42 portMan->UpdateConfiguration(config);
45 TLOG_DEBUG(app_name +
"Main") <<
"Setting application name to " << mf_app_name ;
48 if (config.has_key(
"partition_number"))
54 TLOG_INFO(app_name +
"Main") <<
"artdaq version " <<
60 my_rank = mpiSentry->
rank();
63 auto commander = artdaq::MakeCommanderPlugin(config, disp_app);
64 TLOG_INFO(app_name +
"Main") <<
"Running Commmander Server" ;
65 commander->run_server();
66 artdaq::Globals::CleanUpGlobals();
67 TLOG_INFO(app_name +
"Main") <<
"Commandable Server ended, exiting..." ;
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()
std::string getBuildTimestamp() const
std::string getPackageVersion() const
void configureMessageFacility(char const *progname, bool useConsole=true, bool printDebug=false)
std::string setMsgFacAppName(const std::string &appType, unsigned short port)
static int partition_number_