1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
24 // File : SALOME_ResourcesCatalog_Parser.hxx
25 // Author : Estelle Deville
29 #ifndef SALOME_RESOURCES_CATALOG_PARSER
30 #define SALOME_RESOURCES_CATALOG_PARSER
32 #include "ResourcesManager_Defs.hxx"
41 #pragma warning(disable:4251) // Warning DLL Interface ...
44 enum AccessProtocolType {sh, rsh, ssh, srun, pbsdsh, blaunch};
46 enum ResourceType {cluster, single_machine};
48 enum BatchType {none, pbs, lsf, sge, ccc, ll, slurm, vishnu, oar, coorm};
50 enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, ompi, slurmmpi, prun};
52 class RESOURCESMANAGER_EXPORT ResourcesException
55 const std::string msg;
57 ResourcesException(const std::string m) : msg(m) {}
60 class RESOURCESMANAGER_EXPORT ResourceDataToSort
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;
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;
86 unsigned int GetNumberOfPoints() const;
89 class RESOURCESMANAGER_EXPORT ParserResourcesType
92 ParserResourcesType();
93 virtual ~ParserResourcesType();
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;
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);
111 ResourceDataToSort DataForSort;
113 std::string HostName;
114 AccessProtocolType Protocol;
115 AccessProtocolType ClusterInternalProtocol;
119 std::string UserName;
120 std::string AppliPath;
121 std::vector<std::string> ComponentsList;
122 std::vector<std::string> ModulesList;
124 std::string batchQueue;
125 std::string userCommands;
127 std::list<ParserResourcesType> ClusterMembersList;
128 unsigned int nbOfProc;
129 bool can_launch_batch_jobs;
130 bool can_run_containers;
131 std::string working_directory;
135 static std::string protocolToString(AccessProtocolType protocol);
136 static AccessProtocolType stringToProtocol(const std::string & protocolStr);
138 RESOURCESMANAGER_EXPORT friend std::ostream & operator<<(std::ostream &os,
139 const ParserResourcesType &rt);
143 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
144 typedef std::map<std::string, ParserResourcesType>::iterator MapOfParserResourcesType_it;
146 #endif //SALOME_RESOURCES_CATALOG_PARSER