====================================================================
| 443 | |
| 444 | // ==================================================================== |
| 445 | G4bool G4MPImanager::CheckThreadStatus() |
| 446 | { |
| 447 | unsigned buff; |
| 448 | unsigned qstatus = 0; |
| 449 | |
| 450 | if (is_master_) { |
| 451 | qstatus = (thread_id_ != 0); |
| 452 | // get slave status |
| 453 | for (G4int islave = 1; islave < size_; islave++) { |
| 454 | MPI_Request request; |
| 455 | MPI_Irecv(&buff, 1, MPI_UNSIGNED, islave, kTAG_G4STATUS, COMM_G4COMMAND_, &request); |
| 456 | int flag = 0; |
| 457 | while (!flag) { |
| 458 | MPI_Test(&request, &flag, MPI_STATUS_IGNORE); |
| 459 | ::Wait(1000); |
| 460 | } |
| 461 | |
| 462 | qstatus |= buff; |
| 463 | } |
| 464 | } |
| 465 | else { |
| 466 | buff = (thread_id_ != 0); |
| 467 | MPI_Send(&buff, 1, MPI_UNSIGNED, kRANK_MASTER, kTAG_G4STATUS, COMM_G4COMMAND_); |
| 468 | } |
| 469 | |
| 470 | // broadcast |
| 471 | buff = qstatus; // for master |
| 472 | MPI_Bcast(&buff, 1, MPI_UNSIGNED, kRANK_MASTER, COMM_G4COMMAND_); |
| 473 | qstatus = buff; // for slave |
| 474 | |
| 475 | if (qstatus != 0) |
| 476 | return true; |
| 477 | else |
| 478 | return false; |
| 479 | } |
| 480 | |
| 481 | // -------------------------------------------------------------------------- |
| 482 | void G4MPImanager::ExecuteThreadCommand(const G4String& command) |
no test coverage detected