# Managing the Computational Environment¶

oneDAL provides the Environment class to manage settings of the computational environment in which the application that uses the library runs. The methods of this class enable you to specify the number of threads for the application to use or to check the type of the processor running the application. The Environment class is a singleton, which ensures that only one instance of the class is available in the oneDAL based application. To access the instance of the class, call the getInstance() method which returns a pointer to the instance. Once you get the instance of the class, you can use it for multiple purposes:

• Detect the processor type. To do this, call the getCpuId() method.

• Enable dispatching for new Intel® Architecture Processors. To do this, call the enableInstructionsSet() method. For example, to select the version for Intel® Xeon Phi™ processors based on Intel® Advanced Vector Extensions 512 (Intel® AVX-512) with support of AVX512_4FMAPS and AVX512_4VNNIW instruction groups, pass the avx512_mic_e1 parameter to the method.

• Restrict dispatching to the required code path. To do this, call the setCpuId() method.

• Detect and modify the number of threads used by the oneDAL based application. To do this, call the getNumberOfThreads() or setNumberOfThreads() method, respectively.

• Specify the single-threaded of multi-threaded mode for oneDAL on Windows. To do this, call to the setDynamicLibraryThreadingTypeOnWindows() method.

• Enable thread pinning. To do this, call the enableThreadPinning() method. This method performs binding of the threads that are used to parallelize algorithms of the library to physical processing units for possible performance improvement. Improper use of the method can result in degradation of the application performance depending on the system (machine) topology, application, and operating system. By default, the method is disabled.

Optimization Notice

Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804