memory limitations with GAP

892 views
Skip to first unread message

Dan Christensen

unread,
Mar 10, 2014, 9:39:14 PM3/10/14
to sage-...@googlegroups.com
My PhD student Gaohong Wang and I are doing some large GAP computations
in modular representation theory and are running into memory issues.
Also, some of the longer-running jobs that don't run into memory
problems are getting killed. A few questions:

1) When gap is started from the command line, it can be passed an option
like "-o 8g" or "-o 16g" to get it to use more RAM before complaining.
Is there a way to start gap with this option when using it through a
worksheet in GAP mode (%default_mode gap)?

2) How much RAM do the virtual machines generally have? When I've
looked, I've seen 4GB, sometimes shared with another user. Is it
possible to request machines with higher limits (e.g. 16GB)?

Thanks,

Dan

William Stein

unread,
Mar 10, 2014, 11:07:24 PM3/10/14
to sage-...@googlegroups.com
On Mon, Mar 10, 2014 at 6:39 PM, Dan Christensen <j...@uwo.ca> wrote:
> My PhD student Gaohong Wang and I are doing some large GAP computations
> in modular representation theory and are running into memory issues.
> Also, some of the longer-running jobs that don't run into memory
> problems are getting killed. A few questions:
>
> 1) When gap is started from the command line, it can be passed an option
> like "-o 8g" or "-o 16g" to get it to use more RAM before complaining.
> Is there a way to start gap with this option when using it through a
> worksheet in GAP mode (%default_mode gap)?

I don't know, but it should be. It might be necessary to modify the
source code right now... or to make a script called gap that is in the
PATH that has that option, which would "trick" sage.

> 2) How much RAM do the virtual machines generally have? When I've
> looked, I've seen 4GB, sometimes shared with another user. Is it
> possible to request machines with higher limits (e.g. 16GB)?

All the VM's have between 20GB and 42GB of RAM. However, right now
cgroups imposes a limit of 12GB per project (that's 12GB across all
processes in the project). There is also even sharing of CPU across
projects running on a given host.

There's no flexibility *yet* in requesting bigger machines, and many
other related things. However, this will change soon -- I'm doing a
very _massive_ backend refactoring right now, which I've been working
very hard on for over a month. It's critical I get it done soon,
since the current snapshot/replication system can hardly keep up with
the current load, and people creating 200+ new projects/day.

All processes running in a project get killed after 6 hours, if no
files are actively edited. This is something I can remove on a
per-project basis though (send me a project id and I'll remove it for
that project for you).

Anyway -- can you make a similar request to the above in a few weeks?
Then I'll be able to just spin up machines like this for a specific
group of projects, and easily place them:
https://cloud.google.com/products/compute-engine/#pricing

-- William

>
> Thanks,
>
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/87vbvlcy4d.fsf%40uwo.ca.
> For more options, visit https://groups.google.com/d/optout.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Dan Christensen

unread,
Mar 11, 2014, 9:15:31 AM3/11/14
to sage-...@googlegroups.com
William Stein <wst...@gmail.com> writes:

> On Mon, Mar 10, 2014 at 6:39 PM, Dan Christensen <j...@uwo.ca> wrote:
>
>> 1) When gap is started from the command line, it can be passed an option
>> like "-o 8g" or "-o 16g" to get it to use more RAM before complaining.
>> Is there a way to start gap with this option when using it through a
>> worksheet in GAP mode (%default_mode gap)?
>
> I don't know, but it should be. It might be necessary to modify the
> source code right now... or to make a script called gap that is in the
> PATH that has that option, which would "trick" sage.

I put the following

#!/bin/sh
exec /usr/local/bin/gap -o 10g "$@"

in ~/bin/gap and make it executable. That directory is already in $PATH.
Now, if I type "gap" in a terminal, this tells gap to use more memory.
But, when I use gap via a worksheet, my script isn't used.

Maybe the default memory limit of gap should be increased, at least
for the sage installation in the cloud? The default, which is shown
by

GasmanLimits();

is only 256MB!

