4

I have encountered an error which I did not have before when running the optimizer locally.

The problem:

I was running my optimization problem in VS Code and wanted to cancel the execution, so I used ctrl+C in the terminal window. After that, I am unable to run my code locally. The code does run with remote = True, but I want to run locally and I need to run it on Win10 Pro OS. I am using Windows 10 Pro with python 3.7.4. The error I get now is:

----------------------------------------------------------------
 APMonitor, Version 0.9.2
 APMonitor Optimization Suite
 ----------------------------------------------------------------


Error: At line 1187 of file custom.f90
Traceback: not available, compile with -ftrace=frame or -ftrace=full
Operating system error: Not enough memory resources are available to process this command.

Memory allocation failed

Error: 'results.json' not found. Check above for additional error details

How do I "compile with -ftrace=frame or -ftrace=full" as is suggested?

What I have tried:

-I have reinstalled all python packages for my environment. -I removed python completely and uninstalled all pip packages. -I have installed Anaconda 3 with Python 3.7.6 and reinstalled gekko + dependencies. -I have ran my code on a Ubuntu machine running 18.04, Anaconda3 with Python 3.7.6 and this can run locally with m.GEKKO(remote = False).

None of this has helped for the windows version and I feel like the code should be fine, since it ran before and can run on Linux without issue.

I want to reiterate, I do NOT get this error with m.GEKKO(remote = True). So I must have ruined something on my machine? My code concerns implementation of a scientific paper and thus I hesitate to share the code here. If code is necessary to reproduce the error, I can send this via a secure channel to the gekko developers.

Would appreciate any help to resolve this.

Best regards, JL

1 Answers1

0

Even though you stopped the Python script with Ctrl-C, your prior job sub-process may still be running in the background and consuming resources when running with remote=False. If you were able to run it previously, I recommend that you check if apm is running in the background with top at the command terminal. You can locate the PID of apm with:

pidof apm

You can either kill (stop) the process with the PID identifier or else kill all of the apm processes with:

killall -9 apm

This should release the resources (RAM, CPU) necessary to run your next job. The apm executable allocates memory dynamically at run-time based on how much the solver and model will need. If you are consistently running out of memory then I recommend the APOPT solver that uses fewer resources than IPOPT (default solver). You can switch to APOPT with m.options.SOLVER=1. I don't think you did anything to your installation. If disk space is an issue, you can clear out the temp folder m.path where the Gekko problem is staged.

John Hedengren
  • 12,068
  • 1
  • 21
  • 25
  • 1
    Hi, It has been a few days and the computer has been not been used. When I tried it now with m.options.SOLVER=1 I am able to run the optimization. Thanks! – user3507910 Mar 06 '20 at 09:32
  • I'm glad it works now. Did you need to kill the `apm` processes or did you just let the other jobs finish? The `APOPT` solver uses much less RAM so you shouldn't have the problem again. – John Hedengren Mar 07 '20 at 14:42
  • 1
    I cleared the CPU chache, restared the computer and then switched to APOPT. That worked for me. – user3507910 Mar 09 '20 at 07:56