C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 3

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 
92  enum CpuTypeEnable
93  {
94  cpu_default = 0,
95  avx512_mic = 1,
96  avx512 = 2,
97  avx512_mic_e1 = 4
98  };
99 
105  int getCpuId(int enable = cpu_default);
106 
112  int setCpuId(int cpuid);
113 
119  int enableInstructionsSet(int enable);
120 
125  enum LibraryThreadingType
126  {
127  MultiThreaded = 0,
128  SingleThreaded = 1
129  };
130 
135  void setDynamicLibraryThreadingTypeOnWindows( LibraryThreadingType type );
136 
141  void setNumberOfThreads(const size_t numThreads);
142 
147  void enableThreadPinning( bool enableThreadPinningFlag = true);
148 
153  size_t getNumberOfThreads() const;
154 
160  int setMemoryLimit(MemType type, size_t limit);
161 
162 private:
163  Environment();
164  Environment(const Environment &e);
165  ~Environment();
166 
167  void _cpu_detect(int);
168 
169  env _env;
170 
171  void *_init;
172 };
173 } // namespace interface1
174 
175 using interface1::Environment;
176 
177 }
179 }
180 #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:125
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:92
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.