mbbce
mbbce

Reputation: 2303

MPI: Report Bindings

I am running an MPI program with specific bindings using -rankfile and -hostfile flags. How can I check if the proper bindings were made (just to be sure)? I have tried the --report-bindings flag. Something like:

mpirun --report-bindings -rankfile rank_file -hostfile host_file -n 16 ./$prog

However, it does not provide me any output. I am using Open MPI version 1.5.4. What am I doing wrong?

Upvotes: 2

Views: 2274

Answers (1)

Hristo Iliev
Hristo Iliev

Reputation: 74395

It is probably that your standard error, where the odls framework is printing the binding information, is being redirected somewhere. It works for me with Open MPI 1.5.3:

$ mpiexec --report-bindings -rankfile rank_file -hostfile host_file \
          -n 4 hostname
host
[host:18314] [[35226,0],0] odls:default:fork binding child [[35226,1],0] to slot_list 0
[host:18314] [[35226,0],0] odls:default:fork binding child [[35226,1],1] to slot_list 1
[host:18314] [[35226,0],0] odls:default:fork binding child [[35226,1],2] to slot_list 0
[host:18314] [[35226,0],0] odls:default:fork binding child [[35226,1],3] to slot_list 1
host
host
host

If the library fails to report the bindings for whatever reason, you could use a simple script to check if the binding is actually taking place:

#!/bin/sh

cpuset=$(cat /proc/self/status | grep Cpus_allowed_list | awk '{print $2;}')
echo "Rank $OMPI_COMM_WORLD_RANK bound to core(s) $cpuset"

Simply name it report_bindings and run it via mpiexec:

$ mpiexec --report-bindings -rankfile rank_file -hostfile host_file \
          -n 4 report_bindings
Rank 1 bound to core(s) 8
Rank 0 bound to core(s) 0
Rank 3 bound to core(s) 8
Rank 2 bound to core(s) 0

Upvotes: 4

Related Questions