C++ API Reference for Intel® Data Analytics Acceleration Library 2019

env_detect.h
1 /* file: env_detect.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the class used for environment detection.
19 //--
20 */
21 
22 #ifndef __ENV_DETECT_H__
23 #define __ENV_DETECT_H__
24 
25 #include "services/base.h"
26 #include "services/daal_defines.h"
27 
28 namespace daal
29 {
40 enum CpuType
41 {
42  sse2 = 0,
43  ssse3 = 1,
44  sse42 = 2,
45  avx = 3,
46  avx2 = 4,
47  avx512_mic = 5,
48  avx512 = 6,
49  avx512_mic_e1 = 7,
50  lastCpuType = avx512_mic_e1
51 };
52 
53 namespace services
54 {
55 namespace interface1
56 {
57 
62 class DAAL_EXPORT Environment : public Base
63 {
64 public:
69  typedef struct _envStruct
70  {
71  bool cpuid_init_flag;
72  size_t cpuid;
73  } env;
74 
79  static Environment *getInstance();
80 
86  DAAL_DEPRECATED static int freeInstance();
87 
93  enum CpuTypeEnable
94  {
95  cpu_default = 0,
96  avx512_mic = 1,
97  avx512 = 2,
98  avx512_mic_e1 = 4
99  };
100 
106  int getCpuId(int enable = cpu_default);
107 
113  int setCpuId(int cpuid);
114 
121  int enableInstructionsSet(int enable);
122 
127  enum LibraryThreadingType
128  {
129  MultiThreaded = 0,
130  SingleThreaded = 1
131  };
132 
137  void setDynamicLibraryThreadingTypeOnWindows( LibraryThreadingType type );
138 
143  void setNumberOfThreads(const size_t numThreads);
144 
149  void enableThreadPinning( bool enableThreadPinningFlag = true);
150 
155  size_t getNumberOfThreads() const;
156 
162  int setMemoryLimit(MemType type, size_t limit);
163 
164 private:
165  Environment();
166  Environment(const Environment &e);
167  ~Environment();
168 
169  void _cpu_detect(int);
170  void initNumberOfThreads();
171 
172  env _env;
173 
174  void *_init;
175 };
176 } // namespace interface1
177 
178 using interface1::Environment;
179 
180 }
182 }
183 #endif
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:69
daal
Definition: algorithm_base_common.h:31
daal::avx2
Definition: env_detect.h:46
daal::CpuType
CpuType
Definition: env_detect.h:40
daal::services::interface1::Environment::LibraryThreadingType
LibraryThreadingType
Definition: env_detect.h:127
daal::ssse3
Definition: env_detect.h:43
daal_defines.h
daal::avx
Definition: env_detect.h:45
daal::services::interface1::Environment::CpuTypeEnable
CpuTypeEnable
CPU types.
Definition: env_detect.h:93
daal::sse2
Definition: env_detect.h:42
daal::avx512_mic_e1
Definition: env_detect.h:49
daal::services::interface1::Environment
Class that provides methods to interact with the environment, including processor detection and contr...
Definition: env_detect.h:62
daal::sse42
Definition: env_detect.h:44
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:39
daal::avx512
Definition: env_detect.h:48
daal::MemType
MemType
Definition: daal_defines.h:131
daal::avx512_mic
Definition: env_detect.h:47

For more complete information about compiler optimizations, see our Optimization Notice.