optimum_benchmark/process_utils.py (9 lines of code) (raw):

from multiprocessing.connection import Connection from typing import TypeVar DeserializedType = TypeVar("DeserializedType") def sync_with_parent(child_connection: Connection) -> None: child_connection.recv() child_connection.send(0) def sync_with_child(parent_connection: Connection) -> None: parent_connection.send(0) parent_connection.recv()