0

I'm running the following code:

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

with the following command,

mpiexec  -n 5 python  hello.py

and the output is like this:

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

where it is expected to be like this:

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

Running the cat /proc/cpuinfo returns the following:

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:

So, my PC has clearly more than a single processor. Then why am I not getting the expected output ?

I downloaded mpi4py through pip via pip install mpi4py

4

0 回答 0