Re: [sage-devel] Re: manual memory management for GAP?

2022-06-22 Thread Dima Pasechnik
On Tue, Jun 21, 2022 at 10:24 AM Dima Pasechnik  wrote:
>
> On Tue, Jun 21, 2022 at 10:19 AM Dima Pasechnik  wrote:
> >
> > On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> > >
> > > Perhaps this message (see the thread it's in for context) applies to your 
> > > situation?
> > >
> > > https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
> >
> > this is outdated. However, it seems that the very old doc suggestion in
> > sage/interfaces/gap.py
> >
> > import sage.interfaces.gap
> > sage.interfaces.gap.gap_cmd = ' '
> >
> > could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
> > and it cannot be overwritten like this.
> >
> > This is the question of the correct class interface design here, and
> > I'm a bit lost.
> > I think the value of gap_cmd can be set somewhere early (in sagerc?),
> > before the GAP pexcept is initialised.
> > Then one could conditionally set gap_cmd to either the default value,
> > or to the value in that initialisation parameter, if it was set at all.
> >
> > But where?
>
> I've opened https://trac.sagemath.org/ticket/34041 to deal with these issues.

a fix is ready for review. I went for instroducing env.vars to control this.

>
> >
> > Dima
> >
> >
> >
> >
> >
> >
> > >
> > > On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
> > >>
> > >> Thanks, John.
> > >>
> > >> But, I should have mentioned that we tried that and it does not seem to 
> > >> work (unless I'm missing something):
> > >>
> > >> ┌┐
> > >> │ SageMath version 9.6, Release Date: 2022-05-15 │
> > >> │ Using Python 3.10.3. Type "help()" for help.   │
> > >> └┘
> > >> sage: gap("GAPInfo.CommandLineOptions;")
> > >> rec(
> > >>   [... redacted ...]
> > >>   o := "2g",
> > >>   [... redacted ...]
> > >> )
> > >> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> > >> sage: gap("GAPInfo.CommandLineOptions;")
> > >> rec(
> > >>   [... redacted ...]
> > >>   o := "2g",
> > >>   [... redacted ...]
> > >> )
> > >> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
> > >>>
> > >>> According to 
> > >>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> > >>>  try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
> > >>>
> > >>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
> > 
> >  Hi,
> > 
> >  I'm trying to help out a friend who is computing automorphism groups 
> >  of lattices in Sage (using GAP under the hood).  The computation is 
> >  fairly long and memory-intensive and eventually results in
> > 
> >    sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
> >    (change it with the -o command line option)
> > 
> >  Apparently, until late last year, achieving the desired -o command 
> >  line option effect from within Sage was possible via something like
> > 
> >    from sage.interfaces.gap import get_gap_memory_pool_size, 
> >  set_gap_memory_pool_size
> >    memory_gap = get_gap_memory_pool_size()
> >    set_gap_memory_pool_size(9048*memory_gap)
> > 
> >  Now these functions are not available anymore, due to 
> >  https://trac.sagemath.org/ticket/32656
> > 
> >  Is it possible to achieve the same effect via some alternative method?
> > 
> >  Best,
> >  Alex
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "sage-devel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to sage-devel+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq2NnaZvec1p9D-a2CHF6L%2BK2P2m3UnwM_1vwuxsourqLA%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, 21 Jun 2022, 15:06 TB,  wrote:

> On 21/06/2022 16:35, Dima Pasechnik wrote:
> > On Tue, Jun 21, 2022 at 10:19 AM Dima Pasechnik 
> wrote:
> >>
> >> On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> >>>
> >>> Perhaps this message (see the thread it's in for context) applies to
> your situation?
> >>>
> >>> https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
> >>
> >> this is outdated. However, it seems that the very old doc suggestion in
> >> sage/interfaces/gap.py
> >>
> >> import sage.interfaces.gap
> >> sage.interfaces.gap.gap_cmd = ' '
> >>
> >> could never have worked, as gap_cmd is hardcoded to "gap -r" (or
> whatever)
> >> and it cannot be overwritten like this.
> >
> > indeed:
> >
> > sage: import sage.interfaces.gap
> > sage: sage.interfaces.gap.gap_cmd = "gap -r -o 3G -s 5G"
> > sage: gap.eval('GAPInfo.CommandLineOptions.s')
> > '"4g"'
> >
> > so changing gap_cmd has no effect.
> >
> Maybe this works:
> sage: import sage.interfaces.gap
> sage: sage.interfaces.gap.gap_cmd = "gap -r -o 3G -s 5G"
> sage: sage.interfaces.gap.gap = Gap() # New instance
> sage: gap.eval('GAPInfo.CommandLineOptions.s')
> '"4g"'
> sage: sage.interfaces.gap.gap.eval('GAPInfo.CommandLineOptions.s')
> '"5G"'
> sage: gap = sage.interfaces.gap.gap # For the global namespace
> sage: gap.eval('GAPInfo.CommandLineOptions.s')
> '"5G"'
>

hmm, and what happened to the old instance of GAP, and to Sage objects
associated with it?

Sure, you can monkey-patch Python classes, but this looks wrong in this
case.



>
>
> Regards,
> TB
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/550315df-fd50-b6c6-5202-9b2cfcee33a9%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq1f7nm5xNwVeyk35wCaErBk8kvWJut3oKEkKcap%3DYNosQ%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread TB

On 21/06/2022 16:35, Dima Pasechnik wrote:

On Tue, Jun 21, 2022 at 10:19 AM Dima Pasechnik  wrote:


On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:


Perhaps this message (see the thread it's in for context) applies to your 
situation?

https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ


this is outdated. However, it seems that the very old doc suggestion in
sage/interfaces/gap.py

import sage.interfaces.gap
sage.interfaces.gap.gap_cmd = ' '

could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
and it cannot be overwritten like this.


indeed:

sage: import sage.interfaces.gap
sage: sage.interfaces.gap.gap_cmd = "gap -r -o 3G -s 5G"
sage: gap.eval('GAPInfo.CommandLineOptions.s')
'"4g"'

so changing gap_cmd has no effect.


Maybe this works:
sage: import sage.interfaces.gap
sage: sage.interfaces.gap.gap_cmd = "gap -r -o 3G -s 5G"
sage: sage.interfaces.gap.gap = Gap() # New instance
sage: gap.eval('GAPInfo.CommandLineOptions.s')
'"4g"'
sage: sage.interfaces.gap.gap.eval('GAPInfo.CommandLineOptions.s')
'"5G"'
sage: gap = sage.interfaces.gap.gap # For the global namespace
sage: gap.eval('GAPInfo.CommandLineOptions.s')
'"5G"'

Regards,
TB

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/550315df-fd50-b6c6-5202-9b2cfcee33a9%40gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, Jun 21, 2022 at 10:19 AM Dima Pasechnik  wrote:
>
> On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> >
> > Perhaps this message (see the thread it's in for context) applies to your 
> > situation?
> >
> > https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
>
> this is outdated. However, it seems that the very old doc suggestion in
> sage/interfaces/gap.py
>
> import sage.interfaces.gap
> sage.interfaces.gap.gap_cmd = ' '
>
> could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
> and it cannot be overwritten like this.

indeed:

sage: import sage.interfaces.gap
sage: sage.interfaces.gap.gap_cmd = "gap -r -o 3G -s 5G"
sage: gap.eval('GAPInfo.CommandLineOptions.s')
'"4g"'

so changing gap_cmd has no effect.

>
> This is the question of the correct class interface design here, and
> I'm a bit lost.
> I think the value of gap_cmd can be set somewhere early (in sagerc?),
> before the GAP pexcept is initialised.
> Then one could conditionally set gap_cmd to either the default value,
> or to the value in that initialisation parameter, if it was set at all.
>
> But where?
>
> Dima
>
>
>
>
>
>
> >
> > On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
> >>
> >> Thanks, John.
> >>
> >> But, I should have mentioned that we tried that and it does not seem to 
> >> work (unless I'm missing something):
> >>
> >> ┌┐
> >> │ SageMath version 9.6, Release Date: 2022-05-15 │
> >> │ Using Python 3.10.3. Type "help()" for help.   │
> >> └┘
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
> >>>
> >>> According to 
> >>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> >>>  try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
> >>>
> >>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
> 
>  Hi,
> 
>  I'm trying to help out a friend who is computing automorphism groups of 
>  lattices in Sage (using GAP under the hood).  The computation is fairly 
>  long and memory-intensive and eventually results in
> 
>    sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>    (change it with the -o command line option)
> 
>  Apparently, until late last year, achieving the desired -o command line 
>  option effect from within Sage was possible via something like
> 
>    from sage.interfaces.gap import get_gap_memory_pool_size, 
>  set_gap_memory_pool_size
>    memory_gap = get_gap_memory_pool_size()
>    set_gap_memory_pool_size(9048*memory_gap)
> 
>  Now these functions are not available anymore, due to 
>  https://trac.sagemath.org/ticket/32656
> 
>  Is it possible to achieve the same effect via some alternative method?
> 
>  Best,
>  Alex
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq3Jt1OuMX%3DHkSYR_wXx2B-Z0bGSNLPtrQJy15%2BukPC%3Dww%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, 21 Jun 2022, 10:45 David Joyner,  wrote:

> On Tue, Jun 21, 2022 at 5:19 AM Dima Pasechnik  wrote:
> >
> > On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> > >
> > > Perhaps this message (see the thread it's in for context) applies to
> your situation?
> > >
> > > https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
> >
> > this is outdated. However, it seems that the very old doc suggestion in
> > sage/interfaces/gap.py
> >
> > import sage.interfaces.gap
> > sage.interfaces.gap.gap_cmd = ' '
> >
> > could never have worked, as gap_cmd is hardcoded to "gap -r" (or
> whatever)
> > and it cannot be overwritten like this.
> >
> > This is the question of the correct class interface design here, and
> > I'm a bit lost.
> > I think the value of gap_cmd can be set somewhere early (in sagerc?),
>
> Can one just manually edit gap.sh in local/share/gap?
>

do we use gap.sh at all?
(maybe for gap_console())?

For example, will
> replacing
> exec "$GAP_EXE/gap" -l "$GAP_DIR" "$@"
> by
> exec "$GAP_EXE/gap -m 4G" -l "$GAP_DIR" "$@"
> work?
>
> > before the GAP pexcept is initialised.
> > Then one could conditionally set gap_cmd to either the default value,
> > or to the value in that initialisation parameter, if it was set at all.
> >
> > But where?
> >
> > Dima
> >
> >
> >
> >
> >
> >
> > >
> > > On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
> > >>
> > >> Thanks, John.
> > >>
> > >> But, I should have mentioned that we tried that and it does not seem
> to work (unless I'm missing something):
> > >>
> > >> ┌┐
> > >> │ SageMath version 9.6, Release Date: 2022-05-15 │
> > >> │ Using Python 3.10.3. Type "help()" for help.   │
> > >> └┘
> > >> sage: gap("GAPInfo.CommandLineOptions;")
> > >> rec(
> > >>   [... redacted ...]
> > >>   o := "2g",
> > >>   [... redacted ...]
> > >> )
> > >> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> > >> sage: gap("GAPInfo.CommandLineOptions;")
> > >> rec(
> > >>   [... redacted ...]
> > >>   o := "2g",
> > >>   [... redacted ...]
> > >> )
> > >> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
> > >>>
> > >>> According to
> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
> > >>>
> > >>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
> > 
> >  Hi,
> > 
> >  I'm trying to help out a friend who is computing automorphism
> groups of lattices in Sage (using GAP under the hood).  The computation is
> fairly long and memory-intensive and eventually results in
> > 
> >    sage.libs.gap.util.GAPError: Error, reached the pre-set memory
> limit
> >    (change it with the -o command line option)
> > 
> >  Apparently, until late last year, achieving the desired -o command
> line option effect from within Sage was possible via something like
> > 
> >    from sage.interfaces.gap import get_gap_memory_pool_size,
> set_gap_memory_pool_size
> >    memory_gap = get_gap_memory_pool_size()
> >    set_gap_memory_pool_size(9048*memory_gap)
> > 
> >  Now these functions are not available anymore, due to
> https://trac.sagemath.org/ticket/32656
> > 
> >  Is it possible to achieve the same effect via some alternative
> method?
> > 
> >  Best,
> >  Alex
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com
> .
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CAAWYfq0iFEaoaWCD%2Bt_3uJniSQ5MOhD_psxPcwhcjEhKZZrZ2g%40mail.gmail.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CAEQuuAUN5w5dmVWtYzs%2BZJRP1s4gYqTxeC4o6kRiFE_-b8Y-Fw%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To 

Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread David Joyner
On Tue, Jun 21, 2022 at 5:19 AM Dima Pasechnik  wrote:
>
> On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> >
> > Perhaps this message (see the thread it's in for context) applies to your 
> > situation?
> >
> > https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
>
> this is outdated. However, it seems that the very old doc suggestion in
> sage/interfaces/gap.py
>
> import sage.interfaces.gap
> sage.interfaces.gap.gap_cmd = ' '
>
> could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
> and it cannot be overwritten like this.
>
> This is the question of the correct class interface design here, and
> I'm a bit lost.
> I think the value of gap_cmd can be set somewhere early (in sagerc?),

Can one just manually edit gap.sh in local/share/gap?
For example, will
replacing
exec "$GAP_EXE/gap" -l "$GAP_DIR" "$@"
by
exec "$GAP_EXE/gap -m 4G" -l "$GAP_DIR" "$@"
work?

> before the GAP pexcept is initialised.
> Then one could conditionally set gap_cmd to either the default value,
> or to the value in that initialisation parameter, if it was set at all.
>
> But where?
>
> Dima
>
>
>
>
>
>
> >
> > On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
> >>
> >> Thanks, John.
> >>
> >> But, I should have mentioned that we tried that and it does not seem to 
> >> work (unless I'm missing something):
> >>
> >> ┌┐
> >> │ SageMath version 9.6, Release Date: 2022-05-15 │
> >> │ Using Python 3.10.3. Type "help()" for help.   │
> >> └┘
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
> >>>
> >>> According to 
> >>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> >>>  try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
> >>>
> >>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
> 
>  Hi,
> 
>  I'm trying to help out a friend who is computing automorphism groups of 
>  lattices in Sage (using GAP under the hood).  The computation is fairly 
>  long and memory-intensive and eventually results in
> 
>    sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>    (change it with the -o command line option)
> 
>  Apparently, until late last year, achieving the desired -o command line 
>  option effect from within Sage was possible via something like
> 
>    from sage.interfaces.gap import get_gap_memory_pool_size, 
>  set_gap_memory_pool_size
>    memory_gap = get_gap_memory_pool_size()
>    set_gap_memory_pool_size(9048*memory_gap)
> 
>  Now these functions are not available anymore, due to 
>  https://trac.sagemath.org/ticket/32656
> 
>  Is it possible to achieve the same effect via some alternative method?
> 
>  Best,
>  Alex
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/CAAWYfq0iFEaoaWCD%2Bt_3uJniSQ5MOhD_psxPcwhcjEhKZZrZ2g%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAEQuuAUN5w5dmVWtYzs%2BZJRP1s4gYqTxeC4o6kRiFE_-b8Y-Fw%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, Jun 21, 2022 at 10:19 AM Dima Pasechnik  wrote:
>
> On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
> >
> > Perhaps this message (see the thread it's in for context) applies to your 
> > situation?
> >
> > https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
>
> this is outdated. However, it seems that the very old doc suggestion in
> sage/interfaces/gap.py
>
> import sage.interfaces.gap
> sage.interfaces.gap.gap_cmd = ' '
>
> could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
> and it cannot be overwritten like this.
>
> This is the question of the correct class interface design here, and
> I'm a bit lost.
> I think the value of gap_cmd can be set somewhere early (in sagerc?),
> before the GAP pexcept is initialised.
> Then one could conditionally set gap_cmd to either the default value,
> or to the value in that initialisation parameter, if it was set at all.
>
> But where?

I've opened https://trac.sagemath.org/ticket/34041 to deal with these issues.

>
> Dima
>
>
>
>
>
>
> >
> > On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
> >>
> >> Thanks, John.
> >>
> >> But, I should have mentioned that we tried that and it does not seem to 
> >> work (unless I'm missing something):
> >>
> >> ┌┐
> >> │ SageMath version 9.6, Release Date: 2022-05-15 │
> >> │ Using Python 3.10.3. Type "help()" for help.   │
> >> └┘
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> >> sage: gap("GAPInfo.CommandLineOptions;")
> >> rec(
> >>   [... redacted ...]
> >>   o := "2g",
> >>   [... redacted ...]
> >> )
> >> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
> >>>
> >>> According to 
> >>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> >>>  try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
> >>>
> >>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
> 
>  Hi,
> 
>  I'm trying to help out a friend who is computing automorphism groups of 
>  lattices in Sage (using GAP under the hood).  The computation is fairly 
>  long and memory-intensive and eventually results in
> 
>    sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>    (change it with the -o command line option)
> 
>  Apparently, until late last year, achieving the desired -o command line 
>  option effect from within Sage was possible via something like
> 
>    from sage.interfaces.gap import get_gap_memory_pool_size, 
>  set_gap_memory_pool_size
>    memory_gap = get_gap_memory_pool_size()
>    set_gap_memory_pool_size(9048*memory_gap)
> 
>  Now these functions are not available anymore, due to 
>  https://trac.sagemath.org/ticket/32656
> 
>  Is it possible to achieve the same effect via some alternative method?
> 
>  Best,
>  Alex
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq06ry6wXU_ziQdZpAdnqKvQo286eeHvEAv3aZNuC2g5MA%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, Jun 21, 2022 at 4:06 AM Nils Bruin  wrote:
>
> Perhaps this message (see the thread it's in for context) applies to your 
> situation?
>
> https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ

this is outdated. However, it seems that the very old doc suggestion in
sage/interfaces/gap.py

import sage.interfaces.gap
sage.interfaces.gap.gap_cmd = ' '

could never have worked, as gap_cmd is hardcoded to "gap -r" (or whatever)
and it cannot be overwritten like this.

This is the question of the correct class interface design here, and
I'm a bit lost.
I think the value of gap_cmd can be set somewhere early (in sagerc?),
before the GAP pexcept is initialised.
Then one could conditionally set gap_cmd to either the default value,
or to the value in that initialisation parameter, if it was set at all.

But where?

Dima






>
> On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
>>
>> Thanks, John.
>>
>> But, I should have mentioned that we tried that and it does not seem to work 
>> (unless I'm missing something):
>>
>> ┌┐
>> │ SageMath version 9.6, Release Date: 2022-05-15 │
>> │ Using Python 3.10.3. Type "help()" for help.   │
>> └┘
>> sage: gap("GAPInfo.CommandLineOptions;")
>> rec(
>>   [... redacted ...]
>>   o := "2g",
>>   [... redacted ...]
>> )
>> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
>> sage: gap("GAPInfo.CommandLineOptions;")
>> rec(
>>   [... redacted ...]
>>   o := "2g",
>>   [... redacted ...]
>> )
>> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
>>>
>>> According to 
>>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
>>>  try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
>>>
>>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:

 Hi,

 I'm trying to help out a friend who is computing automorphism groups of 
 lattices in Sage (using GAP under the hood).  The computation is fairly 
 long and memory-intensive and eventually results in

   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
   (change it with the -o command line option)

 Apparently, until late last year, achieving the desired -o command line 
 option effect from within Sage was possible via something like

   from sage.interfaces.gap import get_gap_memory_pool_size, 
 set_gap_memory_pool_size
   memory_gap = get_gap_memory_pool_size()
   set_gap_memory_pool_size(9048*memory_gap)

 Now these functions are not available anymore, due to 
 https://trac.sagemath.org/ticket/32656

 Is it possible to achieve the same effect via some alternative method?

 Best,
 Alex
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq0iFEaoaWCD%2Bt_3uJniSQ5MOhD_psxPcwhcjEhKZZrZ2g%40mail.gmail.com.


Re: [sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread Dima Pasechnik
On Tue, 21 Jun 2022, 01:59 John H Palmieri,  wrote:

> According to
> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
> try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".


please see
commit 1ea7b697e812302dfca03a1c7fe41c9a8dc3c98e
Author: Michael Orlitzky 
Date:   Wed Oct 6 20:48:22 2021 -0400

Trac #32656: eliminate manual GAP memory management.

Our GAP interface provides a few functions to get/set the GAP memory
pool size. That size used when initializing the GAP interface, being
passed as the argument to GAP's "-o" and "-s" command-line flags:

  https://www.gap-system.org/Manuals/doc/ref/chap3.html

In preparation for the removal of psutil and sage.misc.getusage, we
remove all of this custom memory management code. The "-o" flag
specifies an upper bound, and can simply be omitted.

We also omit the "-s" flag in this commit, but that flag is a bit more
delicate, since it may affect users with custom GAP modules. However,
if the omission of "-s" causes a problem down the line, and if the GAP
documentation's assumptions about mmap et al. are correct, then we
can simply add back the "-s" flag with a large, static value.

"-o" is not doing the trick. One needs "-s", and also there are two
instances of GAP in Sage -
pexpect GAP and libgap, they are instantiated differently, IIRC.

Dima

PS. Given it's an often repeated request, we should document the GAP memory
management settings  somewhere.


>
>
>
> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
>
>> Hi,
>>
>> I'm trying to help out a friend who is computing automorphism groups of
>> lattices in Sage (using GAP under the hood).  The computation is fairly
>> long and memory-intensive and eventually results in
>>
>>   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>>   (change it with the -o command line option)
>>
>> Apparently, until late last year, achieving the desired -o command line
>> option effect from within Sage was possible via something like
>>
>>   from sage.interfaces.gap import get_gap_memory_pool_size,
>> set_gap_memory_pool_size
>>   memory_gap = get_gap_memory_pool_size()
>>   set_gap_memory_pool_size(9048*memory_gap)
>>
>> Now these functions are not available anymore, due to
>> https://trac.sagemath.org/ticket/32656
>>
>> Is it possible to achieve the same effect via some alternative method?
>>
>> Best,
>> Alex
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/7f1922b7-afab-47cc-8cad-7a74708c5962n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq1Aopzy2SB69O2LntXUM5AV_AmcYQoTSeZxf0QzsB_4Yw%40mail.gmail.com.


[sage-devel] Re: manual memory management for GAP?

2022-06-21 Thread AlexGhitza
As far as I can tell the actionable part of that thread is Dima's 
suggestion to use the function set_gap_memory_pool_size() from 
interfaces/gap.py but as I pointed out above, that function has disappeared 
from sage-9.5 onwards.

Best,
Alex

On Tuesday, June 21, 2022 at 1:06:15 PM UTC+10 Nils Bruin wrote:

> Perhaps this message (see the thread it's in for context) applies to your 
> situation?
>
> https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ
>
> On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:
>
>> Thanks, John.
>>
>> But, I should have mentioned that we tried that and it does not seem to 
>> work (unless I'm missing something):
>>
>> ┌┐
>> │ SageMath version 9.6, Release Date: 2022-05-15 │
>> │ Using Python 3.10.3. Type "help()" for help.   │
>> └┘
>> sage: gap("GAPInfo.CommandLineOptions;")
>> rec(
>>   [... redacted ...]
>>   o := "2g",
>>   [... redacted ...]
>> )
>> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
>> sage: gap("GAPInfo.CommandLineOptions;")
>> rec(
>>   [... redacted ...]
>>   o := "2g",
>>   [... redacted ...]
>> )
>> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
>>
>>> According to 
>>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
>>>  
>>> try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
>>>
>>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
>>>
 Hi,

 I'm trying to help out a friend who is computing automorphism groups of 
 lattices in Sage (using GAP under the hood).  The computation is fairly 
 long and memory-intensive and eventually results in

   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
   (change it with the -o command line option)

 Apparently, until late last year, achieving the desired -o command line 
 option effect from within Sage was possible via something like

   from sage.interfaces.gap import get_gap_memory_pool_size, 
 set_gap_memory_pool_size
   memory_gap = get_gap_memory_pool_size()
   set_gap_memory_pool_size(9048*memory_gap)

 Now these functions are not available anymore, due to 
 https://trac.sagemath.org/ticket/32656

 Is it possible to achieve the same effect via some alternative method?

 Best,
 Alex

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/13a958af-1b17-4b4c-90de-aae2f543166en%40googlegroups.com.


[sage-devel] Re: manual memory management for GAP?

2022-06-20 Thread Nils Bruin
Perhaps this message (see the thread it's in for context) applies to your 
situation?

https://groups.google.com/g/sage-devel/c/ntuqDmruI8w/m/vJOv6mgqCgAJ

On Monday, 20 June 2022 at 19:30:04 UTC-6 AlexGhitza wrote:

> Thanks, John.
>
> But, I should have mentioned that we tried that and it does not seem to 
> work (unless I'm missing something):
>
> ┌┐
> │ SageMath version 9.6, Release Date: 2022-05-15 │
> │ Using Python 3.10.3. Type "help()" for help.   │
> └┘
> sage: gap("GAPInfo.CommandLineOptions;")
> rec(
>   [... redacted ...]
>   o := "2g",
>   [... redacted ...]
> )
> sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
> sage: gap("GAPInfo.CommandLineOptions;")
> rec(
>   [... redacted ...]
>   o := "2g",
>   [... redacted ...]
> )
> On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:
>
>> According to 
>> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
>>  
>> try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
>>
>> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
>>
>>> Hi,
>>>
>>> I'm trying to help out a friend who is computing automorphism groups of 
>>> lattices in Sage (using GAP under the hood).  The computation is fairly 
>>> long and memory-intensive and eventually results in
>>>
>>>   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>>>   (change it with the -o command line option)
>>>
>>> Apparently, until late last year, achieving the desired -o command line 
>>> option effect from within Sage was possible via something like
>>>
>>>   from sage.interfaces.gap import get_gap_memory_pool_size, 
>>> set_gap_memory_pool_size
>>>   memory_gap = get_gap_memory_pool_size()
>>>   set_gap_memory_pool_size(9048*memory_gap)
>>>
>>> Now these functions are not available anymore, due to 
>>> https://trac.sagemath.org/ticket/32656
>>>
>>> Is it possible to achieve the same effect via some alternative method?
>>>
>>> Best,
>>> Alex
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/ce56865b-55b2-4efc-b37e-f5e81875d7c1n%40googlegroups.com.


[sage-devel] Re: manual memory management for GAP?

2022-06-20 Thread AlexGhitza
Thanks, John.

But, I should have mentioned that we tried that and it does not seem to 
work (unless I'm missing something):

┌┐
│ SageMath version 9.6, Release Date: 2022-05-15 │
│ Using Python 3.10.3. Type "help()" for help.   │
└┘
sage: gap("GAPInfo.CommandLineOptions;")
rec(
  [... redacted ...]
  o := "2g",
  [... redacted ...]
)
sage: sage.interfaces.gap.gap_cmd = 'gap -r -o 128G'
sage: gap("GAPInfo.CommandLineOptions;")
rec(
  [... redacted ...]
  o := "2g",
  [... redacted ...]
)
On Tuesday, June 21, 2022 at 10:59:38 AM UTC+10 John H Palmieri wrote:

> According to 
> https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
>  
> try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".
>
> On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:
>
>> Hi,
>>
>> I'm trying to help out a friend who is computing automorphism groups of 
>> lattices in Sage (using GAP under the hood).  The computation is fairly 
>> long and memory-intensive and eventually results in
>>
>>   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>>   (change it with the -o command line option)
>>
>> Apparently, until late last year, achieving the desired -o command line 
>> option effect from within Sage was possible via something like
>>
>>   from sage.interfaces.gap import get_gap_memory_pool_size, 
>> set_gap_memory_pool_size
>>   memory_gap = get_gap_memory_pool_size()
>>   set_gap_memory_pool_size(9048*memory_gap)
>>
>> Now these functions are not available anymore, due to 
>> https://trac.sagemath.org/ticket/32656
>>
>> Is it possible to achieve the same effect via some alternative method?
>>
>> Best,
>> Alex
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/409c5f36-bfb6-4dae-8601-5f47da621cccn%40googlegroups.com.


[sage-devel] Re: manual memory management for GAP?

2022-06-20 Thread John H Palmieri
According to 
https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/,
 
try "sage.interfaces.gap.gap_cmd = 'gap -r -o 4G '".

On Monday, June 20, 2022 at 5:12:27 PM UTC-7 AlexGhitza wrote:

> Hi,
>
> I'm trying to help out a friend who is computing automorphism groups of 
> lattices in Sage (using GAP under the hood).  The computation is fairly 
> long and memory-intensive and eventually results in
>
>   sage.libs.gap.util.GAPError: Error, reached the pre-set memory limit
>   (change it with the -o command line option)
>
> Apparently, until late last year, achieving the desired -o command line 
> option effect from within Sage was possible via something like
>
>   from sage.interfaces.gap import get_gap_memory_pool_size, 
> set_gap_memory_pool_size
>   memory_gap = get_gap_memory_pool_size()
>   set_gap_memory_pool_size(9048*memory_gap)
>
> Now these functions are not available anymore, due to 
> https://trac.sagemath.org/ticket/32656
>
> Is it possible to achieve the same effect via some alternative method?
>
> Best,
> Alex
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/7f1922b7-afab-47cc-8cad-7a74708c5962n%40googlegroups.com.