Skip to content
Snippets Groups Projects
Commit a85f0419 authored by Brandon Rodriguez's avatar Brandon Rodriguez
Browse files

Remove outdated logic that made communication much slower than necessary

parent 01b4256a
No related merge requests found
...@@ -196,7 +196,6 @@ int worker_check_status() { ...@@ -196,7 +196,6 @@ int worker_check_status() {
* :param possible_donor: Fellow worker thread to beg for work from. * :param possible_donor: Fellow worker thread to beg for work from.
*/ */
void worker_send_request(thread_struct* thread_args_ptr, int possible_donor) { void worker_send_request(thread_struct* thread_args_ptr, int possible_donor) {
int msg_status_flag = 0;
char* log_msg = calloc(256, sizeof(char)); char* log_msg = calloc(256, sizeof(char));
int req_buffer = 0; int req_buffer = 0;
MPI_Request request_var; MPI_Request request_var;
...@@ -213,24 +212,8 @@ void worker_send_request(thread_struct* thread_args_ptr, int possible_donor) { ...@@ -213,24 +212,8 @@ void worker_send_request(thread_struct* thread_args_ptr, int possible_donor) {
exit(2); exit(2);
} }
// Ensure thread isn't currently sending a message to this thread. If so, abort. // Initialilze interaction by sending a "begging message" for work.
MPI_Iprobe(possible_donor, tag_work_request, MPI_COMM_WORLD, &msg_status_flag, MPI_STATUS_IGNORE); MPI_Isend(&req_buffer, 1, MPI_INT, possible_donor, tag_work_request, MPI_COMM_WORLD, &request_var);
if (msg_status_flag != 1) {
sleep(1);
// Ensure that there is still possible work to do.
if (worker_check_status() == 1) {
// Double check that donor does not have waiting request. To try to prevent race conditions.
// (I don't know how to properly "mutex lock" out entirely separate processes, when they can't share memory)
MPI_Iprobe(possible_donor, tag_work_request, MPI_COMM_WORLD, &msg_status_flag, MPI_STATUS_IGNORE);
if (msg_status_flag != 1) {
// Initialilze interaction by sending a "begging message" for work.
MPI_Isend(&req_buffer, 1, MPI_INT, possible_donor, tag_work_request, MPI_COMM_WORLD, &request_var);
}
}
}
log("EXIT FUNCTION worker_send_request()"); log("EXIT FUNCTION worker_send_request()");
log(""); log("");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment