我试图找到一种适当的方法来收集从并行编程中从从站返回到主站的值。我之前曾问过类似的问题,关于如何划分工作来计算曼德布洛特的像素。我得到了如何发送作品的答案,但仍在努力研究如何收集数据并将其绘制为像素。
节点 0:(主)
节点1:(从)
v[0] = {2,3,4,5,67,86,56,5} // core 0 holds value of 8 threads of this core
v[1] = {12,21,4,3,54,65,6,5,4} // core 1 holds value of 9 threads of this core
v[2] = {1,3,4,54,6,5,65,7,4} //core 2 holds value of 9 threads of this core
节点2:(奴隶)
v[0] = {2,3,4,5,67,86,56,5} // core 0
v[1] = {12,21,4,3,54,65,6,5,4} // core 1
v[2] = {1,3,4,54,6,5,65,7,4} //core 2
节点3:(奴隶)
v[0] = {2,3,4,5,67,86,56,5} // core 0
v[1] = {12,21,4,3,54,65,6,5,4} // core 1
v[2] = {1,3,4,54,6,5,65,7,4} //core 2
所以当主人想要这些值时,奴隶应该附加向量并发送还是有其他更好的方法将值传递给主人?