gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d321e9f2: Book: -O3 in commands to build manda


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d321e9f2: Book: -O3 in commands to build mandatory dependencies
Date: Thu, 13 Oct 2022 07:22:42 -0400 (EDT)

branch: master
commit d321e9f24622f4ebb23d7cddf38bb6dfd807d16b
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Book: -O3 in commands to build mandatory dependencies
    
    Until now, the example commands to build the mandatory dependecies in the
    book didn't have the '-g0 -O3' flags for the CFLAGS variable. With these,
    the compiler doesn't include debugging flags and also uses its most
    comprehensive optimization algorithms.
    
    With this commit, these two flags have been added to CFLAGS in the example
    command. I also found two other minor points in other parts of the Gnuastro
    that have been fixed here:
    
     - The radial profile script's output of '--help' didn't say that
       '--oversample' requires an argument.
    
     - In Warp's 'ui.c', we were first checking the non-existance of '--cdelt',
       then using 'else' for its existence. This makes the code hard to read
       (since the logic is inverse!). With this commit, we now check
       'if(wa->cdelt)' and go into the steps if it is given, then use 'else'
       for situations that it wasn't given.
---
 bin/script/radial-profile.in |  2 +-
 bin/warp/ui.c                | 39 ++++++++++++++++++++-------------------
 doc/gnuastro.texi            |  7 ++++---
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index c4996151..21f3efe2 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -117,7 +117,7 @@ $scriptname options:
   -t, --tmpdir            Directory to keep temporary files.
   -k, --keeptmp           Keep temporal/auxiliar files.
   -m, --measure=STR       Measurement operator (mean, sigclip-mean, etc.).
-  -v, --oversample        Oversample for higher resolution radial profile.
+  -v, --oversample=INT    Oversample for higher resolution radial profile.
   -u, --undersample=INT   Undersample for lower resolution radial profile.
   -i, --instd=FLT/STR     Sky standard deviation per pixel, as a single number
                           or as the filename.
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 319b68aa..6d958e97 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -401,25 +401,8 @@ ui_check_wcsalign_cdelt(struct warpparams *p)
   double *tmp=NULL, *cdelt=NULL;
   gal_warp_wcsalign_t *wa=&p->wa;
 
-  /* '--cdelt' isn't given. */
-  if(!wa->cdelt)
-    {
-      /* CDELT is not given, try to deduce from WCS */
-      cdelt=gal_wcs_pixel_scale(p->input->wcs);
-      if(!cdelt)
-        error(EXIT_FAILURE, 0, "%s (hdu %s): the pixel scale couldn't "
-              "be deduced from the WCS.", p->inputname, p->cp.hdu);
-
-      /* Set CDELT to the maximum value of the dimensions. */
-      cdelt[0] = ( cdelt[0] > cdelt[1] ? cdelt[0] : cdelt[1] );
-      cdelt[1] = cdelt[0];
-      wa->cdelt=gal_data_alloc(cdelt, GAL_TYPE_FLOAT64, 1, &two, NULL, 0,
-                               p->cp.minmapsize, p->cp.quietmmap, NULL, NULL,
-                               NULL);
-    }
-
-  /* --cdelt is given. */
-  else
+  /* '--cdelt' is given. */
+  if(wa->cdelt)
     {
       /* CDELT is given, make sure there are no more than two values */
       if(wa->cdelt->size > 2)
@@ -454,6 +437,24 @@ ui_check_wcsalign_cdelt(struct warpparams *p)
                     cdelt[i], cdelt[i]);
         }
     }
+
+  /* '--cdelt' not given. */
+  else
+    {
+      /* CDELT is not given, try to deduce from WCS */
+      cdelt=gal_wcs_pixel_scale(p->input->wcs);
+      if(!cdelt)
+        error(EXIT_FAILURE, 0, "%s (hdu %s): the pixel scale couldn't "
+              "be deduced from the WCS.", p->inputname, p->cp.hdu);
+
+      /* Set CDELT to the maximum value of the dimensions. */
+      cdelt[0] = ( cdelt[0] > cdelt[1] ? cdelt[0] : cdelt[1] );
+      cdelt[1] = cdelt[0];
+      wa->cdelt=gal_data_alloc(cdelt, GAL_TYPE_FLOAT64, 1, &two, NULL, 0,
+                               p->cp.minmapsize, p->cp.quietmmap, NULL, NULL,
+                               NULL);
+    }
+
 }
 
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 4ecc9540..62b19df8 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -7634,7 +7634,7 @@ To install GSL from source, you can run the following 
commands after you have do
 @example
 $ tar xf gsl-latest.tar.gz
 $ cd gsl-X.X                     # Replace X.X with version number.
-$ ./configure
+$ ./configure CFLAGS="$CFLAGS -g0 -O3"
 $ make -j8                       # Replace 8 with no. CPU threads.
 $ make check
 $ sudo make install
@@ -7676,7 +7676,8 @@ Let's assume you have downloaded 
@url{http://heasarc.gsfc.nasa.gov/FTP/software/
 @example
 $ tar xf cfitsio_latest.tar.gz
 $ cd cfitsio-X.XX                   # Replace X.XX with version
-$ ./configure --prefix=/usr/local --enable-sse2 --enable-reentrant
+$ ./configure --prefix=/usr/local --enable-sse2 --enable-reentrant \
+              CFLAGS="$CFLAGS -g0 -O3"
 $ make
 $ make utils
 $ ./testprog > testprog.lis         # See below if this has an error
@@ -7736,7 +7737,7 @@ $ cd wcslib-X.X
 
 ## If `./configure' fails, remove `-lcurl' and run again.
 $ ./configure LIBS="-pthread -lcurl -lm" --without-pgplot     \
-              --disable-fortran
+              --disable-fortran CFLAGS="$CFLAGS -g0 -O3"
 $ make
 $ make check
 $ sudo make install



reply via email to

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