Back to index

salome-kernel  6.5.0
SALOME_ResourcesCatalog_Parser.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
00024 //  File   : SALOME_ResourcesCatalog_Parser.hxx
00025 //  Author : Estelle Deville
00026 //  Module : SALOME
00027 //$Header: /home/server/cvs/KERNEL/KERNEL_SRC/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx,v 1.6.2.3.10.8.2.1 2012-04-12 14:05:20 vsr Exp $
00028 //
00029 #ifndef SALOME_RESOURCES_CATALOG_PARSER
00030 #define SALOME_RESOURCES_CATALOG_PARSER
00031 
00032 #include "ResourcesManager_Defs.hxx"
00033 
00034 #include <string>
00035 #include <vector>
00036 #include <list>
00037 #include <map>
00038 #include <iostream>
00039 
00040 #ifdef WNT
00041 #pragma warning(disable:4251) // Warning DLL Interface ...
00042 #endif
00043 
00044 enum AccessProtocolType {rsh, ssh, srun, pbsdsh, blaunch};
00045 
00046 enum AccessModeType {interactive, batch};
00047 
00048 enum BatchType {none, pbs, lsf, sge, ssh_batch, ccc, ll, slurm, vishnu};
00049 
00050 enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurmmpi, prun};
00051 
00052 class RESOURCESMANAGER_EXPORT ResourceDataToSort
00053   {
00054 
00055   public:
00056     std::string _Name;
00057     unsigned int _nbOfNodes;
00058     unsigned int _nbOfProcPerNode;
00059     unsigned int _CPUFreqMHz;
00060     unsigned int _memInMB;
00061     static unsigned int _nbOfProcWanted;
00062     static unsigned int _nbOfNodesWanted;
00063     static unsigned int _nbOfProcPerNodeWanted;
00064     static unsigned int _CPUFreqMHzWanted;
00065     static unsigned int _memInMBWanted;
00066 
00067   public:
00068     ResourceDataToSort();
00069     ResourceDataToSort(const std::string& name,
00070                        unsigned int nbOfNodes,
00071                        unsigned int nbOfProcPerNode,
00072                        unsigned int CPUFreqMHz,
00073                        unsigned int memInMB);
00074     bool operator< (const ResourceDataToSort& other) const;
00075     void Print() const;
00076 
00077   private:
00078     unsigned int GetNumberOfPoints() const;
00079   };
00080 
00081 struct RESOURCESMANAGER_EXPORT ParserResourcesClusterMembersType
00082 {
00083   std::string HostName;
00084   AccessProtocolType Protocol;
00085   AccessProtocolType ClusterInternalProtocol;
00086   std::string UserName;
00087   std::string AppliPath;
00088   ResourceDataToSort DataForSort;
00089 };
00090 
00091 struct RESOURCESMANAGER_EXPORT ParserResourcesType
00092 {
00093   ResourceDataToSort DataForSort;
00094   std::string Name;
00095   std::string HostName;
00096   AccessProtocolType Protocol;
00097   AccessProtocolType ClusterInternalProtocol;
00098   AccessModeType Mode;
00099   BatchType Batch;
00100   MpiImplType mpi;
00101   std::string UserName;
00102   std::string AppliPath;
00103   std::vector<std::string> ComponentsList;
00104   std::vector<std::string> ModulesList;
00105   std::string OS;
00106   std::string batchQueue;
00107   std::string userCommands;
00108   std::string use;
00109   std::list<ParserResourcesClusterMembersType> ClusterMembersList;
00110   unsigned int nbOfProc;
00111   bool is_cluster_head;
00112   std::string working_directory;
00113 
00114   void Print();
00115   void Clear();
00116 
00117   static std::string protocolToString(AccessProtocolType protocol);
00118   static AccessProtocolType stringToProtocol(const std::string & protocolStr);
00119 
00120   std::string PrintAccessProtocolType() const;
00121   std::string PrintAccessModeType() const;
00122   std::string PrintBatchType() const;
00123   std::string PrintMpiImplType() const;
00124   std::string PrintClusterInternalProtocol() const;
00125 };
00126 
00127 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
00128 typedef std::map<std::string, ParserResourcesType>::iterator MapOfParserResourcesType_it;
00129 
00130 #endif //SALOME_RESOURCES_CATALOG_PARSER