Skip to content

Conversation

d-torrance
Copy link
Member

This should significantly speed up building since we won't need to fire up a ton of new M2 processes for each package. This is a draft for now -- we should ensure that the documentation stays unchanged, so I'll compare the build artifacts.

It potentially loads a package and its output isn't captured.

As a result, the "no-capture-flag" comment in the "check" example is
redundant, so we remove it.
This avoids a couple deprecation warnings in the documentation (which
weren't getting captured anyway)
When capturing, we also end up loading Polyhedra, which overrides some
methods, resulting in incorrect documentation.  For example,
net(Polyhedron) doesn't display information about the polyhedron.
Otherwise, the second example will try to create a directory with the
same name as the directory from the first example, and we get a
warning message in the documentation.
Otherwise, we'll increase the verbosity of subsequently captured
examples from this package
Otherwise, we will increase the verbosity in the other examples
Many of the examples call the setNmzOption function, which modifies a
global variable that affects the output of other examples.a
It modifies a Python global variable (math.pi) that is used in another
example.
This sets a global variable that affects the output of other examples.
Copy link
Member

@mahrud mahrud Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect these are because examples are run by capture in a way that a previous example loading a package has overwritten intersection? Would this be resolved if examples from each package had their own process and all used capture inside that one process? This might be a good idea to do anyway, since the different processes could run in parallel.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's what we basically do anyway -- start up a new M2 process and run installPackage inside it for each package.

This particular commit isn't really fixing a capture issue, but one I noticed when comparing the capture v. non-capture diffs. We currently have this annoying deprecation warning in the docs (which capture misses), and this change fixes that:

i4 : toricBlowUp(P,Q,1)
Warning: This method is deprecated and will be removed in version 1.11 of Polyhedra. Please consider using polyhedronFromHData instead.

o4 = Polyhedron{...1...}

o4 : Polyhedron

@d-torrance
Copy link
Member Author

Something that's confusing me is the non-captured v. captured diff of some LocalRings examples, e.g.,:

--- old/usr/share/doc/Macaulay2/LocalRings/example-output/_local__Resolution.out
+++ new/usr/share/doc/Macaulay2/LocalRings/example-output/_local__Resolution.out
@@ -74,11 +74,11 @@
 i11 : C = resolution coker m

 

        1      3      3      1

-o11 = R  <-- R  <-- R  <-- R

-                            

-      0      1      2      3

+o11 = R  <-- R  <-- R  <-- R  <-- 0

+                                   

+      0      1      2      3      4

 

-o11 : Complex

+o11 : ChainComplex

Without capture, resolution uses the new Complexes version, but with it, we use the legacy version. I don't see where any examples are modifying any global variables or anything.

The package does have OldChainComplexes in PackageImports and Complexes in PackageExports, which seems odd. Why use both?

@d-torrance
Copy link
Member Author

I think the issue is that LocalRings exports Complexes, but calling capture loads the pre-loaded packages, so it pulls in OldChainComplexes again:

i1 : locate(res, Module)

o1 = /usr/share/Macaulay2/OldChainComplexes/res.m2:284:37-311:90

o1 : FilePosition

i2 : needsPackage "LocalRings"
 -- warning: symbol "GradedModuleMap" in OldChainComplexes.Dictionary is shadowed by a symbol in Complexes.Dictionary
 --   use the synonym OldChainComplexes$GradedModuleMap
 -- warning: symbol "GradedModule" in OldChainComplexes.Dictionary is shadowed by a symbol in Complexes.Dictionary
 --   use the synonym OldChainComplexes$GradedModule
 -- warning: symbol "res" in OldChainComplexes.Dictionary is shadowed by a symbol in Complexes.Dictionary
 --   use one of the synonyms OldChainComplexes$res, OldChainComplexes$resolution
 -- warning: symbol "resolution" in OldChainComplexes.Dictionary is shadowed by a symbol in Complexes.Dictionary
 --   use one of the synonyms OldChainComplexes$res, OldChainComplexes$resolution
 -- warning: symbol "res" in Complexes.Dictionary is shadowed by a symbol in OldChainComplexes.Dictionary
 --   use one of the synonyms Complexes$freeResolution, Complexes$res, Complexes$resolution, freeResolution
 -- warning: symbol "GradedModuleMap" in Complexes.Dictionary is shadowed by a symbol in OldChainComplexes.Dictionary
 --   use one of the synonyms Complexes$ComplexMap, Complexes$GradedModuleMap, ComplexMap
 -- warning: symbol "resolution" in Complexes.Dictionary is shadowed by a symbol in OldChainComplexes.Dictionary
 --   use one of the synonyms Complexes$freeResolution, Complexes$res, Complexes$resolution, freeResolution
 -- warning: symbol "GradedModule" in Complexes.Dictionary is shadowed by a symbol in OldChainComplexes.Dictionary
 --   use one of the synonyms Complex, Complexes$Complex, Complexes$GradedModule

o2 = LocalRings

o2 : Package

i3 : locate(res, Module)

o3 = /usr/share/Macaulay2/Complexes/FreeResolutions.m2:55:36-132:5

o3 : FilePosition

i4 : capture("locate(res, Module)", UserMode => false)

o4 = (false,                                                                 )
             i1 : locate(res, Module)

             o1 = /usr/share/Macaulay2/OldChainComplexes/res.m2:284:37-311:90

             o1 : FilePosition

             i2 : 


o4 : Sequence

Since I believe we're switching to Complexes in the next release anyway, this is probably a non-issue.

@d-torrance
Copy link
Member Author

I think this is in pretty good shape now. The diff in the example output seems to be just things like timings, temporary file names, and results of shuffling the order of keys in hash tables:

https://gist.github.com/d-torrance/43282670914f1a937e7b6f2faf2d63a0

@d-torrance d-torrance marked this pull request as ready for review August 22, 2025 17:13
@d-torrance d-torrance requested a review from mahrud August 22, 2025 17:14
@mahrud
Copy link
Member

mahrud commented Aug 22, 2025

Since I believe we're switching to Complexes in the next release anyway, this is probably a non-issue.

I'm pessimistic about this. Lots of issues remain unsolved and several people I've talked to decided to keep using the old version until those are fixed, which means there may be more undiscovered bugs.

@d-torrance
Copy link
Member Author

It seems like having a package like LocalRings silently load another package that overrides the behavior of res isn't great...

Should Complexes and OldChainComplexes each check the value of HomologicalAlgebraPackage and only export res if it's them?

@mahrud
Copy link
Member

mahrud commented Aug 24, 2025

Should Complexes and OldChainComplexes each check the value of HomologicalAlgebraPackage and only export res if it's them?

Well, I think the idea was that the user loading one or the other should replace what res points to, and therefore also whatever package the user loads, but it's not perfect.

@mahrud mahrud removed their request for review September 8, 2025 23:27
@d-torrance d-torrance requested a review from antonleykin October 8, 2025 14:29
Copy link
Contributor

@antonleykin antonleykin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to do with the Complex vs. ChainComplex issue but the rest looks fine.
The build times are impressively shorter. I would like to suggest to single out the install-packages target (in test_build.yml) so that the timing for that is shown separately in every build.

@d-torrance d-torrance requested a review from antonleykin October 9, 2025 12:25
@d-torrance
Copy link
Member Author

The package installation is now in its own step for both the cmake and autotools GitHub builds.

@d-torrance d-torrance merged commit a4b4c80 into Macaulay2:development Oct 9, 2025
8 of 9 checks passed
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.

3 participants