sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.3k stars 447 forks source link

Deprecate Sage's CHomP interface #33777

Closed jhpalmieri closed 2 years ago

jhpalmieri commented 2 years ago

Sage's CHomP interface is out of date: the executables now have different names and may use a different syntax. Also, CHomP has not been updated recently — the most recent changes at https://github.com/marciogameiro/CHomP (see also http://chomp.rutgers.edu/software.html) are 5 years ago — and it doesn't build on OS X. I'm not sure about other platforms. It used to be the case that CHomP was necessary for certain calculations, such as finding generators of homology groups, but Sage can now do all of that on its own. So let's deprecate the CHomP interface to Sage.

Component: algebraic topology

Author: John Palmieri

Branch/Commit: e0a9c87

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/33777

jhpalmieri commented 2 years ago

Description changed:

--- 
+++ 
@@ -1 +1 @@
-Sage's CHomP interface is out of date: the executables now have different names and may use a different syntax. Also, CHomP has not been updated recently — the most recent changes at https://github.com/marciogameiro/CHomP are 5 years ago — and it doesn't build on OS X (not sure about other platforms). It used to be the case that CHomP was necessary for certain calculations, such as finding generators of homology groups, but Sage can now do that on its own. So let's deprecate the CHomP interface to Sage.
+Sage's CHomP interface is out of date: the executables now have different names and may use a different syntax. Also, CHomP has not been updated recently — the most recent changes at https://github.com/marciogameiro/CHomP (see also http://chomp.rutgers.edu/software.html) are 5 years ago — and it doesn't build on OS X. I'm not sure about other platforms. It used to be the case that CHomP was necessary for certain calculations, such as finding generators of homology groups, but Sage can now do all of that on its own. So let's deprecate the CHomP interface to Sage.
jhpalmieri commented 2 years ago

Branch: u/jhpalmieri/deprecate-chomp

jhpalmieri commented 2 years ago

New commits:

e0a9c87trac 33777: deprecate the CHomP interface
jhpalmieri commented 2 years ago

Commit: e0a9c87

tscrim commented 2 years ago
comment:4

How does CHomP compare speed-wise to what Sage can natively do? That might be a reason to continue to support it, perhaps as an experimental package.

jhpalmieri commented 2 years ago
comment:5

Since I can't build CHomP on OS X, it's hard for me to compare. If I have a chance, I'll see if it works on a virtual linux machine and compare there.

tscrim commented 2 years ago
comment:6

I should be able to run it on my machine. Can you give me a few tests?

jhpalmieri commented 2 years ago
comment:7

If you install CHomP, the first thing to try is renaming or symlinking the executable chomp-simplicial to homsimpl and similarly chomp-cubical -> homcubes and chomp-matrix -> homchain. Then try doctesting the file sage/interfaces/chomp.py with the optional tag chomp. (Sage will try to detect the presence of binaries called homsimpl, etc.) Another thing to try:

sage: K = simplicial_complexes.NotIConnectedGraphs(6,2)
sage: %time K.homology()
sage: K._SimplicialComplex__enlarged  = {}  # clear some cached data
sage: %time K.homology(algorithm='chomp')

I don't actually know if the "new" executables use the same syntax as the old ones, so I don't know if these symlinks will work with Sage. This is part of the point: our interface is broken, and if we aren't maintaining it (as we haven't been for 5 years, apparently), then maybe we don't have the bandwidth to maintain it and we should deprecate it. Or we can fix it this time and hope that the software remains the same. Even better, we could fix it and produce an experimental CHomP package so that it gets tested every now and then. Even better, we could try to build some sort of library-level interface, rather than just using CHomP's executables. I don't have the time to do any of these except the deprecation part, and given that it's been broken for a long time and we haven't heard complaints, I would guess that it's not super high priority.

I also wonder if there is other homology software that we should be looking at instead. See

jhpalmieri commented 2 years ago
comment:8

An update with the lite version of CHomP and two simplicial complexes: K = simplicial_complexes.NotIConnectedGraphs(6,2) and TxT, the product of a torus with itself:

sage: %time TxT.homology()
CPU times: user 4min 9s, sys: 6.15 s, total: 4min 15s
Wall time: 5min 20s
{0: 0, 1: Z x Z x Z x Z, 2: Z^6, 3: Z x Z x Z x Z, 4: Z}

sage: %time K.homology()
CPU times: user 5.2 s, sys: 105 ms, total: 5.3 s
Wall time: 8.67 s
{0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: Z^24, 8: 0, 9: 0, 10: 0}
% time ./build/bin/chomp-simplicial ~/Desktop/TxT.simp
Betti Numbers: 1 4 6 4 1 
./build/bin/chomp-simplicial ~/Desktop/TxT.simp  0.14s user 0.00s system 95% cpu 0.146 total

% time ./build/bin/chomp-simplicial ~/Desktop/K.simp 
Betti Numbers: 1 0 0 0 0 0 0 24 0 0 0 
./build/bin/chomp-simplicial ~/Desktop/K.simp  474.19s user 13.71s system 84% cpu 9:35.93 total

