How to verify process affinity?

Home Forums Using vSMP Foundation How to verify process affinity?

This topic contains 1 reply, has 2 voices, and was last updated by  Tal 5 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3048

    Kevin
    Participant

    Hi,

    I am learning a lot about process affinity using numactl and other methods. I cannot find the method to verify that the process started with numactl is actually binding to the correct cores/nodes. So, I am looking for the command to list the cores/nodes where the process is running and bound. I thought this info was in proc and could be parsed with perl or another scripting option.

    If there is a method or a script available please post a link or not describing howto.

    Thank you,
    Kevin

    #3049

    Tal
    Participant

    Hi Kevin,

    The easiest way to find the CPU affinity of a process is using the taskset command:

    taskset -pc <pid>

    will report the CPU affinity as a list of the CPU numbers.

    taskset -p <pid>

    will report the CPU affinity as a mask of the CPUs included.

    If you are looking for the information in /proc, check the file /proc/<pid>/status.
    The lines you are looking for are (as in this example):

    Cpus_allowed: 0100
    Cpus_allowed_list: 8

    I hope this helps (/proc information may not be available in all kernels).

    Tal Nevo
    ScaleMP Inc.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.