[Developers] CactusDefaultEvolve.c cleanup

Steve White steve.white at aei.mpg.de
Fri Dec 23 08:43:50 CST 2005


Greetings,

I had some difficulty following the code in CactusDefaultEvolve.c, due to
	1) a global variable, cactus_terminate, which is checked but
	   never set except in commented-out code, and
	2) a lot of other commented-out code.

This patch only removes code that is never used, and is intended to 
make the remaining code easier to follow and potentially safer.

I checked all arrangements available to me, including Carpet, for
cactus_terminate.  It appears only in 
	CactusPUGH/PUGH/src/Evolve.c  (where it is commented out)
	AlphaThorns/Spawner/src/Evolve.c

The attached patch removes 

	* live but useless code that references cactus_terminate
	* commented-out TerminationStepper function
	* commented-out code for cactus_terminate_global
	* now-unused TERMINATION_RAISED_BRDCAST
	* numerous commented out CCTK*Timer code

I checked to see that it compiles, and is a patch against the most
recent checkout.  Since I'm confident it only removes unused code, I
did no further testing.

-- 
Steve White : Programmer
Max-Planck-Institut für Gravitationsphysik      Albert-Einstein-Institut
Am Mühlenberg 1, D-14476 Golm, Germany                  +49-331-567-7625

Index: CactusDefaultEvolve.c
===================================================================
RCS file: /cactusdevcvs/Cactus/src/main/CactusDefaultEvolve.c,v
retrieving revision 1.59
diff -u -r1.59 CactusDefaultEvolve.c
--- CactusDefaultEvolve.c	16 Jul 2003 21:50:55 -0000	1.59
+++ CactusDefaultEvolve.c	23 Dec 2005 14:25:49 -0000
@@ -35,8 +35,6 @@
 
 /* Define some macros for convenience. */
 
-#define TERMINATION_RAISED_BRDCAST 4
-
 #define ForallConvLevels(iteration, conv_level)                               \
         {                                                                     \
           int factor = 1;                                                     \
@@ -51,17 +49,6 @@
           }                                                                   \
         }
 
-int cactus_terminate;
-
-
-/********************************************************************
- *********************     Local Data   *****************************
- ********************************************************************/
-
-#if 0
-static int cactus_terminate_global = 0;
-#endif
-
 /********************************************************************
  ********************* Local Routine Prototypes *********************
  ********************************************************************/
@@ -112,11 +99,6 @@
   int var;
   unsigned int convergence_level, iteration;
 
-
-#if 0
-  CactusStartTimer (config->timer[OUTPUT]);
-#endif
-
   /*** Call OUTPUT for this GH (this routine    ***/
   /*** checks if output is necessary) and makes ***/
   /*** a Traverse with CCTK_ANALYSIS      ***/
@@ -128,11 +110,6 @@
   }
   EndForallConvLevels;
 
-#if 0
-  CactusStopTimer (config->timer[OUTPUT]);
-  CactusStartTimer (config->timer[EVOLUTION]);
-#endif
-
   while (! DoneMainLoop (config->GH[0], config->GH[0]->cctk_time, iteration))
   {
     if (iteration == 0)
@@ -170,10 +147,6 @@
     }
     EndForallConvLevels;
 
-    /* Output perhaps */
-#if 0
-    CactusStartTimer (config->timer[OUTPUT]);
-#endif
     /*** Call OUTPUT for this GH (this routine    ***/
     /*** checks if output is necessary) and makes ***/
     /*** an Traverse with CCTK_ANALYSIS      ***/
@@ -184,27 +157,8 @@
     }
     EndForallConvLevels;
 
-#if 0
-    CactusStopTimer (config->timer[OUTPUT]);
-#endif
-
-#if 0
-    ConvergenceReport (config->GH, iteration);
-    TerminationStepper (config->GH[0]);
-#endif
-
-    /* Termination has been raised and broadcasted, exit loop*/
-    if (cactus_terminate == TERMINATION_RAISED_BRDCAST)
-    {
-      break;
-    }
-
   } /*** END OF MAIN ITERATION LOOP ***/
 
-#if 0
-  CactusStopTimer (config->timer[EVOLUTION]);
-#endif
-
   return (0);
 }
 
@@ -352,40 +306,3 @@
   CCTK_Traverse (GH, "CCTK_POSTSTEP");
 }
 
-
-#if 0
- /*@@
-   @routine    TerminationStepper
-   @date       Fri Aug 14 13:07:11 1998
-   @author     Gerd Lanfermann
-   @desc
-               catctus_terminate is a global variable with these values:
-               TERMINATION_NOT_RAISED    : not signaled yet (cactus_initial.c)
-               TERMINATION_RAISED_LOCAL  : signaled on one PE, not reduced
-                                           (MPI_LOR) to all PEs yet (main.c)
-               TERMINATION_RAISED_BRDCAST: reduced -> can now be used to
-                                           terminate (chkpnt_terminate.c)
-                                           by the scheduler
-               the raised termiantion signal is caught on 1 PE only and has to
-               be recduced on all PEs before a termination sequenced can be
-               launched (I like that)
-   @enddesc
-   @calls      CCTK_Traverse
-@@*/
-static void TerminationStepper (cGH *GH)
-{
-  cactus_terminate_global = cactus_terminate;
-
-#ifdef CCTK_MPI
-  MPI_Allreduce (&cactus_terminate, &cactus_terminate_global, 1, MPI_INT,
-                 MPI_LOR, MPI_COMM_WORLD);
-#endif
-  if (cactus_terminate_global)
-  {
-    cactus_terminate = TERMINATION_RAISED_BRDCAST;
-    printf ("RECEIVED GLOBAL TERMINATION SIGNAL\n");
-  }
-
-  CCTK_Traverse (GH, "CCTK_TERMINATE");
-}
-#endif


--- StripMime Report -- processed MIME parts ---
multipart/mixed
  text/plain (text body -- kept)
  text/plain (text body -- kept)
---



More information about the Developers mailing list