00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MS_PROCESSORS_HPP
00020 #define MS_PROCESSORS_HPP
00021
00022 #include <string>
00023 #include <vector>
00024
00025 namespace msparser_internal {
00026 class ms_processors_impl;
00027 }
00028
00029 namespace matrix_science {
00030
00036
00037
00049 class MS_MASCOTRESFILE_API ms_processors: public ms_errors
00050 {
00051 public:
00053
00060 enum HYPERTHREADING
00061 {
00062 HT_NOT_CAPABLE = 0,
00063 HT_ENABLED = 1,
00064 HT_DISABLED = 2,
00065 HT_SUPPORTED_NOT_ENABLED = 3,
00066 HT_CANNOT_DETECT = 4
00067 };
00068
00070
00079 enum {
00080 DEPRECATED_MAX_CORES_PER_LICENSE = 4
00081 };
00082
00084 ms_processors(bool checkLinuxHT, int unused);
00085
00087 ms_processors(const ms_processors& src);
00088
00090 ~ms_processors();
00091
00093 void copyFrom(const ms_processors* right);
00094
00095 #ifndef SWIG
00096
00097 ms_processors& operator=(const ms_processors& right);
00098 #endif
00099
00100 int getNumOnSystem() const;
00101
00103 int getNumAvailableToProcess() const;
00104
00106 bool isProcessAffinitySupported() const;
00107
00109 bool isUseProcessesNotThreads() const;
00110
00112 UINT64 getWhichAvailableForMascot() const;
00113
00115 std::vector<int> getWhichAvailableForMascot2() const;
00116
00118 bool isLogicalCPUAvailableForMascot(const int cpu) const;
00119
00121 int getNumProcessorGroups() const;
00122
00124 int getNumPhysicalOnSystem() const;
00125
00127 HYPERTHREADING getHyperThreadingState() const;
00128
00130 int getNumLogicalPerPhysical(const int packageID = 0) const;
00131
00133 int getNumCores(const int packageID = -1) const;
00134
00136 int getPhysicalFromLogical(const int cpu) const;
00137
00139 std::string getProcessorName() const;
00140
00142 std::string getMultithreadedName() const;
00143
00145 UINT64 getHyperThreadedCPUsMask() const;
00146
00148 bool isPrimaryLogicalProcessor(const int cpu) const;
00149
00151 bool isThreadedLogicalProcessor(const int cpu) const;
00152
00154 int getCoreFromLogical(const int cpu) const;
00155
00157 int getHT_IDFromLogical(const int cpu) const;
00158
00160 int getAutoDetectNumThreads(const int numLicensed, const int numCoresPerCpuLicense) const;
00161
00163 bool setProcessAffinity(const std::vector<unsigned int> & vecCpu) const;
00164
00166 bool setProcessAffinity(const std::vector<int> & vecCpu) const;
00167
00169 bool setThreadAffinity(const int logicalCpu) const;
00170
00171 private:
00172 msparser_internal::ms_processors_impl * pImpl_;
00173 };
00175 }
00176
00177 #endif // MS_PROCESSORS_HPP
00178
00179
00180