【问题标题】:MPI: Report BindingsMPI:报告绑定
【发布时间】:2014-08-05 03:08:03
【问题描述】:

我正在使用 -rankfile-hostfile 标志运行具有特定绑定的 MPI 程序。我如何检查是否进行了正确的绑定(只是为了确定)?我试过--report-bindings 标志。比如:

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

但是,它没有为我提供任何输出。我正在使用 Open MPI 1.5.4 版。我做错了什么?

【问题讨论】:

    标签: mpi openmpi


    【解决方案1】:

    可能是您的标准错误(odls 框架正在打印绑定信息)被重定向到某个地方。它适用于我的 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
    

    如果库由于某种原因未能报告绑定,您可以使用一个简单的脚本来检查绑定是否实际发生:

    #!/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"
    

    只需将其命名为 report_bindings 并通过 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
    

    【讨论】:

    • 很好用。我不知道为什么 --report-bindings 标志没有提供信息。也许我有什么问题。我倾向于对程序输出有这个问题。有时它只是开始给我没有关于输出的信息,但如果我在代码中添加另一个 cout 指令,一切正常。我应该补充一点,这不是因为刷新,因为函数已被相应地调用。
    • 老实说我不知道​​。通常 Open MPI 的 I/O 重定向非常健壮。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多