四核上的 mpi4py - 只有 1 个处理器?

问题描述

我正在尝试在具有运行 Fedora 33 的四核处理器的系统上设置 mpi4py。我假设我应该有 8 个可用进程,但是当我运行测试脚本时,我只看到大小为1 并且所有进程都返回 0。我尝试设置主机列表文件以及在命令行上指定多个主机,但结果始终相同。

除了非常简单的 mpi4py 指令安装之外,我似乎找不到任何信息,但显然有些问题。感谢您提供有关如何诊断此问题的任何建议。

我尝试运行的脚本名为 mpi_test.py:

from mpi4py import MPI

comm = MPI.COMM_WORLD
print('%d of %d' % (comm.Get_rank(),comm.Get_size()))

一个简单的命令行执行和结果是:

mpiexec -np 4 python mpi_test.py   
                                                          
0 of 1
0 of 1
0 of 1
0 of 1

使用这个主机文件(kanagawa 是我的主机名):

kanagawa:4

我看到了:

mpiexec -np 4 -f hostfile  python mpi_test.py                                                    

0 of 1
0 of 1
0 of 1
0 of 1

并在命令行上指定主机/进程:

mpiexec -np 4 -hosts kanagawa,kanagawa,kanagawa python mpi_test.py   
               
0 of 1
0 of 1
0 of 1
0 of 1

这台机器的处理器规格:

lscpu    
                                                                                        
Architecture:                    x86_64
cpu op-mode(s):                  32-bit,64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical,48 bits virtual
cpu(s):                          8
On-line cpu(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
vendor ID:                       GenuineIntel
cpu family:                      6
Model:                           142
Model name:                      Intel(R) Core(TM) i7-8550U cpu @ 1.80GHz
Stepping:                        10
cpu MHz:                         800.228
cpu max MHz:                     4000.0000
cpu min MHz:                     400.0000
BogoMIPS:                        3999.93
Virtualization:                  VT-x
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        8 MiB
NUMA node0 cpu(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: VMX disabled
Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes,SMT vulnerabl
                                 e
Vulnerability mds:               Mitigation; Clear cpu buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline,IBPB conditional,IBRS_FW,STIBP co
                                 nditional,RSB filling
Vulnerability Srbds:             Mitigation; microcode
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
                                  clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdt
                                 scp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology n
                                 onstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est
                                  tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popc
                                 nt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dNowprefet
                                 ch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow v
                                 nmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi
                                 2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec 
                                 xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hw
                                 p_epp md_clear flush_l1d

编辑:

我在几个 RaspBerry Pi 系统上测试了相同的设置,它按预期工作:

mpiexec -n 6 --machinefile briar_hosts python -m mpi4py.bench helloworld

Hello,World! I am process 0 of 6 on briar.
Hello,World! I am process 1 of 6 on briar.
Hello,World! I am process 2 of 6 on Berry00.
Hello,World! I am process 3 of 6 on Berry00.
Hello,World! I am process 4 of 6 on Berry00.
Hello,World! I am process 5 of 6 on Berry00.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)