|
Article ID: 284
Last updated: 03 Dec, 2025
The dplace tool binds processes/threads to specific processor cores to improve your code performance. For an introduction to pinning at NAS, see Process/Thread Pinning Overview. Once pinned, the processes/threads do not migrate. This can improve the performance of your code by increasing the percentage of local memory accesses. dplace invokes a kernel module to create a job placement container consisting of all (or a subset of) the CPUs of the cpuset. In the current dplace version 2, an LD_PRELOAD library (libdplace.so) is used to intercept calls to the functions fork(), exec(), and pthread_create() to place tasks that are being created. Note that tasks created internal to glib are not intercepted by the preload library. These tasks will not be placed. If no placement file is being used, then the dplace process is placed in the job placement container and (by default) is bound to the first CPU of the cpuset associated with the container. Note: The dplace tool is avalable on the NAS x86_64 compute nodes accessed through PBS. Syntax
If no placement file is being used, then the dplace process is placed in this container and (by default) is bound to the first cpu of the cpuset associated with the container. Then dplace "execs" the <command>. The command is executing within this placement container and continues to be bound to the first cpu of the container. As the command forks child processes, they inherit the container and are bound to the next available cpu of the container. If a placement file is being used, then the dplace process is not placed at the time the job placement container is created. Instead, placement occurs as processes are forked and executed. Options for dplaceExplanations for some of the options are provided below. For additional information, see man dplace. -e and -c cpu_numbers-e determines exact placement. As processes are created, they are bound to CPUs in the exact order specified in the CPU list. CPU numbers may appear multiple times in the list. A CPU value of "x" indicates that binding should not be done for that process. If the end of the list is reached, binding starts over again at the beginning of the list. -c cpu_numbers specifies a list of CPUs, optionally strided CPU ranges, or a striding pattern. For example:
Note: CPU numbers are not physical CPU numbers. They are logical CPU numbers that are relative to the CPUs that are in the allowed set, as specified by the current cpuset. A CPU value of "x" (or *), in the argument list for the -c option, indicates that binding should not be done for that process. The value "x" should be used only if the -e option is also used. Note that CPU numbers start at 0. For striding patterns, any subset of the characters (B)lade, (S)ocket, (C)ore, (T)hread may be used; their ordering specifies the nesting of the iteration. For example, SC means to iterate all the cores in a socket before moving to the next CPU socket, while CB means to pin to the first core of each blade, then the second core of every blade, and so on. For best results, use the -e option when using stride patterns. If the -c option is not specified, all CPUs of the current cpuset are available. The command itself (which is "execed" by dplace) is the first process to be placed by the -c cpu_numbers. Without the -e option, the order of numbers for the -c option is not important.
Examples of dplace UsageFor OpenMP Codes
To check the thread placement, you can add the -o option to create a log:
Or use the following command on the running host while the job is still running:
Sample Output of log_file
Sample Output of placement.out
Note: Intel OpenMP jobs use an extra thread that is unknown to the user and it does not need to be placed. In the above example, this extra thread (31046) is running on core number 0. For MPI Codes Built with HPE's MPT LibraryWith HPE's MPT, only 1 shepherd process is created for the entire pool of MPI processes, and the proper way of pinning using dplace is to skip the shepherd process. Here is an example for Endeavour:
If the number of processes in each node is less than the number of cores in that node, choose how you want to place the processes carefully. Below is just an example:
To check the placement, you can set MPI_DSM_VERBOSE, which prints the placement in the PBS stderr file:
Output in PBS stderr File
If you use the -o log_file flag of dplace, the CPUs where the processes/threads are placed will be printed, but the node names are not printed.
Output in log_file
For MPI Codes Built with MVAPICH2 LibraryWith MVAPICH2, 1 shepherd process is created for each MPI process. You can use ps -L -u your_userid on the running node to see these processes. To properly pin MPI processes using dplace, you cannot skip the shepherd processes and must use the following:
|