Zhiyu014/GNN-UDS

Issue with Multi-Simulation Error during Data Label Generation

Closed this issue · 2 comments

Hello,

I've encountered an issue while trying to generate labels with the following command:

python main.py --simulate --env chaohu --data_dir edge_hc --edge_fusion

The error message received was:

~/surrogate$ CUDA_VISIBLE_DEVICES=1 python main.py --simulate --env chaohu --data_dir edge_hc --edge_fusion 
Training configs: Namespace(act='False', activation='relu', balance=0, batch_size=256, conv='GCNconv', data_dir='./envs/data/chaohu/edge_hc', directed=False, dropout=0.0, edge_fusion=True, embed_size=128, env='chaohu', epochs=500, epsilon=-1.0, hidden_dim=64, hotstart=False, if_flood=0, kernel_size=3, learning_rate=0.001, length=0, load_model=False, model_dir='./model/chaohu/', n_out=3, n_sp_layer=2, n_tp_layer=2, norm=False, order=1, processes=5, rain_dir='./envs/config/', rain_num=50, rain_suffix='chaohu', ratio=0.8, recurrent='GRU', repeats=1, resnet=False, result_dir='./results/chaohu/', save_gap=500, seq_in=6, seq_out=1, setting_duration=5, simulate=True, test=False, train=False, use_adj=False, use_edge=False)
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/raid/home/dgxuser4/anaconda3/envs/GNN-UDS/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/raid/home/dgxuser4/raid/hydraulic_prediction/GNN-UDS/surrogate/dataloader.py", line 30, in simulate
    state = self.env.reset(event,global_state=True,seq=seq)
  File "/raid/home/dgxuser4/raid/hydraulic_prediction/GNN-UDS/surrogate/envs/scenario/base.py", line 208, in reset
    self.env = env_base(self.config, ctrl=True)
  File "/raid/home/dgxuser4/raid/hydraulic_prediction/GNN-UDS/surrogate/envs/environment/environment_base.py", line 50, in __init__
    super().__init__(config, ctrl, binary)
  File "/raid/home/dgxuser4/anaconda3/envs/GNN-UDS/lib/python3.8/site-packages/pystorms/environment.py", line 52, in __init__
    self.sim = Simulation(self.config["swmm_input"])
  File "/raid/home/dgxuser4/anaconda3/envs/GNN-UDS/lib/python3.8/site-packages/pyswmm/simulation.py", line 100, in __init__
    raise(MultiSimulationError("Multi-Simulation Error."))
pyswmm.errors.MultiSimulationError: Multi-Simulation Error.

        Due to architectural limitations inside of EPA-SWMM
        multiple Simulations cannot be completed within a single
        instance of Python.  Consider launching the model runs
        using a Python Subprocess and a Queue manager.

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 158, in <module>
    dG.generate(events,processes=args.processes,repeats=args.repeats,act=args.act)
  File "/raid/home/dgxuser4/raid/hydraulic_prediction/GNN-UDS/surrogate/dataloader.py", line 71, in generate
    res = [r.get() for r in res]
  File "/raid/home/dgxuser4/raid/hydraulic_prediction/GNN-UDS/surrogate/dataloader.py", line 71, in <listcomp>
    res = [r.get() for r in res]
  File "/raid/home/dgxuser4/anaconda3/envs/GNN-UDS/lib/python3.8/multiprocessing/pool.py", line 768, in get
    raise self._value
pyswmm.errors.MultiSimulationError: Multi-Simulation Error.

        Due to architectural limitations inside of EPA-SWMM
        multiple Simulations cannot be completed within a single
        instance of Python.  Consider launching the model runs
        using a Python Subprocess and a Queue manager.


        Due to architectural limitations inside of EPA-SWMM
        multiple Simulations cannot be completed within a single
        instance of Python.  Consider launching the model runs
        using a Python Subprocess and a Queue manager.

This suggests that the SWMM simulations cannot be executed concurrently in a single Python instance. I am running this on an Ubuntu system with Python 3.8.2. I followed the steps outlined in the README for generating data. Could you please advise on how to resolve this or provide any additional steps I may need to ensure proper execution?

Thank you!

Hello,

I've managed to resolve the issue previously reported. Initially, I had installed libraries from requirements.txt, which led to the problem. I have now installed the libraries from requirements2.txt, which has fixed the issue.

Thank you for the support!

Thanks for your interests in this repo. This issue comes from the pyswmm 2.0 update, as I'm still using pyswmm==1.5.1.