0

Question

How do I run two benchmarks such that:

  • They are both executing concurrently
  • Both benchmarks have half their threads on each socket.
  • No two threads share the same core.

Background

I have two programs: a benchmark written Fortran and a benchmark written in C. They both implement the OpenMP library, and are set to .

I am currently attempting to spread the threads of both processes across multiple sockets while preventing any two threads from having to share the same core. OpenMP allows for threads to be evenly distributed across multiple sockets using the OMP_PROC_BIND=spread environment variable. However, when executing both programs simultaneously, I end up with both benchmarks sharing the same cores.

I am running these benchmarks on a server that has two 12-core Haswell-E CPUs, and I have the benchmarks set to create 12 threads a piece, so there's no shortage of cores. I'm currently running CentOS 7.3.1611.

Side Note

I'm aware this is a strange configuration, however it is required for performance analysis. Many thanks in advance to all those who have input on this subject.

1 Answers1

0

First: get your cpu layout from /proc/cpuinfo, that will look something like (this is on a 2-socket, 6-core, listing truncated):

> cat /proc/cpuinfo |grep -P 'processor|physical id|core id'
processor : 0
physical id : 1
core id   : 0
processor : 1
physical id : 0
core id   : 0
processor : 2
physical id : 1
core id   : 1
processor : 3
physical id : 0
core id   : 1

physical-id will be your socket, notice in my case, the core-id's toggle between sockets.

use 'schedtool' to set the affinity of 1 group to all be on 1 physical id. So in my case, since the evens and odds are on separate physical cpus(sockets), I'd use:

schedtool -a 0,2,4,6,8,10 -e run_group1 &
schedtool -a 1,3,5,7,9,11 -e run_group2 &

where run_group1 starts all your threads you want on 1 core, and run_group2 starts the other ones. (look at 'man schedtool' (in section 8 for more options. I put both of them in background so both groups should run concurrently.

You might need to be root to set affinity -- not sure.

Does that solve your Q or did I misunderstand something?

Astara
  • 659