我为每个处理器(假设3个处理器)的本地数组(名为lvotes)赋值,每个处理器的第一个元素存储一个值,即:
P0 : 4
P1 : 6
p2 : 7
Run Code Online (Sandbox Code Playgroud)
现在,使用MPI_Gather,我希望将它们全部收集在P0中,所以它看起来像:
P0 : 4, 6, 7
Run Code Online (Sandbox Code Playgroud)
我用这种方式收集:
MPI_Gather(lvotes, P, MPI_INT, lvotes, 1, MPI_INT, 0, MPI_COMM_WORLD);
Run Code Online (Sandbox Code Playgroud)
但是我遇到了问题.这是我第一次使用MPI进行编码.我可以使用任何建议.谢谢
我有一个如下所示的数组,我希望在一个单独的数组中得到'id'前面的所有值.喜欢:arry('12','10','11','9')
array
3 =>
array
'occurance' => int 4
'id' => string '12' (length=2)
1 =>
array
'occurance' => int 3
'id' => string '10' (length=2)
2 =>
array
'occurance' => int 2
'id' => string '11' (length=2)
0 =>
array
'occurance' => int 1
'id' => string '9' (length=1)
Run Code Online (Sandbox Code Playgroud)