gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master cd3304e2: MakeProfiles: Num. used threads prin


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master cd3304e2: MakeProfiles: Num. used threads printed if fewer profs than threads
Date: Mon, 16 Sep 2024 12:51:50 -0400 (EDT)

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

    MakeProfiles: Num. used threads printed if fewer profs than threads
    
    Until now, MakeProfiles would always print the maximum number of available
    threads in the system, even if it didn't use them. This could cause
    confusion for advanced users who check their performance when the number of
    input profiles was less than the total number of threads. Because
    MakeProfiles builds one profile at each moment with each thread, in such
    cases, it wouldn't use the full number of threads that were printed.
    
    With this commit, the problem was solved by printing some extra
    information. Also, when the total number of threads is more than the number
    of profiles, it reminds the user that one thread is used for each profile.
    
    This task was suggested by Carlos Marrero de La Rosa.
---
 THANKS                       |  1 +
 bin/mkprof/ui.c              | 31 ++++++++++++++++++++++---------
 doc/announce-acknowledge.txt |  1 +
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/THANKS b/THANKS
index bfcce45c..c4d52ae8 100644
--- a/THANKS
+++ b/THANKS
@@ -44,6 +44,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
first name).
     Bruno Haible                         bruno@clisp.org
     Carlos Allende Prieto                callende@iac.es
     Carlos Morales Socorro               cmorsoc@gmail.com
+    Carlos Marrero de La Rosa            carlos.marrero@iac.es
     Christopher Willmer                  cnaw@as.arizona.edu
     Clotilde Laigle                      laigle@iap.fr
     Colin Orion Chandler                 coc123@uw.edu
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 56a0658c..44a8042f 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -2069,15 +2069,16 @@ static void
 ui_print_intro(struct mkprofparams *p)
 {
   char *jobname;
+  size_t nt=p->cp.numthreads;
 
-  if(p->cp.quiet) return;
-
+  /* Program name and version as well as starting time. */
   printf(PROGRAM_NAME" "PACKAGE_VERSION" started on %s",
          ctime(&p->rawtime));
 
+  /* Information about profiles to be built */
   if(p->kernel)
     {
-      if( asprintf(&jobname, "Building one %s kernel",
+      if( asprintf(&jobname, "Building one %s kernel profile",
                    ui_profile_name_write(p->kernel->status))<0 )
         error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
     }
@@ -2090,6 +2091,7 @@ ui_print_intro(struct mkprofparams *p)
   gal_timing_report(NULL, jobname, 1);
   free(jobname);
 
+  /* Name of background image. */
   if(p->backname)
     {
       if(p->nomerged)
@@ -2108,24 +2110,35 @@ ui_print_intro(struct mkprofparams *p)
       free(jobname);
     }
 
+  /* RNG type info. */
   if( asprintf(&jobname, "Random number generator (RNG) type: %s",
                gsl_rng_name(p->rng))<0 )
     error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
   gal_timing_report(NULL, jobname, 1);
   free(jobname);
 
-  if( asprintf(&jobname, "Basic RNG seed: %lu", p->rng_seed)<0 )
+  /* RNG seed info */
+  if( asprintf(&jobname, "RNG seed: %lu", p->rng_seed)<0 )
     error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
   gal_timing_report(NULL, jobname, 1);
   free(jobname);
 
-  if(p->kernel==NULL)
+  /* If a catalog was given (not called with '--kernel': which is always
+     only a single profile), report the the number of threads. */
+  if(p->num>nt)
     {
-      if( asprintf(&jobname, "Using %zu threads.", p->cp.numthreads)<0 )
+      if( asprintf(&jobname, "Using %zu threads (multiple profiles "
+                   "assigned to each thread)", nt) < 0 )
+        error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
+    }
+  else
+    {
+      if( asprintf(&jobname, "Using %zu of %zu threads "
+                   "(one thread per profile)", p->num, nt) < 0 )
         error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
-      gal_timing_report(NULL, jobname, 1);
-      free(jobname);
     }
+  gal_timing_report(NULL, jobname, 1);
+  free(jobname);
 }
 
 
@@ -2188,7 +2201,7 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
mkprofparams *p)
 
 
   /* Print introductory information. */
-  ui_print_intro(p);
+  if(p->cp.quiet==0) ui_print_intro(p);
 }
 
 
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 613182ca..e52ee67e 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -3,6 +3,7 @@ Alphabetically ordered list to acknowledge in the next release.
 Alejandro Camazón Pinilla
 Alejandro Lumbreras-Calle
 Antonio Diaz Diaz
+Carlos Marrero de La Rosa
 Hok Kan (Ronald) Tsang
 Phil Wyett
 Ole Streicher



reply via email to

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