Visible to Intel only — GUID: GUID-A09C5398-D263-42F8-95E2-772C3C1FE79C
Visible to Intel only — GUID: GUID-A09C5398-D263-42F8-95E2-772C3C1FE79C
Improving Performance with Threading
Intel® oneAPI Math Kernel Library (oneMKL) is extensively parallelized. SeeOpenMP* Threaded Functions and Problems and Functions Threaded with Intel® Threading Building Blocks for lists of threaded functions and problems that can be threaded.
Intel® oneAPI Math Kernel Library isthread-safe, which means that all Intel® oneAPI Math Kernel Library functions (except the LAPACK deprecated routine?lacon)work correctly during simultaneous execution by multiple threads. In particular, any chunk of threaded Intel® oneAPI Math Kernel Library code provides access for multiple threads to the same shared data, while permitting only one thread at any given time to access a shared piece of data. Therefore, you can call Intel® oneAPI Math Kernel Library from multiple threads and not worry about the function instances interfering with each other.
If you are using OpenMP* threading technology, you can use the environment variable OMP_NUM_THREADSto specify the number of threads or the equivalent OpenMP run-time function calls. Intel® oneAPI Math Kernel Library also offers variables that are independent of OpenMP, such asMKL_NUM_THREADS, and equivalent Intel® oneAPI Math Kernel Library functions for thread management. The Intel® oneAPI Math Kernel Library variables are always inspected first, then the OpenMP variables are examined, and if neither is used, the OpenMP software chooses the default number of threads.
By default, Intel® oneAPI Math Kernel Library uses the number ofOpenMP threads equal to the number of physical cores on the system.
If you are using the Intel TBB threading technology, the OpenMP threading controls, such as the OMP_NUM_THREADS environment variable or MKL_NUM_THREADS function, have no effect. Use the Intel TBB application programming interface to control the number of threads.
To achieve higher performance, set the number of threads to the number of processors or physical cores, as summarized in Techniques to Set the Number of Threads.
Product and Performance Information |
---|
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex. Notice revision #20201201 |
- OpenMP* Threaded Functions and Problems
- Functions Threaded with Intel® Threading Building Blocks
- Avoiding Conflicts in the Execution Environment
- Techniques to Set the Number of Threads
- Setting the Number of Threads Using an OpenMP* Environment Variable
- Changing the Number of OpenMP* Threads at Run Time
- Using Additional Threading Control
- Calling oneMKL Functions from Multi-threaded Applications
- Using Intel® Hyper-Threading Technology