【发布时间】:2013-01-25 09:18:05
【问题描述】:
在 MPI 中,有像 MPI_Isend 和 MPI_Irecv 这样的非阻塞调用。
如果我正在处理 p2p 项目,服务器会监听许多客户端。
一种方法:
for(int i = 1; i < highest_rank; i++){
MPI_Irecv(....,i,....statuses[i]); //listening to all slaves
}
while(true){
for( int i = 1; i < highest_rank; i++){
checkStatus(statuses[i])
if true do somthing
}
我可以做到的另一种旧方法是:
Server creating many POSIX threads, pass in a function,
that function will call MPI_Recv and loop forever.
理论上,哪一个在服务器端执行得更快?如果有其他更好的方法来编写服务器,也请告诉我。
【问题讨论】:
标签: client-server mpi p2p