User Tools

Site Tools


How much Memory (RAM) does my GAMS Run require?

Memory is required by GAMS for model compilation and generation and by the solver during the optimization.

Memory required by GAMS

The log file (within the GAMS IDE the process window) will tell you how much memory was required by GAMS during compilation, execution and model generation:

gams indus89
--- Job indus89 Start 09/19/07 12:22:05
--- Starting compilation
--- indus89.gms(3622) 4 Mb
--- Starting execution
--- indus89.gms(3618) 6 Mb
--- Generating LP model wsisn
--- indus89.gms(3622) 8 Mb
---   2,726 rows  6,570 columns  39,489 non-zeroes

Memory required by the Solver

Most solver will not tell how much memory they actually need during the optimization. Under Windows you either have to watch the solver process using the Windows Taskmanager (enter taskmgr on a command line and search for processes, which start with gms).

Note: The scripts below are experimental and are intended for diagnostic purpose only.

Or within the GAMS IDE you just create another GAMS file with that content:

$onecho > gmstask.cmd
@echo off
tasklist /V |grep -E "gms[_|a-z]*.exe" |awk "{print $1 \" --- \" $5 $6}"
sleep 1
goto start
$call gmstask.cmd

and start it just before you start your large model. The output will go into the process window and you have to interrupt once your large model hast terminated using the interrupt button.

--- Job Untitled_4.gms Start 09/20/07 12:49:28
GAMS Rev 148  Copyright (C) 1987-2007 GAMS Development. All rights reserved
--- Starting compilation
--- Untitled_4.gms(8) 2 Mb
--- call gmstask.cmd
gmscp_nx.exe --- 47.220K
gmscp_nx.exe --- 79.816K
gmscp_nx.exe --- 80.584K
gmscp_nx.exe --- 80.584K
Sending Interrupt signal
Terminate batch job (Y/N)? 

On the command line you may use this little script below, which automates this activity and writes the results into a file called solver.txt:

@echo off
set XX1PID=
set pid=_pid
tasklist /v /nh /fo csv | grep memlist.cmd | cut -d, -f2 >%pid%
for /F "Tokens=1" %%I in (%pid%) do set XX1PID=%%I
echo taskkill /PID %XX1PID% >killcmd.cmd
echo rm -f _pid             >>killcmd.cmd
rm -f solver.txt
tasklist /V /nh |grep -E "gms[_|a-z]*.exe" |awk "{print $1 \"  \" $5 $6}" | tee -a solver.txt
sleep 1
goto start

Just copy the lines above to a file called memlist.cmd into your working directory. Now you have to add a few lines to your model code right before the solve statement:

execute 'start memlist.cmd'
solve rotdk min obj us mip;
execute 'killcmd.cmd'

The output of memlist.cmd will be visible on the screen and also be copied to a file called solver.txt. Below is the output from an example model.

gmscp_nx.exe  49.064K
gmscp_nx.exe  77.460K
gmscp_nx.exe  76.300K
gmscp_nx.exe  76.300K
gmscp_nx.exe  76.300K
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY solver/how_much_memory_ram_does_my_gams_run_require.txt · Last modified: 2007/11/07 14:45 by Franz Nelissen