Intel® Math Kernel Library 2018 Developer Reference - C
For computations in the Automatic Offload mode, sets the maximum fraction of available Intel Xeon Phi coprocessor computational resources (cores) that the calling process can use.
int mkl_mic_set_resource_limit (double fraction);
Name |
Type |
Description |
---|---|---|
fraction |
double |
The fractional amount of Intel Xeon Phi coprocessor computational resources that the calling process can use for Automatic Offload (AO). Possible values: 0.0 ≤fraction≤ 1.0. Special values:
NoteFor Intel® MPI Library, Open MPI, and IBM Platform MPI, Intel MKL automatically detects ppn. For other MPI implementations, use the MKL_MPI_PPN environment variable to set ppn. |
If you are using Intel MKL in the AO mode, the mkl_mic_set_resource_limit function specifies how much of the computational resources of Intel Xeon Phi coprocessors can be used by the calling process. Use this function if you need to share coprocessor cores automatically across multiple processes that call Intel MKL in the AO mode. For example, this might be useful in MPI applications.
You can also enable this functionality using the MKL_MIC_RESOURCE_LIMIT environment variable (see the Intel MKL Developer Guide for details), but the mkl_mic_set_resource_limit function take precedence over the environment variable.
If fraction is set to a valid non-zero value, Intel MKL enables automatic reservation of Intel Xeon Phi coprocessor cores.
Actual reservation is made during a call to an Intel MKL AO function and works as follows:
Intel MKL converts fraction to a number of Intel Xeon Phi coprocessor cores and tries to find cores that are not reserved by other processes.
The number of available cores can be less than the requested number. Intel MKL considers cores of all available coprocessors as a single space and can find cores on different coprocessors. However, Intel MKL tends to reserve as many cores as were requested and to reserve cores compactly (using as few coprocessors as possible).
Intel MKL exclusively reserves cores found in the previous step.
Intel MKL makes reservation safely across a persistent shared memory region using semaphores.
Intel MKL performs AO computations on reserved cores only.
You do not need to set any threading parameters for Intel Xeon Phi coprocessors, such as MIC_OMP_NUM_THREADS or MIC_KMP_AFFINITY (these settings are ignored when automatic resource sharing is enabled).
Upon completion of an AO call, Intel MKL releases reserved cores.
Be aware of the following features of the automatic reservation:
Execution of Intel MKL AO functions falls back to the host if Intel MKL fails to reserve the minimum number of Intel Xeon Phi coprocessor cores that provide a benefit over executing on the host.
The last core of Intel Xeon Phi coprocessors cannot be reserved because it is used for system processes.
Reservation works only within a space of a single user. In other words, Intel MKL cannot share Intel Xeon Phi coprocessor resources across processes from different users.
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 |
One Intel Xeon Phi coprocessor with 61 cores is available on the system. One process calls mkl_mic_set_resource_limit(1.0) and then calls dgemm in AO mode. As a result, 60 Intel Xeon Phi coprocessor cores are reserved at the beginning of AO dgemm. Then mkl_mic_set_resource_limit(0.3) is invoked and AO dgemm is called one more time. As a result, dgemm is run on 18 Intel Xeon Phi coprocessor cores. During this run of AO dgemm, another process calls mkl_mic_set_resource_limit(1.0) and invokes AO dgetrf. Because 18 cores are reserved by the first process, only 42 cores are reserved for AO dgetrf.
Two Intel Xeon Phi coprocessors with 61 cores each are available on the system. Three processes simultaneously call mkl_mic_set_resource_limit(0.34) and then call dpotrf in AO mode. As a result, one process receives 40 cores from coprocessor 1, another process receives 40 cores from coprocessor 2, and the remaining process is given 20 cores from each of the two coprocessors for a total of 40 cores.
Two Intel Xeon Phi coprocessors with 58 cores each are available on the system. The user sets MKL_MIC_PPN=4 and runs an MPI application with 4 MPI ranks. The following sequence of functions is called in each MPI process:
mkl_mic_set_workdivision(MKL_TARGET_MIC, 2, 0.0); mkl_mic_set_resource_limit(MKL_MPI_PPN); MPI_Init(...); //calls to Intel MKL AO functions; MPI_Finalize(...);
As a result, actual fraction is set to 0.25 for each MPI process, and each MPI process receives 14 cores on Intel Xeon Phi coprocessor 1 (because the user excluded co-processor 2 from computations by setting zero workdivision for it).
Name |
Type |
Description |
---|---|---|
ierr |
int |
Result status: = 0 Indicates that the fraction is set successfully. < 0 Indicates a failure to set the fraction. |