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

Load PrimGrp, SmallGrp and TransGrp packages if available #1714

Merged
merged 2 commits into from
Oct 6, 2017

Conversation

olexandr-konovalov
Copy link
Member

@olexandr-konovalov olexandr-konovalov commented Sep 12, 2017

This is a modification of some changes attempted in #1650 (part of the plan attempted in #1650 in order to make the transition less disruptive).

If any of these packages is not available, GAP will read corresponding directory (prim, small or trans).

Dependency on TRANSGrp defined in the package required reading lib/galois.g* files in another place (in read4.g). In its turn, they require IsIrreducible which is defined in overload.g and delegates to IsIrreducibleRingElement, hence the latter was used.

Since the CI scripts are note yet using packages-master.tar.gz, this will now be tested for the setting in which none of the three new packages is available.

The next step would be to switch to packages-master.tar.gz and run CI tests with two of the packages - PrimGrp and TransGrp.

When this will be merged, we will be able to tell developers to get the new packages in question, either installing them individually or by removing pkg directory and calling make bootstrap-pkg-full to get the latest collection of GAP packages for the master branch.

After that, assuming that developers obtained relevant packages, we may proceed with next steps (could be done for one package at a time):

  • removing prim/small/trans directories as soon and taking out of the manuals those sections which have been incorporated into packages
  • replacing temporary code to ensure that GAP loads the packages by adding packages to GAPInfo.Dependencies.NeededOtherPackages.

@@ -1824,6 +1824,19 @@ BindGlobal( "BANNER", false );

GAPInfo.delayedImplementationParts:= [];

# Ensure GAP loads PrimGrp, SmallGrp and TransGrp packages
# To be migrared to lib/system.g after the replacement of
Copy link
Member

Choose a reason for hiding this comment

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

Typo: migrated

## callable, even if the library is unavailable.
if TestPackageAvailability("PrimGrp")=fail then
InstallGlobalFunction(PrimitiveGroupsAvailable,deg->false);
fi;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't there be something like this for smallgrp, too? @markuspf is there? (Not on my computer, so I can't check right now)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's already there, above those lines:

 if TestPackageAvailability("smallgrp")=fail then
   ReadSmall( "readsml.g","small groups" );	
 fi;	

Copy link
Member

Choose a reason for hiding this comment

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

Its currently called SMALL_AVAILABLE and t akes as an argument a number and either returns a record or fail.

Copy link
Member

Choose a reason for hiding this comment

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

@alex-konovalov no, that's something else

@markuspf right, I know about that one, but I was thinking about something more user friendly and actually documented (SMALL_AVAILABLE is an internal function). I've submit this as gap-packages/smallgrp#20

@@ -546,7 +546,7 @@ local f,n,i,sh,fu,ps,pps,ind,keineu,ba,bk,j,k,a,anz,pm,
Info(InfoPerformance,2,"Using Transitive Groups Library");
f:=arg[1];
f:=f/LeadingCoefficient(f);
if not(IsIrreducible(f)) then
if not(IsIrreducibleRingElement(f)) then
Copy link
Member

Choose a reason for hiding this comment

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

Since you are changing this anyway, perhaps remove the superfluous parenthesis?

@codecov
Copy link

codecov bot commented Sep 13, 2017

Codecov Report

Merging #1714 into master will decrease coverage by 14.15%.
The diff coverage is 80%.

@@             Coverage Diff             @@
##           master    #1714       +/-   ##
===========================================
- Coverage   63.43%   49.28%   -14.16%     
===========================================
  Files        1000      459      -541     
  Lines      322760   239320    -83440     
  Branches    13015    10724     -2291     
===========================================
- Hits       204757   117959    -86798     
- Misses     115361   118627     +3266     
- Partials     2642     2734       +92
Impacted Files Coverage Δ
lib/galois.gi 0% <0%> (-50.46%) ⬇️
lib/package.gi 35.96% <88.88%> (-0.6%) ⬇️
lib/attr.gi 0% <0%> (-100%) ⬇️
lib/teachm2.g 0% <0%> (-100%) ⬇️
lib/session.g 0% <0%> (-90.33%) ⬇️
lib/contfrac.gi 0% <0%> (-89.48%) ⬇️
lib/wpobj.gi 8.69% <0%> (-89.14%) ⬇️
grp/imf.gi 0% <0%> (-84.96%) ⬇️
lib/proto.gi 0% <0%> (-83.34%) ⬇️
lib/ctblauto.gi 0% <0%> (-82.41%) ⬇️
... and 862 more

@olexandr-konovalov
Copy link
Member Author

HPC-GAP fails with

Syntax warning: Unbound global variable in /home/travis/build/gap-system/gap/h\
pcgap/lib/galois.gi:503
 atomic TRANSREGION do
                     ^
  • I will investigate. Maybe the order in which files are read is different.

Copy link
Contributor

