마스터 프로세스에서만 수행 할 수있는 작업을 수행해야합니다. 노예들은 아무 것도 할 수 없지만 주인이 끝날 때까지 기다립니다. 그래서 저는 (. 내가 코멘트가 내가 뭐하는 거지 설명에서 충분히 명확 바랍니다 내가 가장 루틴을 포장, 그래서 힘든 시간이 실제 MPI 코드로 오는 것, 의사) 다음했다MPI_Bcast를 사용하여 동기화 할 수 있습니까?
def routine():
if not isMaster():
# I am a slave. I just sit here, waiting for the master to finish.
# wait for a string from the master explaining the state
string = MPI_Bcast("whatever", 0)
return (string == "SUCCESS")
<master does its long running business>
string = MPI_Bcast("SUCCESS", 0) # tell the slaves it worked fine.
return True
합니까 이 작품, 아니면 내가 방송을 오용 하는가?
def routine():
if not isMaster():
# I am a slave. I just sit here, waiting for the master to finish.
# wait for a string from the master explaining the state
string = MPI_Bcast("whatever", 0)
return (string == "SUCCESS")
else:
<master does its long running business>
string = MPI_Bcast("SUCCESS", 0) # tell the slaves it worked fine.
return True
것은 그럼 당신은 괜찮을 것 : 당신이 그 의사를 한 경우
'MPI_Bcast'의 루트 랭크가'isMaster()'술어에서 사용 된 것과 일치하는지 확인하십시오. –