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

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 close merge delete

1

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.

( 2015-02-11 00:23:13 -0600 )edit

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

real 437m0.682s user 415m55.272s sys 26m20.380s

( 2016-12-21 18:33:53 -0600 )edit

Sort by » oldest newest most voted

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.

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.

( 2015-02-11 04:07:54 -0600 )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.

( 2015-02-11 05:18:57 -0600 )edit

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

( 2015-02-11 08:47:34 -0600 )edit

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.

more

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.

more