[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 6770ac8 7/7: Merged tmpfs build script branch

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6770ac8 7/7: Merged tmpfs build script branch
Date: Thu, 4 Aug 2016 23:21:07 +0000 (UTC)

branch: master
commit 6770ac8335b1f62c0ff59638c8181f005c436534
Merge: 3a84a97 18986ab
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Merged tmpfs build script branch
    The tmpfs build script is now merged with master.
 .gitignore        |    1 +       |    8 +--
 tmpfs-config-make |  144 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9912e9e..12f5447 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,6 +60,7 @@
diff --git a/ b/
index d437df5..aeab85b 100644
--- a/
+++ b/
@@ -113,10 +113,10 @@ dist_doc_DATA = README
 ## Files that are only distributed
 ## ===============================
-EXTRA_DIST = bootstrap bootstrap.conf genauthors .dir-locals.el .version  \
-             bootstrapped/m4/gnulib-cache.m4 bootstrapped/README         \
-             .autom4te.cfg lib/gnuastro/commonargs.h                     \
-             lib/gnuastro/commonparams.h lib/gnuastro/fixedstringmacros.h \
+EXTRA_DIST = bootstrap bootstrap.conf genauthors .dir-locals.el .version   \
+             tmpfs-config-make bootstrapped/m4/gnulib-cache.m4             \
+             bootstrapped/README .autom4te.cfg lib/gnuastro/commonargs.h   \
+             lib/gnuastro/commonparams.h lib/gnuastro/fixedstringmacros.h  \
              lib/gnuastro/neighbors.h lib/gnuastro/README
diff --git a/tmpfs-config-make b/tmpfs-config-make
new file mode 100755
index 0000000..bb2153f
--- /dev/null
+++ b/tmpfs-config-make
@@ -0,0 +1,144 @@
+#! /bin/sh
+# This script will configure and build Gnuastro in parallel within a
+# temporary tmpfs directory in the RAM. Then it will create a symbolic link
+# to access that temporary directory which is called 'build'. Ideally this
+# script should only be run the first time when you want to run
+# './configure' and 'make'. For future builds 'make' should be run in the
+# 'build' directory, either run 'cd build' first, or 'make -C build'. If
+# the configure script dependencies didn't change, you can also run this
+# script again to run make in the build directory.
+# 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 such issues are listed
+# below:
+#   - I/O will cause wear and tear on both the HDDs (mechanical failures)
+#     and SSDs (decreasing the lifetime).
+#   - Having the built files mixed with the source files can greatly affect
+#     backing up (synchronization) of source files (since it involves the
+#     management of a large number of small files that are changed a
+#     lot. Such systems can ofcourse be configured to ignore some files and
+#     directories but that will require a high level of customization.
+# One solution to these problems is the tmpfs file system (see
+# Any file in tmpfs is actually
+# stored in the RAM (and possibly SAWP), not on HDDs or SSDs. The RAM is
+# built for a large number of fast file I/O. Therefore the large number of
+# file I/O will not harm the HDDs or SSDs. However, due to the volatile
+# nature of RAM, files in the tmpfs filesystem 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 and automatic cleanup.
+# The modern GNU C library (and thus the Linux kernel) define the
+# '/dev/shm' directory for this purpose (POSIX shared memory). Therefore
+# this script takes '/dev/shm' as the default temporary directory (the
+# value to TMPDIR). This script will make a 'gnuastro' directory in TMPDIR,
+# and a symbolic link to it called "build" in the top source directory.  It
+# will then internally change to that directory and configure and build
+# (run 'make -kjN') Gnuastro in there.
+# After this script is run, you can 'cd build' and run other 'make'
+# commands (for example 'make pdf', 'make check', or 'make install') from
+# there. In Emacs, the command to be run with the 'M-x compile' command can
+# be changed to 'cd build; make -kjN' (N is an integer >=1) instead of the
+# default 'make -k'. In this manner, the 'M-x recompile' command to be run
+# during the development will also build in the RAM while you modify the
+# source in your non-volatile HDD or SSD.
+# To further speed up the build process, this script will build ('make')
+# Gnuastro on multiple threads (value to the 'NUM_THREADS' variable
+# bellow). This script can also be used in any other source file that uses
+# the GNU build system.
+# Original author: Mohammad Akhlaghi <address@hidden>
+# Contributing author(s):
+#   Mosè Giordano <address@hidden>
+# Copyright (C) 2016, Free Software Foundation, Inc.
+# Gnuastro is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+# Gnuastro is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+# You should have received a copy of the GNU General Public License along
+# with Gnuastro. If not, see <>.
+# Set the variables:
+# Check if TMPDIR exists
+if [ ! -d $TMPDIR ]; then
+    echo "$TMPDIR doesn't exist. Aborted."
+    exit 1
+# Set the build directory name in tmpfs. If the .version file exists, use
+# it to allow multiple version builds there (which might happen during
+# development).
+if [ -f .version ]; then
+    build_dir=$TMPDIR/gnuastro-$(cat .version)
+    build_dir=$TMPDIR/gnuastro
+# Make the build directory in tmpfs (if it doesn't already exist).
+if [ ! -d $build_dir ]; then
+    mkdir $build_dir
+# Make a symbolic link to the tmpfs build directory for users to easily
+# access the built files and also follow the progress. We are first
+# deleting any existing symbolic link and remaking it since the possible
+# deletion of $build_dir during the development can complicate the
+# pre-existing symbolic link.
+if [ -h $build_sym ]; then
+    # Delete a harmless symbolic link, if present.
+    rm $build_sym
+# Create the link only if the symbolic link doesn't exist.
+if [ ! -e $build_sym ]; then
+    ln -s $build_dir $build_sym
+    echo "$build_sym already exists here and is not a symbolic link."
+    echo "Aborted."
+    exit 1
+# Keep the address of this source directory and go into the build directory
+# to start the configure and/or build:
+cd $build_dir
+# If a 'Makefile' doesn't exist, then configure Gnuastro:
+if [ ! -f Makefile ]; then
+    $srcdir/configure --srcdir=$srcdir
+# Build Gnuastro in that directory with the specified number of threads
+make -kj$NUM_THREADS

reply via email to

[Prev in Thread] Current Thread [Next in Thread]