CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
MPIService Class Reference

Public Member Functions

 MPIService (edm::ParameterSet const &config)
 
 ~MPIService ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 20 of file MPIService.cc.

Constructor & Destructor Documentation

◆ MPIService()

MPIService::MPIService ( edm::ParameterSet const &  config)

Definition at line 28 of file MPIService.cc.

28  {
29  // initializes the MPI execution environment, requesting multi-threading support
30  int provided;
31  MPI_Init_thread(nullptr, nullptr, MPI_THREAD_MULTIPLE, &provided);
32  if (provided < MPI_THREAD_MULTIPLE) {
33  throw cms::Exception("UnsupportedFeature")
34  << "CMSSW requires the " << mpi_thread_support_level[MPI_THREAD_MULTIPLE]
35  << " multithreading support level, but the MPI library provides only the " << mpi_thread_support_level[provided]
36  << " level.";
37  } else {
38  edm::LogInfo log("MPIService");
39 
40  // get the number of processes
41  int world_size;
42  MPI_Comm_size(MPI_COMM_WORLD, &world_size);
43  log << "MPI_COMM_WORLD size: " << world_size << '\n';
44 
45  // get the rank of the process
46  int world_rank;
47  MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
48  log << "MPI_COMM_WORLD rank: " << world_rank << '\n';
49 
50  // get the name of the processor
51  char processor_name[MPI_MAX_PROCESSOR_NAME];
52  int name_len;
53  MPI_Get_processor_name(processor_name, &name_len);
54  log << "MPI processor name: " << processor_name << '\n';
55 
56  log << "The MPI library provides the " << mpi_thread_support_level[provided] << " multithreading support level\n";
57  log << "MPI successfully initialised";
58  }
59 }

References Exception, and dqm-mbProfile::log.

◆ ~MPIService()

MPIService::~MPIService ( )

Definition at line 61 of file MPIService.cc.

61  {
62  // terminate the MPI execution environment
63  MPI_Finalize();
64 }

Member Function Documentation

◆ fillDescriptions()

void MPIService::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 66 of file MPIService.cc.

66  {
68  descriptions.add("MPIService", desc);
69  descriptions.setComment(R"(This Service provides a common interface to MPI configuration for the CMSSW job.)");
70 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and edm::ConfigurationDescriptions::setComment().

edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Exception
Definition: hltDiff.cc:245
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
edm::Log
Definition: MessageLogger.h:70