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.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex​.

Notice revision #20201201