[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sumo-user] Multiple TraCI calls for multiprocessing
|
try assigning a port manually instead of relying on get_free_port as there might be race conditions between get_free_port and binding to that port.
Dear community,
I am attempting to run multiple parallel processes using multiprocessing
along with Optuna
for hyperparameter optimization. While each individual run executes correctly, I am encountering an issue where traci
fails to connect to SUMO when running in parallel (via n_jobs > 1
).
To manage separate instances, I ensure each process uses a different TCP port by calling a get_free_port()
function (see snippet below), and I pass this port into my function, which initializes the SUMO simulation and connects via traci
.
def get_free_port() -> int:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind(('', 0))
return s.getsockname()[1]
Despite assigning unique ports to each trial, the subprocesses fail to establish a connection to SUMO. The error typically occurs at the point where traci
tries to connect.
I'm using:
Do you have any insight into what might be causing traci
to fail under parallel execution? Are there known issues or best practices for handling multiple simultaneous SUMO instances?
Any guidance or suggestions would be greatly appreciated.
Thanks and regards,
Rohan
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user