简体   繁体   中英

Set number of cores in OpenMP

I'm running my program on an Intel® Xeon® Processor E5-1650 v3 http://ark.intel.com/products/82765/Intel-Xeon-Processor-E5-1650-v3-15M-Cache-3_50-GHz

The processor has 6 CPUs(6 cores), I'm trying to set the number of CPUs my prorgram is using. My application is using openmp. I'm not trying to set the number of threads, but the number of CPUs. How can I do that?

Have you tried to use environment variables controlling thread affinity?

If you're compiling your code with gcc, you may want to use GOMP_CPU_AFFINITY or OMP_PLACES .

For Intel compilers, there are KMP_AFFINITY and KMP_PLACE_THREADS , see the Intel documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM