gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2de6a04 3/7: Make a symbolic link to access th


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2de6a04 3/7: Make a symbolic link to access the tmpfs build
Date: Thu, 4 Aug 2016 23:21:06 +0000 (UTC)

branch: master
commit 2de6a041ed550123c51eac8af5a47330687880b3
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Make a symbolic link to access the tmpfs build
    
    After the build was done in the tmpfs directory, it was hard to access it:
    you had to 'cd /dev/shm/gnuastro' to get to it. So to make things easier,
    the 'parallel-build-in-tmpfs' script will now create a symbolic link to
    that location and put it in the top source directory so users can easily
    get there by clicking on the link or running 'cd build'. This symbolic link
    was also added to '.gitignore', so it is not tracked in the version
    controlled history.
---
 .gitignore              |    1 +
 parallel-build-in-tmpfs |   51 ++++++++++++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9912e9e..12f5447 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,6 +60,7 @@
 
 .deps
 .sync
+build
 ar-lib
 missing
 compile
diff --git a/parallel-build-in-tmpfs b/parallel-build-in-tmpfs
index 1751566..2046879 100755
--- a/parallel-build-in-tmpfs
+++ b/parallel-build-in-tmpfs
@@ -1,6 +1,8 @@
 #! /bin/sh
 
-# Configure and build Gnuastro in a temporary directory in parallel.
+# 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 called 'build'.
 #
 # The configure and build process involves the creation, reading, and
 # modification of a large number of files (input/output, or I/O). Therefore
@@ -8,8 +10,8 @@
 # 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 can be slow in non-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).
@@ -27,22 +29,24 @@
 # hardware. However, due to the volatile nature of RAM, files in the tmpfs
 # filesystem will be permanently lost after a power-off, since they are all
 # derivative files (not files that have been directly manipulated) there is
-# no problem in this.
+# 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,
-# change to that directory and configure and build gnuastro in there to
-# have fast and non-wear configures and builds.
+# 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, 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.
+# 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
+# duringn 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
@@ -54,8 +58,7 @@
 # Original author: Mohammad Akhlaghi <address@hidden>
 # Contributing author(s):
 #
-# Copyright (C) 2016, Free Software Foundation,
-# Inc.
+# 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
@@ -91,6 +94,22 @@ if [ ! -d $build_dir ]; then
 fi
 
 
+# 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.
+build_sym=build
+if [ -h $build_sym ]; then
+    rm $build_sym
+    ln -s $build_dir $build_sym
+else
+    echo "$build_sym already exists here and is not a symbolic link."
+    echo "Aborted."
+    exit 1
+fi
+
+
 # Keep the address of this source directory and go into the build directory
 # to start the configure and/or build:
 srcdir=$(pwd)
@@ -104,4 +123,4 @@ fi
 
 
 # Build Gnuastro in that directory with the specified number of threads
-make -j$NUM_THREADS
+make -kj$NUM_THREADS



reply via email to

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