CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( edm::ParameterSet const &  config)

Definition at line 28 of file MPIService.cc.

References Exception, and log.

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 }
static std::vector< std::string > checklist log
MPIService::~MPIService ( )

Definition at line 61 of file MPIService.cc.

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

Member Function Documentation

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

Definition at line 66 of file MPIService.cc.

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

66  {
68  descriptions.add("MPIService", desc);
69  descriptions.setComment(R"(This Service provides a common interface to MPI configuration for the CMSSW job.)");
70 }
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)