$treeview $search $mathjax $extrastylesheet
artdaq_mpich_plugin
v1_00_06
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "artdaq/DAQdata/Globals.hh" 00002 #include "artdaq/Application/TaskType.hh" 00003 #include "artdaq/Application/BoardReaderApp.hh" 00004 #include "artdaq-mpich-plugin/Application/MPISentry.hh" 00005 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh" 00006 #include "artdaq/Application/LoadParameterSet.hh" 00007 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh" 00008 #include "cetlib_except/exception.h" 00009 00010 #include <boost/program_options.hpp> 00011 #include <boost/lexical_cast.hpp> 00012 00013 #include <iostream> 00014 #include <memory> 00015 00016 int main(int argc, char* argv[]) 00017 { 00018 00019 // initialization 00020 int const wanted_threading_level{ MPI_THREAD_FUNNELED }; 00021 00022 MPI_Comm local_group_comm; 00023 std::unique_ptr<artdaq::MPISentry> mpiSentry; 00024 00025 try 00026 { 00027 mpiSentry.reset(new artdaq::MPISentry(&argc, &argv, wanted_threading_level, artdaq::TaskType::BoardReaderTask, local_group_comm)); 00028 } 00029 catch (cet::exception& errormsg) 00030 { 00031 TLOG_ERROR("BoardReaderMain") << errormsg ; 00032 TLOG_ERROR("BoardReaderMain") << "MPISentry error encountered in BoardReaderMain; exiting..." ; 00033 throw errormsg; 00034 } 00035 00036 00037 struct Config 00038 { 00039 fhicl::TableFragment<artdaq::CommanderInterface::Config> commander_config; 00040 fhicl::Atom<std::string> application_name{ fhicl::Name{ "application_name" }, fhicl::Comment{ "Name of the application for metrics and logging" }, "BoardReader" }; 00041 fhicl::TableFragment<artdaq::PortManager::Config> portsConfig; 00042 }; 00043 00044 fhicl::ParameterSet config_ps = LoadParameterSet<Config>(argc, argv,"BoardReaderMain", "This is the BoardReader's main executable (MPI version)"); 00045 app_name = config_ps.get<std::string>("application_name", "BoardReader"); 00046 portMan->UpdateConfiguration(config_ps); 00047 std::string mf_app_name = artdaq::setMsgFacAppName(app_name, config_ps.get<int>("id")); 00048 artdaq::configureMessageFacility(mf_app_name.c_str()); 00049 TLOG_DEBUG(app_name + "Main") << "Setting application name to " << mf_app_name ; 00050 00051 // 23-May-2018, KAB: added lookup of the partition number from the command line arguments. 00052 if (config_ps.has_key("partition_number")) 00053 { 00054 artdaq::Globals::partition_number_ = config_ps.get<int>("partition_number"); 00055 } 00056 TLOG_DEBUG(app_name + "Main") << "Setting partition number to " << artdaq::Globals::partition_number_; 00057 00058 TLOG_INFO(app_name + "Main") << "artdaq version " << 00059 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getPackageVersion() 00060 << ", built " << 00061 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp() ; 00062 00063 // create the BoardReaderApp 00064 my_rank = mpiSentry->rank(); 00065 artdaq::BoardReaderApp br_app; 00066 00067 auto commander = artdaq::MakeCommanderPlugin(config_ps, br_app); 00068 TLOG_INFO(app_name + "Main") << "Running Commmander Server" ; 00069 commander->run_server(); 00070 artdaq::Globals::CleanUpGlobals(); 00071 TLOG_INFO(app_name + "Main") << "Commandable Server ended, exiting..." ; 00072 }