Version: 9.15.0
SALOME_ResourcesCatalog_Parser.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
24 // File : SALOME_ResourcesCatalog_Parser.hxx
25 // Author : Estelle Deville
26 // Module : SALOME
27 //$Header$
28 //
29 #ifndef SALOME_RESOURCES_CATALOG_PARSER
30 #define SALOME_RESOURCES_CATALOG_PARSER
31 
33 
34 #include <string>
35 #include <vector>
36 #include <list>
37 #include <map>
38 #include <iostream>
39 
40 #ifdef WIN32
41 #pragma warning(disable:4251) // Warning DLL Interface ...
42 #endif
43 
45 
47 
49 
51 
53 {
54 public:
55  const std::string msg;
56 
57  ResourcesException(const std::string m) : msg(m) {}
58 };
59 
61  {
62 
63  public:
64  std::string _Name;
65  unsigned int _nbOfNodes;
66  unsigned int _nbOfProcPerNode;
67  unsigned int _CPUFreqMHz;
68  unsigned int _memInMB;
69  static unsigned int _nbOfProcWanted;
70  static unsigned int _nbOfNodesWanted;
71  static unsigned int _nbOfProcPerNodeWanted;
72  static unsigned int _CPUFreqMHzWanted;
73  static unsigned int _memInMBWanted;
74 
75  public:
77  ResourceDataToSort(const std::string& name,
78  unsigned int nbOfNodes,
79  unsigned int nbOfProcPerNode,
80  unsigned int CPUFreqMHz,
81  unsigned int memInMB);
82  bool operator< (const ResourceDataToSort& other) const;
83  void Print() const;
84 
85  private:
86  unsigned int GetNumberOfPoints() const;
87  };
88 
90 {
91 public:
93  virtual ~ParserResourcesType();
94 
95  std::string getAccessProtocolTypeStr() const;
96  std::string getResourceTypeStr() const;
97  std::string getBatchTypeStr() const;
98  std::string getMpiImplTypeStr() const;
99  std::string getClusterInternalProtocolStr() const;
100  std::string getCanLaunchBatchJobsStr() const;
101  std::string getCanRunContainersStr() const;
102 
103  void setAccessProtocolTypeStr(const std::string & protocolTypeStr);
104  void setResourceTypeStr(const std::string & resourceTypeStr);
105  void setBatchTypeStr(const std::string & batchTypeStr);
106  void setMpiImplTypeStr(const std::string & mpiImplTypeStr);
107  void setClusterInternalProtocolStr(const std::string & internalProtocolTypeStr);
108  void setCanLaunchBatchJobsStr(const std::string & canLaunchBatchJobsStr);
109  void setCanRunContainersStr(const std::string & canRunContainersStr);
110  std::string dump(char sep) const;
111 
113  std::string Name;
114  std::string HostName;
120  std::string UserName;
121  std::string AppliPath;
122  std::vector<std::string> ComponentsList;
123  std::vector<std::string> ModulesList;
124  std::string OS;
125  std::string batchQueue;
126  std::string userCommands;
127  std::string use;
128  std::list<ParserResourcesType> ClusterMembersList;
129  unsigned int nbOfProc;
132  std::string working_directory;
133 
134 protected:
135 
136  static std::string protocolToString(AccessProtocolType protocol);
137  static AccessProtocolType stringToProtocol(const std::string & protocolStr);
138 
139  RESOURCESMANAGER_EXPORT friend std::ostream & operator<<(std::ostream &os,
140  const ParserResourcesType &rt);
141 
142 };
143 
144 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
145 typedef std::map<std::string, ParserResourcesType>::iterator MapOfParserResourcesType_it;
146 
147 #endif //SALOME_RESOURCES_CATALOG_PARSER
std::ostream & operator<<(std::ostream &os, const std::pair< T, U > &p)
Definition: DisplayPair.hxx:35
#define RESOURCESMANAGER_EXPORT
Definition: ResourcesManager_Defs.hxx:33
std::map< std::string, ParserResourcesType > MapOfParserResourcesType
Definition: SALOME_ResourcesCatalog_Parser.hxx:144
ResourceType
Definition: SALOME_ResourcesCatalog_Parser.hxx:46
@ single_machine
Definition: SALOME_ResourcesCatalog_Parser.hxx:46
@ cluster
Definition: SALOME_ResourcesCatalog_Parser.hxx:46
BatchType
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ oar
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ ccc
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ coorm
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ ll
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ pbs
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ sge
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ none
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ slurm
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ vishnu
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
@ lsf
Definition: SALOME_ResourcesCatalog_Parser.hxx:48
std::map< std::string, ParserResourcesType >::iterator MapOfParserResourcesType_it
Definition: SALOME_ResourcesCatalog_Parser.hxx:145
MpiImplType
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ prun
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ ompi
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ lam
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ mpich2
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ mpich1
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ nompi
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ openmpi
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
@ slurmmpi
Definition: SALOME_ResourcesCatalog_Parser.hxx:50
AccessProtocolType
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ pbsdsh
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ ssh
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ srun
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ rsh
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ blaunch
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ rsync
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
@ sh
Definition: SALOME_ResourcesCatalog_Parser.hxx:44
Definition: SALOME_ResourcesCatalog_Parser.hxx:90
std::string HostName
Definition: SALOME_ResourcesCatalog_Parser.hxx:114
std::string AppliPath
Definition: SALOME_ResourcesCatalog_Parser.hxx:121
ResourceType type
Definition: SALOME_ResourcesCatalog_Parser.hxx:117
MpiImplType mpi
Definition: SALOME_ResourcesCatalog_Parser.hxx:119
std::list< ParserResourcesType > ClusterMembersList
Definition: SALOME_ResourcesCatalog_Parser.hxx:128
std::vector< std::string > ComponentsList
Definition: SALOME_ResourcesCatalog_Parser.hxx:122
unsigned int nbOfProc
Definition: SALOME_ResourcesCatalog_Parser.hxx:129
std::string use
Definition: SALOME_ResourcesCatalog_Parser.hxx:127
bool can_run_containers
Definition: SALOME_ResourcesCatalog_Parser.hxx:131
std::string working_directory
Definition: SALOME_ResourcesCatalog_Parser.hxx:132
std::string batchQueue
Definition: SALOME_ResourcesCatalog_Parser.hxx:125
AccessProtocolType Protocol
Definition: SALOME_ResourcesCatalog_Parser.hxx:115
BatchType Batch
Definition: SALOME_ResourcesCatalog_Parser.hxx:118
std::string OS
Definition: SALOME_ResourcesCatalog_Parser.hxx:124
ResourceDataToSort DataForSort
Definition: SALOME_ResourcesCatalog_Parser.hxx:112
std::string Name
Definition: SALOME_ResourcesCatalog_Parser.hxx:113
std::string userCommands
Definition: SALOME_ResourcesCatalog_Parser.hxx:126
bool can_launch_batch_jobs
Definition: SALOME_ResourcesCatalog_Parser.hxx:130
std::vector< std::string > ModulesList
Definition: SALOME_ResourcesCatalog_Parser.hxx:123
AccessProtocolType ClusterInternalProtocol
Definition: SALOME_ResourcesCatalog_Parser.hxx:116
std::string UserName
Definition: SALOME_ResourcesCatalog_Parser.hxx:120
Definition: SALOME_ResourcesCatalog_Parser.hxx:61
unsigned int _nbOfProcPerNode
Definition: SALOME_ResourcesCatalog_Parser.hxx:66
static unsigned int _nbOfProcPerNodeWanted
Definition: SALOME_ResourcesCatalog_Parser.hxx:71
static unsigned int _nbOfProcWanted
Definition: SALOME_ResourcesCatalog_Parser.hxx:69
static unsigned int _CPUFreqMHzWanted
Definition: SALOME_ResourcesCatalog_Parser.hxx:72
static unsigned int _memInMBWanted
Definition: SALOME_ResourcesCatalog_Parser.hxx:73
std::string _Name
Definition: SALOME_ResourcesCatalog_Parser.hxx:64
unsigned int _CPUFreqMHz
Definition: SALOME_ResourcesCatalog_Parser.hxx:67
unsigned int _nbOfNodes
Definition: SALOME_ResourcesCatalog_Parser.hxx:65
unsigned int _memInMB
Definition: SALOME_ResourcesCatalog_Parser.hxx:68
static unsigned int _nbOfNodesWanted
Definition: SALOME_ResourcesCatalog_Parser.hxx:70
Definition: SALOME_ResourcesCatalog_Parser.hxx:53
ResourcesException(const std::string m)
Definition: SALOME_ResourcesCatalog_Parser.hxx:57
const std::string msg
Definition: SALOME_ResourcesCatalog_Parser.hxx:55
string msg
Definition: TestMinimalExample.py:168
string name
Definition: pythfilter.py:56
def dump(filename)
Definition: pythfilter.py:368