This topic only applies when targeting Intel® Many Integrated Core Architecture (Intel® MIC Architecture).

Several methods exist to override the default number of threads per core on the coprocessor.

Using the OpenMP* API

The OpenMP* API specification provides the following standard ways to change the desired number of threads on the coprocessor:

  • Calling the function omp_set_num_threads(n) before the omp parallel region

  • Using the clause num_threads with #pragma omp parallel

  • Setting the environment variable OMP_NUM_THREADS=n

For more information, refer to the OpenMP* API Specification at

Using the Intel® Compiler

In addition to the standard methods that the OpenMP* API specification provides, listed below, you can use the environment variable MIC_ENV_PREFIX to define a custom-prefixed environment variable to control the number of OpenMP* threads on the coprocessor separately from the host CPU. For example, the following environment variable definitions set OMP_NUM_THREADS on both the CPU and the coprocessor, but with different values.


Direct calls on the coprocessor to APIs in to establish a specific runtime setting override any setting previously set by a CPU environment variable that is replicated on the coprocessor.

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.