00001 #include "otsdaq-core/MPICore/MPIInitializer.h"
00002
00003 #include "otsdaq-core/MessageFacility/MessageFacility.h"
00004 #include "otsdaq-core/Macros/CoutHeaderMacros.h"
00005 #include "artdaq/BuildInfo/GetPackageBuildInfo.hh"
00006 #include "fhiclcpp/make_ParameterSet.h"
00007
00008
00009
00010 #include <iostream>
00011
00012
00013 using namespace ots;
00014
00015
00016 MPIInitializer::MPIInitializer(void)
00017 : local_group_comm_(0), rank_(0)
00018 {
00019 }
00020
00021
00022 void MPIInitializer::init(std::string name, artdaq::TaskType taskType)
00023 {
00024
00025 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "BEGIN" << std::endl;
00026
00027 INIT_MF((name + "App").c_str());
00028
00029
00030
00031 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "MF initialized" << std::endl;
00032
00033
00034
00035 int const wanted_threading_level { MPI_THREAD_MULTIPLE };
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 try
00047 {
00048
00049 mpiSentry_.reset( new artdaq::MPISentry(0, 0, wanted_threading_level, taskType, local_group_comm_) );
00050 }
00051 catch (cet::exception& errormsg)
00052 {
00053 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "DIDN't FIND MPI!" << std::endl;
00054
00055
00056
00057 mf::LogError(name) << errormsg ;
00058 mf::LogError(name) << "MPISentry error encountered in " << name << "; exiting...";
00059 throw errormsg;
00060 }
00061
00062 rank_ = mpiSentry_->rank();
00063
00064 unsigned short port = 5100;
00065
00066
00067 mf::LogDebug(name + "InterfaceManager") << "artdaq version " <<
00068 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getPackageVersion()
00069 << ", built " <<
00070 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp();
00071
00072
00073
00074 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "END" << std::endl;
00075 }
00076
00077
00078 MPIInitializer::~MPIInitializer(void)
00079 {
00080 mpiSentry_.reset(nullptr);
00081 }