1 #include "artdaq/DAQdata/Globals.hh"
2 #include "artdaq/Application/TaskType.hh"
3 #include "artdaq/Application/BoardReaderApp.hh"
4 #include "artdaq-mpich-plugin/Application/MPISentry.hh"
5 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh"
6 #include "artdaq/Application/LoadParameterSet.hh"
7 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
8 #include "cetlib_except/exception.h"
10 #include <boost/program_options.hpp>
11 #include <boost/lexical_cast.hpp>
16 int main(
int argc,
char* argv[])
20 int const wanted_threading_level{ MPI_THREAD_FUNNELED };
22 MPI_Comm local_group_comm;
23 std::unique_ptr<artdaq::MPISentry> mpiSentry;
27 mpiSentry.reset(
new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::BoardReaderTask, local_group_comm));
29 catch (cet::exception& errormsg)
31 TLOG_ERROR(
"BoardReaderMain") << errormsg ;
32 TLOG_ERROR(
"BoardReaderMain") <<
"MPISentry error encountered in BoardReaderMain; exiting..." ;
39 fhicl::TableFragment<artdaq::CommanderInterface::Config> commander_config;
40 fhicl::Atom<std::string> application_name{ fhicl::Name{
"application_name" }, fhicl::Comment{
"Name of the application for metrics and logging" },
"BoardReader" };
43 fhicl::ParameterSet config_ps = LoadParameterSet<Config>(argc, argv,
"BoardReaderMain",
"This is the BoardReader's main executable (MPI version)");
44 app_name = config_ps.get<std::string>(
"application_name",
"BoardReader");
45 std::string mf_app_name = artdaq::setMsgFacAppName(app_name, config_ps.get<
int>(
"id"));
46 artdaq::configureMessageFacility(mf_app_name.c_str());
47 TLOG_DEBUG(app_name +
"Main") <<
"Setting application name to " << mf_app_name ;
50 if (config_ps.has_key(
"partition_number"))
52 artdaq::Globals::partition_number_ = config_ps.get<
int>(
"partition_number");
54 TLOG_DEBUG(app_name +
"Main") <<
"Setting partition number to " << artdaq::Globals::partition_number_;
56 TLOG_INFO(app_name +
"Main") <<
"artdaq version " <<
57 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getPackageVersion()
59 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp() ;
62 my_rank = mpiSentry->
rank();
63 artdaq::BoardReaderApp br_app;
65 auto commander = artdaq::MakeCommanderPlugin(config_ps, br_app);
66 TLOG_INFO(app_name +
"Main") <<
"Running Commmander Server" ;
67 commander->run_server();
68 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.