Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont load all GAP packages when resetting a workspace #37049

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

orlitzky
Copy link
Contributor

The gap_reset_workspace() function currently loops through all installed GAP packages (both by sage and on the system) and loads them before saving the new workspace. This is no longer necessary or desired: the two GAP initialization files already load a specific set of packages used in sage, and loading more can cause problems including wasted memory and unexpected changes of behavior. Moreover, the need for users to load additional packages interactively has been documented.

Fixes:

This is currently done in gap_reset_workspace(), but I think it's less
surprising to find the GAP initialization in the GAP initialization
file. Here we add it to sage.gaprc so that it can later be removed
from gap_reset_workspace().
This is currently done in gap_reset_workspace(), but I think it's less
surprising to find the GAP initialization in the GAP initialization
file. Here we add it to sage.g (for the pexpect interface) so that it
can later be removed from gap_reset_workspace(). It has already been
added to sage.gaprc (for the library interface) in an earlier commit.
Resetting the GAP workspace already initializes a new Gap instance and
loads our default collection of packages. There's no need to load
anything else in gap_reset_workspace().

The disabling of the color prompt is now handled in both sage.gaprc
and sage.g (both GAP interfaces) so we remove that as well.

Fixes: sagemathGH-31761
@orlitzky
Copy link
Contributor Author

@antonio-rojas does this help your memory usage?

Copy link

Documentation preview for this PR (built with commit 9cbf569; changes) is ready! 🎉

@antonio-rojas
Copy link
Contributor

@antonio-rojas does this help your memory usage?

Yes, the only remaining issue with all gap-packages installed (besides the Browse issue) is the test in sage/tests/gap_packages.py which explicitly tries to load all installed packages (and blows up for me). I wonder if it would make sense to replace it with testing just the default preloaded list of packages.

@orlitzky
Copy link
Contributor Author

I wonder if it would make sense to replace it with testing just the default preloaded list of packages.

We already load-test those as soon as we use GAP in any other doctest. Now that all_installed_packages() is not used in gap_reset_workspace(), we could just git rm the whole thing? GAP packages have their own test suites. If sage-the-distro wants to test them, I think a better place would be in build/gap_packages/spkg-check.

vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 16, 2024
    
The `gap_reset_workspace()` function currently loops through all
installed GAP packages (both by sage and on the system) and loads them
before saving the new workspace. This is no longer necessary or desired:
the two GAP initialization files already load a specific set of packages
used in sage, and loading more can cause problems including wasted
memory and unexpected changes of behavior. Moreover, the need for
_users_ to load additional packages interactively has been documented.

Fixes:

- sagemath#31761
    
URL: sagemath#37049
Reported by: Michael Orlitzky
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 16, 2024
    
The `gap_reset_workspace()` function currently loops through all
installed GAP packages (both by sage and on the system) and loads them
before saving the new workspace. This is no longer necessary or desired:
the two GAP initialization files already load a specific set of packages
used in sage, and loading more can cause problems including wasted
memory and unexpected changes of behavior. Moreover, the need for
_users_ to load additional packages interactively has been documented.

Fixes:

- sagemath#31761
    
URL: sagemath#37049
Reported by: Michael Orlitzky
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 16, 2024
    
The `gap_reset_workspace()` function currently loops through all
installed GAP packages (both by sage and on the system) and loads them
before saving the new workspace. This is no longer necessary or desired:
the two GAP initialization files already load a specific set of packages
used in sage, and loading more can cause problems including wasted
memory and unexpected changes of behavior. Moreover, the need for
_users_ to load additional packages interactively has been documented.

Fixes:

- sagemath#31761
    
URL: sagemath#37049
Reported by: Michael Orlitzky
Reviewer(s):
@vbraun vbraun merged commit 1f1da59 into sagemath:develop Jan 22, 2024
18 checks passed
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 22, 2024
    
These tests for the installed GAP packages are problematic in a world
where Sage can use GAP from the system. Particularly, loading _all_
installed GAP packages is not a safe operation when there might be an
enormous number of them.

Moreover, with the system GAP, it's not really Sage's reponsibility to
ensure that the installed packages load. It _would_ be nice to know that
any extra packages from the gap_packages SPKG are installed correctly;
however, that type of test would be more appropriate in that SPKG's
spkg-check phase.

Dependencies:

- sagemath#37049
    
URL: sagemath#37076
Reported by: Michael Orlitzky
Reviewer(s): Antonio Rojas
@orlitzky orlitzky deleted the dont-load-gap-pkgs-on-reset branch January 24, 2024 14:49
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 27, 2024
    
These tests for the installed GAP packages are problematic in a world
where Sage can use GAP from the system. Particularly, loading _all_
installed GAP packages is not a safe operation when there might be an
enormous number of them.

Moreover, with the system GAP, it's not really Sage's reponsibility to
ensure that the installed packages load. It _would_ be nice to know that
any extra packages from the gap_packages SPKG are installed correctly;
however, that type of test would be more appropriate in that SPKG's
spkg-check phase.

Dependencies:

- sagemath#37049
    
URL: sagemath#37076
Reported by: Michael Orlitzky
Reviewer(s): Antonio Rojas
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 29, 2024
    
These tests for the installed GAP packages are problematic in a world
where Sage can use GAP from the system. Particularly, loading _all_
installed GAP packages is not a safe operation when there might be an
enormous number of them.

Moreover, with the system GAP, it's not really Sage's reponsibility to
ensure that the installed packages load. It _would_ be nice to know that
any extra packages from the gap_packages SPKG are installed correctly;
however, that type of test would be more appropriate in that SPKG's
spkg-check phase.

Dependencies:

- sagemath#37049
    
URL: sagemath#37076
Reported by: Michael Orlitzky
Reviewer(s): Antonio Rojas
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 30, 2024
    
These tests for the installed GAP packages are problematic in a world
where Sage can use GAP from the system. Particularly, loading _all_
installed GAP packages is not a safe operation when there might be an
enormous number of them.

Moreover, with the system GAP, it's not really Sage's reponsibility to
ensure that the installed packages load. It _would_ be nice to know that
any extra packages from the gap_packages SPKG are installed correctly;
however, that type of test would be more appropriate in that SPKG's
spkg-check phase.

Dependencies:

- sagemath#37049
    
URL: sagemath#37076
Reported by: Michael Orlitzky
Reviewer(s): Antonio Rojas
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 1, 2024
    
These tests for the installed GAP packages are problematic in a world
where Sage can use GAP from the system. Particularly, loading _all_
installed GAP packages is not a safe operation when there might be an
enormous number of them.

Moreover, with the system GAP, it's not really Sage's reponsibility to
ensure that the installed packages load. It _would_ be nice to know that
any extra packages from the gap_packages SPKG are installed correctly;
however, that type of test would be more appropriate in that SPKG's
spkg-check phase.

Dependencies:

- sagemath#37049
    
URL: sagemath#37076
Reported by: Michael Orlitzky
Reviewer(s): Antonio Rojas
@mkoeppe mkoeppe added this to the sage-10.3 milestone Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants