Ask Your Question
2

Disable modules at compile-time or runtime

asked 2018-10-08 22:07:28 +0100

Lephe gravatar image

I'm building SAGE for a humble Raspberry Pi platform (although I'm currently experimenting compilation on a good computer), and given the power of the Pi target I'd like to build and use only a reduced part of SageMath's modules. Anything too far above the level of a high-school student can be cut off, I only plan to use exact calculus and basic analysis tools.

So far I've looked at the installation guide and tried a few things with the configure script, but I found no option to disable modules.

Is there anything planned for this purpose? Or do I have to build SageMath entirely no matter what?

I considered loading only part of the Python modules at runtime, but I figure SageMath will load the others when it sees fit.

Is there a way to disable part of SageMath at runtime?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2018-10-08 22:40:50 +0100

tmonteil gravatar image

updated 2018-10-08 23:25:38 +0100

Since you are compiling Sage on a powerful virtual machine, i would advise not touching the build system, just not to lose your time. If you absoluely want to do that, you can disable the compilation of some standard packages by declaring them optional (for this, you will have to edit the fiie SAGE_ROOT/build/pkgs/<package>/type for each <package>, and run ./configure again), but you will experience a lot of issues (unsatisfied dependencies). Some simple removals are doable (e.g. removing both r and ryp2).

Now, if you speak about runtime, you can remove some automatic imports at startup. The Sage modules are imported in SAGE_ROOT/src/sage/all.py, and it recursively calls the contents of SAGE_ROOT/src/sage/<module>/all.py for each <module>.

By the way, i would be interested to see how you deploy your build infrastructure (i personaly have some hand-made build system that is used to build some specific 32bit patchbots, Sage Dabian Live (and a bunch of Sage binaries a few years ago), and i was thinking whether it is worth cleaning them and why not extend them to build such weird images, hence i would be glad to see your approach).

For your needs, you could also try to just install sympy and run it from a jupyer notebook (probably both distributed from your distro).

edit flag offensive delete link more

Comments

Thanks! I'll start by giving the package type option a try. Currently I made a subset of packages optional and made sure that all packages depending on them were also optional. However, they are still built (typically ppl which is mentioned in no dependencies file). Did I miss something in the build system? Is there any way to know why Sage decides to build them? I checked the logs but found nothing of interest.

Lephe gravatar imageLephe ( 2018-10-11 21:17:56 +0100 )edit

Regarding ppl, you could have a look at SAGE_ROOT/build/make/deps too.

tmonteil gravatar imagetmonteil ( 2018-10-12 01:20:44 +0100 )edit

Oh, you're right! I had missed the deps file for SageLib. Now I see how monolithic it is. ^^ I'll try the runtime method now, thanks again for your help!

Lephe gravatar imageLephe ( 2018-10-13 11:47:03 +0100 )edit
1

answered 2018-10-09 17:34:28 +0100

slelievre gravatar image

updated 2018-10-25 01:36:34 +0100

Making Sage more modular is on the roadmap and will make what you ask easier in the future, but it's not there yet. Besides removing R and RPy2 as @tmonteil suggests, I don't see any easy targets.

Below is a list (edited 2018-10-25) of more lightweight software in case SageMath takes too much space for your needs.

In the same spirit as the suggestion by @tmonteil to consider using

consider also

or, as suggested by @Loveless,

or the recently revived:

  • Python-FLINT (Python bindings for FLINT and Arb), by Fredrik Johansson, who in the announcement of the latest revival, explains that

    The goal is to have a Python wrapper for Flint and Arb that is just a standalone and lightweight Python module, no multi-gigabyte Sage installation required. Also, the user doesn't have to construct parent rings, so the interface is more convenient for quick calculations.

edit flag offensive delete link more

Comments

These alternatives sound good indeed! I may note use the Jupyter notebook (I need desktop programs), but SymPy is definitely a good choice. I also have Giac in mind.

Lephe gravatar imageLephe ( 2018-10-13 11:49:46 +0100 )edit

Yes, Giac is also an excellent idea.

slelievre gravatar imageslelievre ( 2018-10-17 12:07:14 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-10-08 22:07:28 +0100

Seen: 687 times

Last updated: Oct 25 '18