Skip to content

Julia seems to ignore process affinity settings on Linux #34415

@oschulz

Description

@oschulz

Julia (tested with v1.0 and v1.3) currently seems to ignore (or escape from) process affinity settings on Linux. This is a problem in HPC computing contexts (but also in other scenarios), e.g. when trying to run one Julia process per NUMA domain.

Let's say we have a machine with 16 virtual cores (8 * 2):

$ numactl -s
policy: default
preferred node: current
physcpubind: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
[...]

Now we use numactl to pin a process to CPUs 1 and 2, that process being a numactl -s to check that the limitation is actually in effect:

$ numactl --physcpubind=1,2 -- numactl -s
policy: default
preferred node: current
physcpubind: 1 2 
[...]

Now with numactl running numactl -s via julia:

$ numactl --physcpubind=1,2 -- julia -E 'run(`numactl -s`)'
policy: default
preferred node: current
physcpubind: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
[...]

Within Julia, the pinning to CPUs 1 and 2 is gone. I see the same when running multi-threaded Julia code (Julia multi-threading or BLAS via Julia): All CPUs are used, instead of just the selected ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    multithreadingBase.Threads and related functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions