Binding OpenMP Threads to Specific Cores
Principle
Most HPC applications are CPU-intensive and occupy 100% of the CPU resource for a long time. The scheduling of processes or threads of computing programs on different cores deteriorates the performance. Therefore, you are advised to bind threads to specific cores and ensure that the total number of computing threads does not exceed the total number of CPU cores of the node.
Procedure
- Run the following command to enable binding OpenMP threads to specific cores.
export OMP_PROC_BIND=true
You can also set the environment variable GOMP_CPU_AFFINITY to specify which threads are bound to which cores. For details, see the usage of the OpenMP environment variables in the GNU compiler documentation.
Parent topic: Basic Software Tuning