C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

env_detect.h
1 /* file: env_detect.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the class used for environment detection.
21 //--
22 */
23 
24 #ifndef __ENV_DETECT_H__
25 #define __ENV_DETECT_H__
26 
27 #include "services/base.h"
28 #include "services/daal_defines.h"
29 
30 namespace daal
31 {
42 enum CpuType
43 {
44  sse2 = 0,
45  ssse3 = 1,
46  sse42 = 2,
47  avx = 3,
48  avx2 = 4,
49  avx512_mic = 5,
50  avx512 = 6,
51  avx512_mic_e1 = 7,
52  lastCpuType = avx512_mic_e1
53 };
54 
55 namespace services
56 {
57 namespace interface1
58 {
59 
64 class DAAL_EXPORT Environment : public Base
65 {
66 public:
71  typedef struct _envStruct
72  {
73  bool cpuid_init_flag;
74  size_t cpuid;
75  } env;
76 
81  static Environment *getInstance();
82 
88  DAAL_DEPRECATED static int freeInstance();
89 
95  enum CpuTypeEnable
96  {
97  cpu_default = 0,
98  avx512_mic = 1,
99  avx512 = 2,
100  avx512_mic_e1 = 4
101  };
102 
108  int getCpuId(int enable = cpu_default);
109 
115  int setCpuId(int cpuid);
116 
123  int enableInstructionsSet(int enable);
124 
129  enum LibraryThreadingType
130  {
131  MultiThreaded = 0,
132  SingleThreaded = 1
133  };
134 
139  void setDynamicLibraryThreadingTypeOnWindows( LibraryThreadingType type );
140 
145  void setNumberOfThreads(const size_t numThreads);
146 
151  void enableThreadPinning( bool enableThreadPinningFlag = true);
152 
157  size_t getNumberOfThreads() const;
158 
164  int setMemoryLimit(MemType type, size_t limit);
165 
166 private:
167  Environment();
168  Environment(const Environment &e);
169  ~Environment();
170 
171  void _cpu_detect(int);
172  void initNumberOfThreads();
173 
174  env _env;
175 
176  void *_init;
177 };
178 } // namespace interface1
179 
180 using interface1::Environment;
181 
182 }
184 }
185 #endif
daal::avx
Definition: env_detect.h:47
daal::services::interface1::Environment
Class that provides methods to interact with the environment, including processor detection and contr...
Definition: env_detect.h:64
daal::sse2
Definition: env_detect.h:44
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:41
daal::MemType
MemType
Definition: daal_defines.h:147
daal::sse42
Definition: env_detect.h:46
daal::avx512
Definition: env_detect.h:50
daal_defines.h
daal::CpuType
CpuType
Definition: env_detect.h:42
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:71
daal::ssse3
Definition: env_detect.h:45
daal::services::interface1::Environment::CpuTypeEnable
CpuTypeEnable
CPU types.
Definition: env_detect.h:95
daal::avx512_mic_e1
Definition: env_detect.h:51
daal::avx2
Definition: env_detect.h:48
daal::services::interface1::Environment::LibraryThreadingType
LibraryThreadingType
Definition: env_detect.h:129
daal::avx512_mic
Definition: env_detect.h:49

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