Ask Your Question

How long does it take to compile the SAGE from its source?

asked 2015-02-10 22:06:11 -0500

Nownuri gravatar image

updated 2015-02-10 23:33:11 -0500

About 5 hours ago I had typed all commands for compiling the Sage from its source. After typing "make" I have been waiting until the process is completed. But still it doesn't stop and I'm afraid that there might be a problem. Could you please tell me how long time does it take to compile the sage from its source? Is it usually more than 6 hours? I'm using Macbook Pro 2013late. So cpu, RAM are not so bad. I can't understand why the sage doesn't finish the installation.

edit retag flag offensive close merge delete



First, you can set the number of CPUs used for example with export MAKE='make -j3'. On Linux with three 3GHz CPUs it usually an hour or so.

rws gravatar imagerws ( 2015-02-11 00:23:13 -0500 )edit

It took me about 7.5 hours on my 2008 Intel I7 8GB desktop.

real 437m0.682s user 415m55.272s sys 26m20.380s gravatar ( 2016-12-21 18:33:53 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2015-02-11 02:44:51 -0500

Compiling Sage takes a long time because it involves compiling a lot of dependencies and components. It can well take several hours if you are using only one core. As long as the process is running, there is no reason to suspect a problem.

If you are able to use several cores, this can reduce the build time, because several components can be built on different cores at the same time, see the comment by @rws.

When I compile Sage using only one core, I run make in the evening and have a look in the morning. On older machines, it can easily take 10 hours or more. On yours, I would expect 6 to 7 hours.

Given the intense CPU usage while compiling Sage, it's worth making sure cooling is going on properly. I pay attention to having some air around the computer, or even some air flow, to avoid overheating. For instance, I would not leave it flat on a pile of paper. Ideally I put it on a grid-like thing and near a window or fan.

Tools like ccache allow to speed things up when compiling new versions of Sage, by keeping the results of previous compilations for those components which have not changed. Under Mac OS X, ccacge can be installed using Fink, Homebrew or MacPorts, but having those around when compiling Sage can cause problems; I don't know if some people have managed to find a way to use it.

edit flag offensive delete link more


I appreciate for the explanation. Actually I typed the "make" more than 12 hours ago and went to bed. I thought it stopped due to battery-saving sleep mode. But now I see it took about 15hours. I can use SAGE now. But it's quite surprising.

I'm afraid that I put my macbook on soft cover...I do this always to avoid scratches. But I checked often the temperature of CPU and MB using widget to see RAM usage and the temperature was always below 55 degree(C). There might be no problem.

Nownuri gravatar imageNownuri ( 2015-02-11 04:07:54 -0500 )edit

I suppose you left your computer plugged in to a power outlet, rather than operating on its own battery. However the build may have paused for some time due to energy saving settings.

Under Mac OS X (I'm using 10.10.2), in System Preferences > Energy Saver > Power Adapter, tick the box "Prevent computer from sleeping automatically when the display is off", and untick the box "Put hard disks to sleep when possible" to make sure that the build won't stop after some time of you not interacting with your computer.

slelievre gravatar imageslelievre ( 2015-02-11 05:18:57 -0500 )edit

Oh, Thank you again for the comment. I'd do it when I compile other packages.

Nownuri gravatar imageNownuri ( 2015-02-11 08:47:34 -0500 )edit

answered 2015-02-11 05:10:43 -0500

tmonteil gravatar image

updated 2015-02-11 12:59:11 -0500

Among dependencies, the longest to build is (by far) atlas because it compiles tons of different binaries, then test them one by one and selects the one that runs fastest on you computer. So, a good way to accelerate the computation is to tell atlas to do only a single compilation by setting which CPU do you are running on. In your case, the following generic choice might work, just type this on the terminal before typing make:

export SAGE_ATLAS_ARCH=fast

You will save many hours of compilation. If there is an easy way to install pre-compiled atlas on a mac (no idea), you can avoid to compile atlas at all, by setting the SAGE_ATLAS_LIB variable.

In general, the more you tell about your system, the fastest the compilation will be, see for example how to set the number of CPU's to compile in parallel. There are many options that could be found in the environment variables section of the install manual.

edit flag offensive delete link more

answered 2015-02-11 12:05:36 -0500

kcrisman gravatar image

In this particular case, since you have a Mac where we do not build ATLAS, the time is probably building gcc, which we do because Apple's compiler will not directly support a number of packages. So on Mac it does take significantly faster, especially if you are using only one core.

edit flag offensive delete link more

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


Asked: 2015-02-10 22:06:11 -0500

Seen: 1,130 times

Last updated: Feb 11 '15