@hulpke hulpke left a comment

Choose a reason for hiding this comment

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

Looks OK to me.

@olexandr-konovalov
Copy link
Member Author

Hm, unlike prim, the hpcgap/trans directory has two files. I will look how to refactor this.

lib/read4.g Outdated

if not IsBound(HPCGAP) then
# Galois group identification relies on the list of transitive groups
# (in HPC-GAP these file are read in read.g)
Copy link
Member

Choose a reason for hiding this comment

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

But why is this different between GAP and HPC-GAP? The comment should explain that (which is the difficult, non-trivial part -- in contrast figuring out where GAP vs. HPC-GAP loads something can be figured with a simple "grep" in a few seconds)

And independently of that: Why does regular GAP put this into read4.g? I'd expect this to be in read3.g and read5.g, for the .gd and .gi respectively.

Copy link
Member Author

Choose a reason for hiding this comment

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

@fingolfin: Because we want to please both installations with and without new packages. Starting GAP with -D option, one can see that the relative order in which these files are read is different. If there is no transgrp package, it is

#I  READ_GAP_ROOT: loading 'trans/trans.gd' as GAP file
#I  READ_GAP_ROOT: loading 'trans/trans.grp' as GAP file
#I  READ_GAP_ROOT: loading 'trans/trans.gi' as GAP file
#I  READ_GAP_ROOT: loading 'lib/galois.gd' as GAP file
#I  READ_GAP_ROOT: loading 'lib/galois.gi' as GAP file

With it we have

#I  READ_GAP_ROOT: loading 'lib/trans.gd' as GAP file
#I  READ_GAP_ROOT: loading 'lib/galois.gd' as GAP file
#I    Read( "/Users/alexk/GITREPS/gap/pkg/transgrp/lib/trans.grp" )
#I    Read( "/Users/alexk/GITREPS/gap/pkg/transgrp/lib/trans.gi" )
#I  READ_GAP_ROOT: loading 'lib/galois.gi' as GAP file

Furthermore, TRANSREGION is defined in hpcgap/trans/trans.gd - when the package is present, this will not be read, so I define it in hpcgap/lib/read.g.

I was testing this with packages and without package, and found this "equilibrium". It works now while we need to cater for both setups. As soon as we will go to the next stage and will remove trans and hpcgap/trans, I will look again and will try to converge handling of this in GAP and HPC-GAP.

Copy link
Member

Choose a reason for hiding this comment

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

@alex-konovalov I still don't understand. You described the effect, telling me that the load order is different between GAP and HPC-GAP -- and, well, of course it is, as e.g. the ReadLib calls in a different order. But that still doesn't give me a logical reason for why we do it like that.

My POV is this: Either there are strong reasons why it must be different, then we should document them in comments quite clearly. Or else, there are purely technical obstacles which we can and should remove, to make it possible to align this code.

The TRANSREGION sounds like the latter to me. Indeed, this is completely missing from the transgrp package -- so I guess before we can fix it, we must make transgrp HPC-GAP ready.

I'll look into that now.

Copy link
Member Author

Choose a reason for hiding this comment

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

@fingolfin it's not only that the load order is different between GAP and HPC-GAP - it is also different dependently on whether the data library is a package or directory.

I have been trying to resolve all problems without making any changes in transgrp, assuming that those can be made eventually - transgrp is not hosted under gap-packages and has a longer release cycle. If you could look at that, please do, of course.

Copy link
Member

Choose a reason for hiding this comment

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

