MPI不使用多个处理器

时间:2015-07-27 22:17:16

标签: python parallel-processing mpi mpi4py

我正在运行以下代码:

$query = $this->em->createQuery(
        "SELECT a FROM Restaurant a 
            INNER JOIN Review r 
            order by count(a.reviews) ");

使用以下命令

#hello.py
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
print "hello world from process ", rank

,输出如下:

mpiexec  -n 5 python  hello.py

预计会是这样的:

hello world from process  0
hello world from process hello world from process  0
hello world from process  0
hello world from process  0
 0

运行hello world from process 0 hello world from process 1 hello world from process 3 hello world from process 2 hello world from process 4 会返回以下内容:

cat /proc/cpuinfo

所以,我的电脑显然不止一个处理器。那为什么我没有得到预期的输出?

我通过processor : 7 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz stepping : 7 microcode : 0x1b cpu MHz : 800.000 cache size : 6144 KB physical id : 0 siblings : 8 core id : 3 cpu cores : 4 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes 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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid bogomips : 4390.34 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:

点击pip下载了mpi4py

0 个答案:

没有答案