1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 09:39:36 +00:00

Small simplifications and code cleanup

Non-functional simplifications.
This commit is contained in:
noobpwnftw 2018-07-18 22:36:36 +08:00 committed by Stéphane Nicolet
parent 0d6cdc0c6d
commit 3730ae1efb

View file

@ -127,21 +127,20 @@ bool getline(std::istream& input, std::string& str) {
// Some MPI implementations use busy-wait pooling, while we need yielding // Some MPI implementations use busy-wait pooling, while we need yielding
static MPI_Request reqInput = MPI_REQUEST_NULL; static MPI_Request reqInput = MPI_REQUEST_NULL;
MPI_Ibarrier(InputComm, &reqInput); MPI_Ibcast(&size, 1, MPI_UNSIGNED_LONG, 0, InputComm, &reqInput);
if (is_root()) if (is_root())
MPI_Wait(&reqInput, MPI_STATUS_IGNORE); MPI_Wait(&reqInput, MPI_STATUS_IGNORE);
else { else {
while (true) { while (true) {
static int flag; int flag;
MPI_Test(&reqInput, &flag, MPI_STATUS_IGNORE); MPI_Test(&reqInput, &flag, MPI_STATUS_IGNORE);
if (flag) if (flag)
break; break;
else else {
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
} }
} }
}
MPI_Bcast(&size, 1, MPI_UNSIGNED_LONG, 0, InputComm);
if (!is_root()) if (!is_root())
vec.resize(size); vec.resize(size);
MPI_Bcast(vec.data(), size, MPI_CHAR, 0, InputComm); MPI_Bcast(vec.data(), size, MPI_CHAR, 0, InputComm);