[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 6d2a3a0 1/7: Script to configure and build in
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 6d2a3a0 1/7: Script to configure and build in tmpfs |
Date: |
Thu, 4 Aug 2016 23:21:06 +0000 (UTC) |
branch: master
commit 6d2a3a0bf694b1da06b1a8cee241393cde29ebc1
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Script to configure and build in tmpfs
As described in the comments of './parallel-build-in-tmpfs', the main
purpose of this script is to configure and build Gnuastro in a tmpfs
filesystem (in the RAM) for faster I/O and also clean backup of important
files.
---
parallel-build-in-tmpfs | 102 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git a/parallel-build-in-tmpfs b/parallel-build-in-tmpfs
new file mode 100755
index 0000000..173683f
--- /dev/null
+++ b/parallel-build-in-tmpfs
@@ -0,0 +1,102 @@
+#! /bin/sh
+
+# Configure and build Gnuastro in a temporary directory in parallel.
+#
+# The configure and build process involves the creation, reading, and
+# modification of a large number of files (input/output, or I/O). Therefore
+# 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 can be slow in on-volatile (non-RAM) memory like traditional hard
+# disks (HDDs) and even SSDs.
+#
+# - 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.
+#
+# One solution to these problems is the tmpfs file system (see
+# https://en.wikipedia.org/wiki/Tmpfs). Any file in tmpfs is actually
+# stored in the RAM, not on HDDs or SSDs. Therefore I/O can be much faster
+# and will also not harm the non-volatile memory devices. However, due to
+# the volatile nature of RAM, files in the tmpfs filesystem will be
+# permanently lost after a power-off.
+#
+# 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 here (the value to TMPDIR)
+# this should be fine for all modern Linux based OSs. This script will make
+# a 'gnuastro' directory in TMPDIR, change to that directory and configure
+# and build gnuastro in there to have fast and non-wear configures and
+# builds.
+#
+# After this script is run, change directory to $TMPDIR/gnuastro 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 /dev/shm/gnuastro; make -kj8' (to
+# build on 8 threads) instead of the default 'make -k'. In this manner, the
+# 'M-x recompile' commands to be run later 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): 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 <http://www.gnu.org/licenses/>.
+
+
+# Set the variables:
+NUM_THREADS=8
+TMPDIR=/dev/shdm
+
+
+# Check if TMPDIR exists
+if [ ! -d $TMPDIR ]; then
+ echo "$TMPDIR doesn't exist. Aborted."
+ exit 1
+fi
+
+
+# First make the Gnuastro temporary directory (if it doesn't already
+# exist).
+build_dir=$TMPDIR/gnuastro
+if [ ! -d $build_dir ]; then
+ mkdir $build_dir
+fi
+
+
+# Keep the address of this source directory and go into the build directory
+# to start the configure and/or build:
+srcdir=$(pwd)
+cd $build_dir
+
+
+# If a 'Makefile' doesn't exist, then configure Gnuastro:
+if [ ! -f Makefile ]; then
+ $srcdir/configure --srcdir=$srcdir
+fi
+
+
+# Build Gnuastro in that directory with the specified number of threads
+make -j$NUM_THREADS
- [gnuastro-commits] master updated (3a84a97 -> 6770ac8), Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master 1ff3999 2/7: Minor corrections in parallel-build-in-tmpfs, Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master 6d2a3a0 1/7: Script to configure and build in tmpfs,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 2de6a04 3/7: Make a symbolic link to access the tmpfs build, Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master abcc408 5/7: Removed argument on speed in parallel-build-in-tmpfs, Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master 18986ab 6/7: Tmpfs build script included in the distribution tarball, Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master 620aaee 4/7: Fix creation of build directory when building in RAM, Mohammad Akhlaghi, 2016/08/04
- [gnuastro-commits] master 6770ac8 7/7: Merged tmpfs build script branch, Mohammad Akhlaghi, 2016/08/04