linux - how to stop(or terminate ) MPI_Recv after some perticular time when there is deadlock in MPI? -
i trying detect deadlocks in mpi
is there method in can jump function mpi_recv after particular time.
mpi_recv blocking function , sit there untill receives data waiting for, if looking have timeout , error if things lock don't think that's 1 you.
you using mpi_irecv, non-blocking version. emulate blocking behaviour of mpi_recv using mpi_wait or mpi_test.
if use combination of mpi_irecv , mpi_test make snippet waits recieve specified length of time, errors if hasn't. rough example:
mpi_irecv(..., &request); //start receive request, non-blocking time_t start_time = time(); //get start time mpi_test(&request, &gotdata, ...); //test, have got yet //loop until have received, or taken long while (!gotdata && difftime(time(),start_time) < timeout_time) { //wait bit. mpi_test(&request, &gotdata, ...); //test again } //by either have received data, or taken long, so... if (!gotdata) { //we must have timed out mpi_cancel(&request); mpi_request_free(&request); //throw error }
Comments
Post a Comment