But transgrp does not contain any HPC-GAP specific changes. So with this PR, support for transitive groups in HPC-GAP will be completely broken, no? And probably also for smallgrp, unless that contains HPC-GAP specific changes (I didn't see any on a quick glance just now... @markuspf ?)

So, for now it might be best to leave out the LoadPackage bits for HPC-GAP, until those packages contain the HPC-GAP specific changes, no?

##
## Assign TransitiveGroupsAvailable to a dummy function to make it
## callable, even if the library is unavailable.
if TestPackageAvailability("TransGrp")=fail then
Copy link
Member

Choose a reason for hiding this comment

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

can we please change this to "transgrp", to match the other places (same for PrimgGrp and SmallGrp below). Or, if you prefer, change all other places to use TransGrp. Just as long as it is consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. I think because LoadPackage and friends is case-insensitive, lowercase everywhere for all packages would be consistent (I do not use uppercase when requesting a package, and I think the same applies to most of users).

The canonical NAME of the package is the other thing. Here authors may combine upper and lower case as they wish. My preferred spelling would be mixed case, like PrimGrp, SmallGrp, TransGrp in this case.

Copy link
Member

Choose a reason for hiding this comment

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

If you'd like the packages to use that spelling for their canonical name, then feel free to submit pull requests to change their PackageInfo.g files accordingly -- right now, though, transgrp and smallgrp use an all-lowercase spelling, only PrimGrp does not.

Alexander Konovalov added 2 commits September 29, 2017 15:11
If any of these packages is not available, GAP will read corresponding
directory (`prim`, `small` or `trans`).

Also replaced the call of `IsIrreducible` in `lib/galois.g` by
`IsIrreducibleRingElement` to allow reading it earlier than
`overload.g`, and moved definition of `TRANSREGION` out of `trans`
directory to make it working both with `trans` and TransGrp package.
@olexandr-konovalov
Copy link
Member Author

This has been rebased. Tests without and with prim and trans should be passing (hopefully).

  • lib/read.g and hpcgap/lib/read.g now have no diffs
  • definition of TRANSREGION moved out of trans directory to read4.g make it working both with trans and TransGrp package.
  • Both ReadLib("galois.gd"); and ReadLib("galois.gi"); are currently read in lib/read4.g, so there is no difference in the place where they are read in GAP and HPC-GAP.

As for whether ReadLib("galois.gd"); and ReadLib("galois.gi"); should be read in different places, it is tricky now to please both trans directory and transgrp package because of TRANSProperties.

It is defined in lib/grpperm.gd as a placeholder. Then it is unbound in trans/trans.gd to be redefined in trans/trans.grp or pkg/transgrp/lib/trans.grp as an actual function.

When trans directory is loaded, trans/trans.grp is read immediately after trans/trans.gd, so TRANSProperties does not "vanish". But when the package is loaded, if I move ReadLib("galois.gi"); to lib/read5.g, it is being read between trans/trans.gd and trans/trans.grp, so I have a warning about unbound TRANSProperties.

@olexandr-konovalov
Copy link
Member Author

testpackages in Travis fails because bin/BuildPackages.sh fails to build NormalizInterface-1.0.0. We did not see on travis before since we were using packages from GAP 4.8.8 distribution, while this PR tries to use more recent packages archive.

I can update merged packages archive to rollback to the previous NormalizInterface or if @sebasguts will be able to investigate, wait for the fix.

@olexandr-konovalov
Copy link
Member Author

I will now rollback to the stable version of NormalizInterface while @sebasguts will prepare a new one. This should make tests pass.

@olexandr-konovalov
Copy link
Member Author

Tests are now passing. But I've downloaded and installed smallgrp package, and in HPC-GAP I have this:

testing: /Users/alexk/GITREPS/gap/tst/testinstall/hpc/task.tst
########> Diff in /Users/alexk/GITREPS/gap/tst/testinstall/hpc/task.tst:55
# Input is:
CallAsTask(SmallGroup,256,1);
# Expected output:
<pc group of size 256 with 8 generators>
# But found:
fail
########

Will investigate tomorrow.

@olexandr-konovalov
Copy link
Member Author

The third package - SmallGrp - has now been picked up for the redistribution, so this PR is now fully tested and we can merge it now.

Next step would be to instruct everyone to download and install the three new packages - PrimGrp, TransGrp, SmallGrp (individually or via make bootstrap-pkg-full). In the meantime, I will rebase and update #1650 which will remove prim, trans and small directories and clean up documentation. I suggest to ask everyone to be ready for #1650 by November 1st.

After that, when #1650 will be merged, GAP will not start without the three packages, so everyone who will not switch by that time, would have to download and install them.

@stevelinton stevelinton merged commit 7662892 into gap-system:master Oct 6, 2017
@olexandr-konovalov olexandr-konovalov deleted the swap-libs-pkgs branch October 17, 2017 22:16
olexandr-konovalov pushed a commit to olexandr-konovalov/gap that referenced this pull request Nov 4, 2017
PR gap-system#1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
olexandr-konovalov pushed a commit to olexandr-konovalov/gap that referenced this pull request Nov 4, 2017
PR gap-system#1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
olexandr-konovalov pushed a commit to olexandr-konovalov/gap that referenced this pull request Nov 6, 2017
PR gap-system#1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
olexandr-konovalov pushed a commit to olexandr-konovalov/gap that referenced this pull request Nov 6, 2017
PR gap-system#1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
olexandr-konovalov pushed a commit to olexandr-konovalov/gap that referenced this pull request Nov 6, 2017
PR gap-system#1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
fingolfin pushed a commit that referenced this pull request Nov 6, 2017
PR #1714 added some code needed to load either a new package for
a data library, if present, or load the existing prim, small or
trans directory otherwise. This code is not needed any more,
since we remove prim, trans, and small directories.

Also make PrimGrp, SmallGrp and TransGrp packages needed to run
GAP. This ensures that a proper error message will be displayed
in case any of these packages is missing.
@fingolfin fingolfin added release notes: added PRs introducing changes that have since been mentioned in the release notes topic: library topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker) labels Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: added PRs introducing changes that have since been mentioned in the release notes topic: library topic: packages issues or PRs related to package handling, or specific to a package (for packages w/o issue tracker)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants