EPyT icon indicating copy to clipboard operation
EPyT copied to clipboard

EPyT crashes when the same .inp is opened by another process

Open andreArtelt opened this issue 1 year ago • 3 comments

Currently, EPyT (and EPANET) crashes when the same .inp is opened by another process -- e.g. this could happen when simulating scenarios in parallel.

I think the crash comes from the fact that the .bin, temporary, and report file names are derived from the .inp file in a deterministic manner -- i.e. the same .inp file always leads to the same temporary, report, and .bin file names.

I see two potential solutions:

  1. Allow the user to specify the temporary, report, and .bin file names.
  2. Add a random component (e.g. random number) to the file names such that those are never the same.

Happy to discuss this issue and work together on a solution.

andreArtelt avatar Jun 12 '24 08:06 andreArtelt

Hi @andreArtelt, can you use the function loadEPANETFile (inp, txt/rpt, bin)?

Check EMT examples:

https://github.com/OpenWaterAnalytics/EPANET-Matlab-Toolkit/blob/master/examples/EX24_Parallel_computations.m

https://github.com/OpenWaterAnalytics/EPANET-Matlab-Toolkit/blob/master/examples/EX27_Fasted_Parallel_computation.m

Mariosmsk avatar Jun 12 '24 10:06 Mariosmsk

But how/when do I call it? First, I would have to create a new instance by calling epanet -- this will create these temporary files automatically. Also, does a similar function exist for .msx files? loadMSXFile does not allow me to change the naming of the temporary files.

andreArtelt avatar Jun 12 '24 11:06 andreArtelt

What is the status of this issue? For me, this is kind of an urgent issue because it also hinders the training of RL agents in parallel.

Let me know if I can help resolve this issue.

andreArtelt avatar Jul 12 '24 11:07 andreArtelt