So the timing is not consistent: TxT is much slower in Sage, K is much slower in CHomP.

dimpase commented 2 years ago
comment:10

Replying to @jhpalmieri:

Since I can't build CHomP on OS X, it's hard for me to compare. If I have a chance, I'll see if it works on a virtual linux machine and compare there.

Maybe one can build CHomP on macOS with "real" gcc/g++, not with Clang. Anyway, it's written in an old dialect of C++ it sees, so its future is not looking good.

dimpase commented 2 years ago
comment:11

Replying to @dimpase:

Replying to @jhpalmieri:

Since I can't build CHomP on OS X, it's hard for me to compare. If I have a chance, I'll see if it works on a virtual linux machine and compare there.

Maybe one can build CHomP on macOS with "real" gcc/g++, not with Clang.

no, it doesn't work, either. And dependence on old Boost is even more iffy...

dimpase commented 2 years ago
comment:12

I can't build CHomp on Fedora either - probably it needs old Boost. Same error as on macOS:

[ 37%] Building CXX object source/CMakeFiles/chomp-simplicial.dir/chomp-simplicial.cpp.o
In file included from /tmp/CHomP/source/chomp-simplicial.cpp:4:
/tmp/CHomP/include/chomp/Ring.h:224:3: error: ISO C++ forbids declaration of ‘BOOST_SERIALIZATION_SPLIT_MEMBER’ with no type [-fpermissive]
  224 |   BOOST_SERIALIZATION_SPLIT_MEMBER()
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/CHomP/include/chomp/Ring.h:224:36: error: expected ‘;’ at end of member declaration
  224 |   BOOST_SERIALIZATION_SPLIT_MEMBER()
      |                                    ^
      |                                     ;
make[2]: *** [source/CMakeFiles/chomp-simplicial.dir/build.make:76: source/CMakeFiles/chomp-simplicial.dir/chomp-simplicial.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:130: source/CMakeFiles/chomp-simplicial.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
jhpalmieri commented 2 years ago
comment:13

Here is the situation: CHomP is currently broken. The "lite" version works, at least on OS X, but has limited functionality: it builds executables for simplicial complexes and cubical complexes, but not chain complexes. The simplicial complex stuff works, but I don't understand the cubical part. There is limited documentation: the only thing I can find is the README.md at https://github.com/shaunharker/CHomP. (See also https://github.com/shaunharker/CHomP/issues/6.) As a result, I don't understand the provided examples. The README says "File format: a list of new-line separated d-tuples, where d is the dimension of the cubical complex, and the tuples represent d-dimensional cubes which will be added to the complex (along with all of their faces)". I propose that either I am missing something or this just makes no sense.

Example: (Annulus-like shape made out of squares)

(0, 1)
(0, 2)
(1, 0)
(1, 2)
(2, 0)
(2, 1)
(2, 2)

So maybe (0,1) represents a square (2-dimensional cube) with lower left corner at (0,1)? But then how do you construct a mix of cubes of different dimensions? Or how do you construct the cubical complex which consists of just the four faces of a square?

I think we have a few choices:

  1. Try to figure out what chomp-cubical is supposed to do. I am not really interested in doing this.

  2. Implement a pared-down version of the CHomP interface just for chomp-simplicial, removing everything else (since it just doesn't work).

  3. Deprecate/remove the interface completely. Note that the end of the README.md file says "I do not have much time to spend on maintenance of this project unfortunately."

  4. I suppose someone could take over maintenance of the project. That is not in my wheelhouse.

Opinions?

jhpalmieri commented 2 years ago
comment:14

Oh, and when I say that chomp-simplicial works, it doesn't have the functionality of the old version: it only returns Betti numbers, providing no information about torsion. There are also executables chomp-simplicial-z2 and chomp-simplicial-z3 which are undocumented but perhaps compute mod 2 and mod 3 homology. Torsion for other primes is not available at all.

So if you want to compute homology of a simplicial complex with torsion, no version of CHomP will work. So I really think we need to deprecate this interface.

dimpase commented 2 years ago
comment:15

Does kenzo provide the functionality in question?

jhpalmieri commented 2 years ago
comment:16

Ah, more apparent abandonware. I can find a version of Kenzo from 2008 at https://www-fourier.ujf-grenoble.fr/~sergerar/Kenzo/, and a version last modified several years ago at https://github.com/gheber/kenzo. The documentation is dated 1999, and according to that, it implements chain complexes and simplicial sets, not cubical complexes, not simplicial complexes. There have been some efforts to update it and improve its interface with Sage (#29879, #30400 comment:48) based on the branch at https://github.com/miguelmarco/kenzo/, but the branch and those efforts appear to have stalled. In any case, I think that's a parallel issue.

dimpase commented 2 years ago
comment:17

OK, looks good.

dimpase commented 2 years ago

Reviewer: Dima Pasechnik

jhpalmieri commented 2 years ago
comment:18

Thank you!

vbraun commented 2 years ago

Changed branch from u/jhpalmieri/deprecate-chomp to e0a9c87