calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
286 stars 93 forks source link

Error while running a big model #79

Closed arnaud-leroy closed 6 years ago

arnaud-leroy commented 6 years ago

Hello,

I am running a model with 26 locations and 20 technologies over 8784 hours. The preprocessing was successful but an error appears while solving the model:

Error in run command:
CRITICAL Solver output:
Error in run_command:
local variable 'th' referenced before assignment
Calliope run aborted due to an error. Elapsed: 23838.2 seconds (time at exit: 2017-11-09 22:37:19)

Because the model is working well for much smaller timesteps, I am suspecting a lack of memory. But it is maybe something else.

Thanks for your help! Arnaud

sjpfenninger commented 6 years ago

Yes, it seems like perhaps the solver runs out of memory. Do you have an indication of what memory usage looks like during the run?

sjpfenninger commented 6 years ago

Assuming you are using calliope run , can you re-run with calliope run --debug so we see more output on what's going wrong?

arnaud-leroy commented 6 years ago

Thanks! No, I don't have a precise way to measure the memory consumption on that server during the run. But I will run it with --debug to have more information.

At the same time, we are trying to increase our available memory. I think another solution may be to use a lower timestep (every 2 or 3 hours).

louischaman commented 6 years ago

I get the same error. Trace stack is:

Traceback (most recent call last): File "run_dates.py", line 42, in <module> raise(inst) File "run_dates.py", line 36, in <module> model_2.run() File "/home/ubuntu/calliope_dir/calliope/calliope/core.py", line 1368, in run self.solve() File "/home/ubuntu/calliope_dir/calliope/calliope/core.py", line 1475, in solve self.results, warnmsg = self._solve_with_output_capture(warmstart, solver_kwargs) File "/home/ubuntu/calliope_dir/calliope/calliope/core.py", line 1411, in _solve_with_output_capture return self._solve(warmstart, solver_kwargs) File "/home/ubuntu/calliope_dir/calliope/calliope/core.py", line 1427, in _solve results = self.opt.solve(self.m, tee=True, **solver_kwargs) File "/home/ubuntu/miniconda3/envs/cal/lib/python3.6/site-packages/pyomo/opt/base/solvers.py", line 589, in solve _status = self._apply_solver() File "/home/ubuntu/miniconda3/envs/cal/lib/python3.6/site-packages/pyomo/opt/solver/shellcmd.py", line 242, in _apply_solver self._rc, self._log = self._execute_command(self._command) File "/home/ubuntu/miniconda3/envs/cal/lib/python3.6/site-packages/pyomo/opt/solver/shellcmd.py", line 305, in _execute_command tee = self._tee File "/home/ubuntu/miniconda3/envs/cal/lib/python3.6/site-packages/pyutilib/subprocess/processmngr.py", line 673, in run_command th.join() UnboundLocalError: local variable 'th' referenced before assignment

arnaud-leroy commented 6 years ago

I suspect it is due to the memory, because the model worked at higher time-step

sjpfenninger commented 6 years ago

This is definitely a memory issue causing Pyomo to fail, which to some extent we can do nothing about when models get really large (though 0.6.x improves things). Closing this as we are tracking that general issue in #69.