GNU Astronomy Utilities

Previous: , Up: Configuring   [Contents][Index] Configure and build in RAM

The configure and build process involves the creation, reading, and modification of a large number of files (input/output, or I/O). Therefore file I/O issues can directly affect the work of developers who need to configure and build Gnuastro numerous times. Some of these issues are listed below:

One solution to address both these problems is to use the tmpfs file system. Any file in tmpfs is actually stored in the RAM (and possibly SAWP), not on HDDs or SSDs. The RAM is built for extensive and fast I/O. Therefore the large number of file I/Os associated with configuring and building will not harm the HDDs or SSDs. Due to the volatile nature of RAM, files in the tmpfs file-system will be permanently lost after a power-off. Since all configured and built files are derivative files (not files that have been directly written by hand) there is no problem in this and this feature can be considered as an automatic cleanup.

The modern GNU C library (and thus the Linux kernel) define the /dev/shm directory for this purpose (POSIX shared memory). So using GNU Build System’s ability to build in a separate directory (not necessarily in the source directory), we can configure and build the programs in /dev/shm to benefit from the RAM. To simplify the process, Gnuastro comes with a tmpfs-config-make script. This script will create a directory in the shared memory, and put a symbolic link to it (called build) in the top source directory (the backup/sync software therefore only needs to ignore this single link/file). The script will then internally change to that directory and configure and build (make -kjN, where N is the number of threads for a parallel build) Gnuastro in there. To benefit from this script, simply run the following command instead of ./configure and make:

$ ./tmpfs-config-make

After this script is finished, you can ‘cd build’ and run other Make commands (for example, ‘make check’, ‘make install’, or ‘make pdf’) from there. In Emacs, the command to be run with the M-x compile command (by default: make -k) can be changed to ‘cd build; make -kjN’, or ‘make -C build -kjN’ (N is the number of threads; an integer \(\geq1\)). For subsequent builds (during development) the M-x recompile command will also do all the building in the RAM while you modify the clean, and backed-up source files and make minimal/efficient use of your non-volatile HDD or SSD.

This script can be used in any software which is configured and built using the GNU Build System. Just copy it in the top source directory of that software and run it from there. The default number of threads and location of the shared memory (/dev/shm) are currently hard-coded within the script. If you need to change them, please open the script with a text editor and set their values manually.

Previous: , Up: Configuring   [Contents][Index]