aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-02-15 14:10:29 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-02-15 14:22:04 +0100
commitf9de1124b675b2cfd09e9ad75aeda45ecea7319a (patch)
treea83fe1129e9ac5a641f15c57bd1ce7a1d795ec66
parente45ac9f074a62a0dab26e4de86e4c97458384d18 (diff)
Gnuastro's memory mapping is now a local variable
As described in the commens above `MINMAPSIZE' of `LOCAL.mk.in', the amount of memory to map to HDD/SSD or keep in RAM is a local issue and not relevant to the pipeline's results. So it is now defined in a `gnuastro-local.conf' file. To keep the Makefiles clean, this file is created by the `./configure' script. To do this cleanly, the `./configure' script was also almost fully re-written with better functionality now.
-rw-r--r--.gitignore12
-rw-r--r--README.md22
-rwxr-xr-xconfigure184
-rw-r--r--reproduce/config/gnuastro/gnuastro.conf10
-rw-r--r--reproduce/config/pipeline/LOCAL.mk.in20
-rw-r--r--reproduce/src/make/initialize.mk4
6 files changed, 180 insertions, 72 deletions
diff --git a/.gitignore b/.gitignore
index 84d739b..83de0ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,10 +5,14 @@
*.pdf
*.out
*.auxlock
-config/mmap_*
+.gnuastro/mmap_*
+LOCAL_tmp.mk
+LOCAL_old.mk
reproduce/build
-reproduce/BDIR/
tex/pipeline.tex
-reproduce/SURVEY/
-reproduce/config/pipeline/LOCAL.mk \ No newline at end of file
+gnuastro-local.conf
+reproduce/config/pipeline/LOCAL.mk
+
+reproduce/BDIR/
+reproduce/SURVEY/ \ No newline at end of file
diff --git a/README.md b/README.md
index 59ecf71..ce4e4d8 100644
--- a/README.md
+++ b/README.md
@@ -158,16 +158,22 @@ been explained here), please let us know to correct it.
dependency of the pipeline and without it, the pipeline will complain
and abort. The main reason for this is to demonstrate how critically
important it is to version your software. If you don't want to install
- Gnuastro please follow the instructions in the list below. If you do
- have Gnuastro (or have installed it to check this pipeline), then
- after an initial check, try un-commenting the `onlyversion` line and
- running the pipeline to see the respective error. Such features in a
- software makes it easy to design a robust pipeline like this. If you
- have tried it and don't need Gnuastro in your pipeline, also follow
- this list:
+ Gnuastro please follow the instructions in the list below. If you have
+ installed Gnuastro and tried the pipeline, but don't need Gnuastro in
+ your pipeline, also follow the list below. If you do want to use
+ Gnuastro in your pipeline, be sure to un-comment the `onlyversion`
+ option in `reproduce/config/gnuastro/gnuastro.conf' file and set it to
+ your version of Gnuastro. This will force you to keep the pipeline in
+ match with the version of Gnuastro you are using all the time and also
+ allow commits to be exactly reproducible also (for example if you
+ update to a new version of Gnuastro during your research project). If
+ you will be using Gnuastro, you can also remove the "marks" (comments)
+ put in the relevant files of the list below to make them more
+ readable.
- Delete the description about Gnuastro in `README`.
- - Delete everything about Gnuastro in `reproduce/src/make/initialize.mk`.
+ - Delete marked parts in `configure`.
+ - Delete marked parts in `reproduce/src/make/initialize.mk`.
- Delete `and Gnuastro \gnuastroversion` from `tex/preamble-style`.
- **`README`**: Go through this top-level instruction file and make it fit
diff --git a/configure b/configure
index 43083df..061a810 100755
--- a/configure
+++ b/configure
@@ -24,70 +24,146 @@
-# Location of the settings directory:
-pdir=reproduce/config/pipeline
+# Top level locations
+cdir=reproduce/config
+pdir=$cdir/pipeline
+pconf=$pdir/LOCAL.mk
+ptconf=$pdir/LOCAL_tmp.mk
+poconf=$pdir/LOCAL_old.mk
+gconf=$cdir/gnuastro/gnuastro-local.conf
-# If `LOCAL.mk' is already created, then ignore this step.
-if [ -f $pdir/LOCAL.mk ]; then
- echo
- echo "$pdir/LOCAL.mk already exists."
- echo "To change/correct the top-level directories, please remove/edit it manually."
- echo
-else
+# Functions.
+function add_top_notice() {
+ if echo "# DO NOT EDIT MANUALLY: this is an automatically generated file." > $1
+ then
+ echo "#" >> $1
+ echo "# This file is generated from the reproduction" >> $1
+ echo "# pipeline's './configure' script. Please re-run" >> $1
+ echo "# that command." >> $1
+ else
+ exit 1
+ fi
+}
+
+
+
- # Copy the base file to the desired output file.
- if cp $pdir/LOCAL.mk.in $pdir/LOCAL.mk; then
-
- # Tell the user to edit the directories.
- while [ "$userread" != "y" -a "$userread" != "n" ]
- do
- echo
- echo "-----------------------------------------"
- echo "Reproduction pipeline local configuration"
- echo "-----------------------------------------"
- echo
- echo "Local settings include things like top-level directories,"
- echo "or processing steps (e.g., if you want a final PDF output)."
- echo
- echo "Pressing 'y' will open the local settings file in an editor"
- echo "so you can modify the default values if you want. Each"
- echo "variable is thoroughly described in the comments (lines"
- echo "starting with a '#') above it."
- echo
- read -p"Edit the default local configuration (y/n)? " userread
- done
-
- # Only continue if the user wants to edit the top level
- # directories
- if [ $userread = "y" ]; then
-
- # Open a text editor to set the given directories
- if emacs $pdir/LOCAL.mk; then junk=1
- elif gedit $pdir/LOCAL.mk; then junk=1
- elif vi $pdir/LOCAL.mk; then junk=1
- else
- echo
- echo "No common text editor found on your system."
- echo "Please set the values in '$pdir/LOCAL.mk' manually."
- echo
- fi
- fi
+
+# If `LOCAL.mk' already exists, then copy it to an `.old' file.
+if [ -f $pconf ]; then
+ if mv $pconf $poconf; then
echo
- echo "This reproduction pipeline has been configured for this system."
- echo "Please run the following command to start the pipeline:"
- echo "(Replace '8' with the number of CPU threads available)"
+ echo "-------"
+ echo "WARNING"
+ echo "-------"
+ echo " Existing configuration moved to '$poconf'."
echo
- echo " make -j8"
echo
+ else
+ exit 1
+ fi
+fi
+
+
+
+
+
+# Using the base file, prepare the output file.
+cp $pconf.in $ptconf
+
+
+
+
+
+# Tell the user to edit the directories.
+echo
+echo "-----------------------------------------"
+echo "Reproduction pipeline local configuration"
+echo "-----------------------------------------"
+echo
+echo "Local settings include things like top-level directories,"
+echo "or processing steps (e.g., if you want a final PDF output)."
+echo
+echo "Pressing 'y' will open the local settings file in an editor"
+echo "so you can modify the default values if you want. Each"
+echo "variable is thoroughly described in the comments (lines"
+echo "starting with a '#') above it."
+echo
+while [ "$userread" != "y" -a "$userread" != "n" ]
+do
+ read -p"Edit the default local configuration (y/n)? " userread
+done
+
+
+
+
+
+# Open an editor if the user wants to edit the file.
+if [ $userread = "y" ]; then
+
+ # Open a text editor to set the given directories
+ if emacs $ptconf; then ready=1
+ elif gedit $ptconf; then ready=1
+ elif vi $ptconf; then ready=1
+ else
echo
- echo "(you can always check/modify the default local settings"
- echo " by editing this file: '$pdir/LOCAL.mk')"
+ echo "================="
+ echo "IMPORTANT WARNING"
+ echo "================="
+ echo "No common text editor was found on this system."
+ echo "Please set the values in the following files manually:"
+ echo " - $pconf"
+ # --------- Delete for no Gnuastro ---------
+ echo " - $gconf"
+ # ------------------------------------------
+ echo "================="
echo
- else
- echo; echo "Couldn't create $pdir/LOCAL.mk"
+ ready=0
fi
+else
+ ready=1
+fi
+
+
+
+
+# --------- Delete for no Gnuastro ---------
+# From the input file, set the Gnuastro configuration file.
+mm=$(awk '$1=="MINMAPSIZE"{print $3}' $ptconf)
+add_top_notice $gconf
+echo "minmapsize $mm" >> $gconf
+# ------------------------------------------
+
+
+
+
+
+# Make the final file that will be used.
+add_top_notice $pconf
+cat $ptconf >> $pconf
+rm $ptconf
+
+
+
+
+
+# Print a final notice.
+echo
+if [ $ready = 1 ]; then
+ echo "This reproduction pipeline has been configured for this system."
+ echo "Please run the following command to start the pipeline:"
+else
+ echo "AFTER MANUALLY EDITING THE FILE(S) ABOVE, please run the following"
+ echo "commands to run the pipeline."
fi
+echo "(Replace '8' with the number of CPU threads available)"
+echo
+echo " make -j8"
+echo
+echo "To change the configuration later, please re-run './configure',"
+echo "DO NOT manually edit the relevant files."
+echo
diff --git a/reproduce/config/gnuastro/gnuastro.conf b/reproduce/config/gnuastro/gnuastro.conf
index 49f9906..a2a44cf 100644
--- a/reproduce/config/gnuastro/gnuastro.conf
+++ b/reproduce/config/gnuastro/gnuastro.conf
@@ -12,9 +12,10 @@
# pipeline is taken from the default Gnuastro configuration from its
# source (`bin/gnuastro.conf').
-# Reproduction pipeline
+# Reproduction pipeline (`./config' has to be before `lastconfig').
+ config .gnuastro/gnuastro-local.conf
+ # onlyversion X.X
lastconfig 1
-# onlyversion X.X
# Input:
hdu 1
@@ -30,7 +31,4 @@
interponlyblank 0
# Output:
- tableformat fits-binary
-
-# Operating mode
- minmapsize 1000000000 \ No newline at end of file
+ tableformat fits-binary \ No newline at end of file
diff --git a/reproduce/config/pipeline/LOCAL.mk.in b/reproduce/config/pipeline/LOCAL.mk.in
index 896df2f..ac8e10e 100644
--- a/reproduce/config/pipeline/LOCAL.mk.in
+++ b/reproduce/config/pipeline/LOCAL.mk.in
@@ -48,3 +48,23 @@ SURVEY = reproduce/SURVEY
# more easy: the contents of the build directory do not need to be backed
# up since they can be reproduced and they can be large.
BDIR = reproduce/BDIR
+
+
+
+
+
+# Memory mapping minimum size
+# ---------------------------
+#
+# Some programs (for example Gnuastro) can deal with cases where the local
+# system doesn't have enough memory (RAM) to keep large files there. For
+# example, they will create memory-mapped (`mmap' for short) files on the
+# HDD or SSD and read/write to them instead of RAM. This will ofcourse,
+# slow down the processing, but atleast the program won't crash.
+#
+# Since the memory requirements of different systems are different and it
+# has no effect on the software's final result, the minimum size of an
+# allocated array to warrant a mapping to HDD/SSD instead of RAM must also
+# be defined here. This value will be used in the programs that support
+# this feature.
+MINMAPSIZE = 1000000000
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index 3125399..7854c2f 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -129,7 +129,9 @@ reproduce/build: | $(BDIR)
# want it to be rebuilt every time.
.PHONY: all clean distclean clean-mmap $(mtexdir)/initialize.tex
distclean: clean; rm -f $(pconfdir)/LOCAL.mk
+# --------- Delete for no Gnuastro ---------
clean-mmap:; rm -f reproduce/config/gnuastro/mmap*
+# ------------------------------------------
clean: clean-mmap
ifeq ($(configure-run),yes)
rm -rf $(BDIR)
@@ -153,9 +155,11 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
@v=$$(git describe --dirty --always); \
echo "\newcommand{\pipelineversion}{$$v}" > $@
+# --------- Delete for no Gnuastro ---------
# Version of Gnuastro.
@v=$$(astnoisechisel --version | awk 'NR==1{print $$NF}'); \
echo "\newcommand{\gnuastroversion}{$$v}" >> $@
+# ------------------------------------------
# Location of the build directory (for LaTeX inputs).
@echo "\newcommand{\bdir}{$(BDIR)}" >> $@