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

env_detect.h
1 /* file: env_detect.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the class used for environment detection.
45 //--
46 */
47 
48 #ifndef __ENV_DETECT_H__
49 #define __ENV_DETECT_H__
50 
51 #include "services/base.h"
52 #include "services/daal_defines.h"
53 
54 namespace daal
55 {
66 enum CpuType
67 {
68  sse2 = 0,
69  ssse3 = 1,
70  sse42 = 2,
71  avx = 3,
72  avx2 = 4,
73  avx512_mic = 5,
74  avx512 = 6,
75  avx512_mic_e1 = 7,
76  lastCpuType = avx512_mic_e1
77 };
78 
79 namespace services
80 {
81 namespace interface1
82 {
83 
88 class DAAL_EXPORT Environment : public Base
89 {
90 public:
95  typedef struct _envStruct
96  {
97  bool cpuid_init_flag;
98  size_t cpuid;
99  } env;
100 
105  static Environment *getInstance();
106 
112  DAAL_DEPRECATED static int freeInstance();
113 
118  enum CpuTypeEnable
119  {
120  cpu_default = 0,
121  avx512_mic = 1,
122  avx512 = 2,
123  avx512_mic_e1 = 4
124  };
125 
131  int getCpuId(int enable = cpu_default);
132 
138  int setCpuId(int cpuid);
139 
145  int enableInstructionsSet(int enable);
146 
151  enum LibraryThreadingType
152  {
153  MultiThreaded = 0,
154  SingleThreaded = 1
155  };
156 
161  void setDynamicLibraryThreadingTypeOnWindows( LibraryThreadingType type );
162 
167  void setNumberOfThreads(const size_t numThreads);
168 
173  void enableThreadPinning( bool enableThreadPinningFlag = true);
174 
179  size_t getNumberOfThreads() const;
180 
186  int setMemoryLimit(MemType type, size_t limit);
187 
188 private:
189  Environment();
190  Environment(const Environment &e);
191  ~Environment();
192 
193  void _cpu_detect(int);
194 
195  env _env;
196 
197  void *_init;
198 };
199 } // namespace interface1
200 
201 using interface1::Environment;
202 
203 }
205 }
206 #endif
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal
Definition: algorithm_base_common.h:57
daal::avx2
Definition: env_detect.h:72
daal::CpuType
CpuType
Definition: env_detect.h:66
daal::services::interface1::Environment::LibraryThreadingType
LibraryThreadingType
Definition: env_detect.h:151
daal::ssse3
Definition: env_detect.h:69
daal_defines.h
daal::avx
Definition: env_detect.h:71
daal::services::interface1::Environment::CpuTypeEnable
CpuTypeEnable
CPU types.
Definition: env_detect.h:118
daal::sse2
Definition: env_detect.h:68
daal::avx512_mic_e1
Definition: env_detect.h:75
daal::services::interface1::Environment
Class that provides methods to interact with the environment, including processor detection and contr...
Definition: env_detect.h:88
daal::sse42
Definition: env_detect.h:70
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:65
daal::avx512
Definition: env_detect.h:74
daal::MemType
MemType
Definition: daal_defines.h:156
daal::avx512_mic
Definition: env_detect.h:73

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