Relying on first-touch-policy, a generic strategy is to allocate arrays in the same multi-threaded manner as they will later be used by the computational kernel. E.g., instead of using the serial rand or zeros functions, initialize the arrays using, say, @threads :static. Example: stream benchmark.
If you don’t want to rely on first-touch, you can use tools like numactl or ArrayAllocators.jl.
Update: @27rabbitlt Of course, in any case, you should pin your Julia threads, see here.