>> 2) How much RAM do the virtual machines generally have? When I've
>> looked, I've seen 4GB, sometimes shared with another user. Is it
>> possible to request machines with higher limits (e.g. 16GB)?
>
> All the VM's have between 20GB and 42GB of RAM.

Right, I misread the output of "free". That's excellent.

> However, right now cgroups imposes a limit of 12GB per project (that's
> 12GB across all processes in the project).

That will allow us to get further, if I can convince gap to make use of
it.

> Anyway -- can you make a similar request to the above in a few weeks?

Will do!

Thanks,

Dan

Dan Christensen

unread,
Mar 11, 2014, 12:36:34 PM3/11/14
to sage-...@googlegroups.com
Dan Christensen <j...@uwo.ca> writes:

> Maybe the default memory limit of gap should be increased, at least
> for the sage installation in the cloud? The default, which is shown
> by
>
> GasmanLimits();
>
> is only 256MB!

Ok, there's something strange going on here. If I run gap via a sage
cloud worksheet, I get the above result, which is also confirmed by

GAPInfo.CommandLineOptions.o;
251m

(so it's actually 251MB).

But if I start gap in a terminal in the sage math cloud I get:

~$ sage -gap
...
gap> GAPInfo.CommandLineOptions.o;
"2g"

(2GB) which I'm told is the usual default for GAP.

So at the very least it would be great to have 2GB for GAP in the
worksheet as well, but even better would be a way to specify a -o
option to GAP to raise this even higher.

Dan

Harald Schilly

unread,
Mar 11, 2014, 12:42:22 PM3/11/14
to sage-...@googlegroups.com

On Tue, Mar 11, 2014 at 5:36 PM, Dan Christensen <j...@uwo.ca> wrote:

Ok, there's something strange going on here.  If I run gap via a sage
cloud worksheet, I get the above result, which is also confirmed by

GAPInfo.CommandLineOptions.o;
251m


Mmy best guess is, that this happens here inside Sage:
http://git.sagemath.org/sage.git/tree/src/sage/interfaces/gap.py#n249

Harald

Dan Christensen

unread,
Mar 11, 2014, 5:00:42 PM3/11/14
to sage-...@googlegroups.com
Yes, that seems right. The calculation

mem = MemoryInfo()
suggested_size = max(int(mem.available_swap() / 10),
int(mem.available_ram() / 50))

produces an unusably small value (1/50 of the ram is way too
conservative) and then the code bumps it up to 250MB here:

suggested_size = max(suggested_size, 250 * 1024**2)

Then the code that converts to a string adds 1 for good measure. And
sure enough, you can see "-o 251m" in the gap command line.

/usr/local/sage-6.1.1-x86_64-Linux/local/gap/latest/bin/x86_64-unknown-linux-gnu-gcc-default64/gap
-m 24m -l /usr/local/sage-6.1.1-x86_64-Linux/local/gap/latest -r -L
/home/jdc/../scratchy/.sage/gap/workspace-3260521050548705678 -b -p -T
-o 251m -s 251m -m 64m
/usr/local/sage-6.1.1-x86_64-Linux/local/share/sage/ext/gap/sage.g

This happens on the sage cloud (with tons of ram) using a worksheet, and
on my laptop in a terminal.

Here's how to override it:

sage: gap = Gap(max_workspace_size = "4g")
sage: gap("GasmanLimits()")
rec(
kill := 0,
max := 4194304,
min := 65536 )

This works in the cloud too. You probably have to use "gap" as the
variable name here if you use "%default_mode gap".

So the main question that remains is what is the logic behind the
default. Why 1/50 of the available ram?? Seems way too conservative.
I'd be inclined to use 90% of it!

Thanks for the help Harald!

Dan

Dima Pasechnik

unread,
Mar 11, 2014, 7:22:25 PM3/11/14
to sage-...@googlegroups.com
think of a situation when there are many Sage sessions running in
parallel.
This was being discussed and fought over quite a bit. See
http://trac.sagemath.org/ticket/13880
Reply all
Reply to author
Forward
0 new messages