Skip to content

Commit 2f7f8d0

Browse files
committed
Implement backoff in AsyncMPISend
1 parent 9b4d361 commit 2f7f8d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

distributed/comm/mpi.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class AsyncMPISend:
102102
def __init__(self, msg, target, tag):
103103
self._request = _mpi_comm.isend(msg, dest=target, tag=tag)
104104
self._lock = threading.Lock()
105+
self._sleep_time = 0.001
105106
if log_msg_time:
106107
self._start = time.time()
107108
if log_msg:
@@ -121,7 +122,8 @@ def __await__(self):
121122
seconds = time.time() - self._start
122123
logger.debug(f"AsyncMPISend milliseconds={seconds*1000:.3f}")
123124
return True
124-
yield from asyncio.sleep(_polling_time).__await__()
125+
yield from asyncio.sleep(self._sleep_time).__await__()
126+
self._sleep_time *= 2 # Backoff.
125127

126128
def cancel(self):
127129
with self._lock:

0 commit comments

Comments
 (0)