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
00028
00029
00030
00031
00032 int const wanted_threading_level { MPI_THREAD_MULTIPLE };
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 try
00044 {
00045
00046 mpiSentry_.reset( new artdaq::MPISentry(0, 0, wanted_threading_level, taskType, local_group_comm_) );
00047 }
00048 catch (cet::exception& errormsg)
00049 {
00050 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "DIDN't FIND MPI!" << std::endl;
00051
00052
00053
00054 mf::LogError(name) << errormsg ;
00055 mf::LogError(name) << "MPISentry error encountered in " << name << "; exiting...";
00056 throw errormsg;
00057 }
00058
00059 rank_ = mpiSentry_->rank();
00060
00061 unsigned short port = 5100;
00062
00063
00064 mf::LogDebug(name + "InterfaceManager") << "artdaq version " <<
00065 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getPackageVersion()
00066 << ", built " <<
00067 artdaq::GetPackageBuildInfo::getPackageBuildInfo().getBuildTimestamp();
00068
00069
00070
00071 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "END" << std::endl;
00072 }
00073
00074
00075 MPIInitializer::~MPIInitializer(void)
00076 {
00077 mpiSentry_.reset(nullptr);
00078 }