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

Deprecate Sage's CHomP interface #33777

Closed
jhpalmieri opened this issue Apr 30, 2022 · 20 comments
Closed

Deprecate Sage's CHomP interface #33777

jhpalmieri opened this issue Apr 30, 2022 · 20 comments

Comments

@jhpalmieri
Copy link
Member

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

This comment has been minimized.

@jhpalmieri
Copy link
Member Author

Branch: u/jhpalmieri/deprecate-chomp

@jhpalmieri
Copy link
Member Author

New commits:

e0a9c87trac 33777: deprecate the CHomP interface

@jhpalmieri
Copy link
Member Author

Commit: e0a9c87

@tscrim
Copy link
Collaborator

tscrim commented May 1, 2022

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
Copy link
Member Author

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
Copy link
Collaborator

tscrim commented May 1, 2022

comment:6

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

@jhpalmieri
Copy link
Member Author

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

  • https://mathoverflow.net/questions/398060/homology-software
  • https://www.math.colostate.edu/%7Eadams/advising/appliedTopologySoftware/
  • https://github.com/shaunharker/CHomP/tree/lite: full version doesn't build for me, but git checkout lite and then ./install.sh works; doesn't build a chain complex binary, just a simplicial and cubical complex version. The simplicial complex version is unreliable: it computes the betti numbers of the product of a torus with itself very quickly, but it hangs when I ask it to compute the betti numbers of K = simplicial_complexes.NotIConnectedGraphs(6,2). Sage, on the other hand, is slow with the product of a torus with itself but completes the computation for K. (I compute K using Sage and then do print(K._chomp_repr()) and save it to a file. Remove all parentheses and commas, and then run it through chomp-simplicial.) I wonder if there is some overflow going on in CHomP in the second case. I remember reporting some overflow problems a while ago, and maybe they never got resolved.

@jhpalmieri
Copy link
Member Author

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:
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}
  • CHomP (after exporting the complexes to text files blah.simp):
% 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.

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@dimpase
Copy link
Member

dimpase commented May 5, 2022

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
Copy link
Member

dimpase commented May 5, 2022

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
Copy link
Member

dimpase commented May 5, 2022

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
Copy link
Member Author

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 shaunharker/CHomP#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
Copy link
Member Author

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
Copy link
Member

dimpase commented Jul 2, 2022

comment:15

Does kenzo provide the functionality in question?

@jhpalmieri
Copy link
Member Author

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
Copy link
Member

dimpase commented Jul 6, 2022

comment:17

OK, looks good.

@dimpase
Copy link
Member

dimpase commented Jul 6, 2022

Reviewer: Dima Pasechnik

@jhpalmieri
Copy link
Member Author

comment:18

Thank you!

@vbraun
Copy link
Member

vbraun commented Jul 9, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants