diff options
author | Thomas Radke <tradke@damiana.damiana.admin> | 2008-09-09 13:35:37 +0200 |
---|---|---|
committer | Thomas Radke <tradke@damiana.damiana.admin> | 2008-09-09 13:35:37 +0200 |
commit | d119b91fc32e1991eecc207468e7c719275281ad (patch) | |
tree | eaa95a56434619b41b9a151a146d36f4d594a55f /Carpet | |
parent | c58657e1560aab8c581ac6c5491dab085eee3a62 (diff) |
Turn the stand-alone WaveToy example application into a LoopControl routine
(scheduled at STARTUP) which can be triggered via LoopControl::run_demo = "yes"
and controled with LoopControl::n{xyz} and LoopControl:nsteps.
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/LoopControl/par/WaveToy_LoopControl.par | 6 | ||||
-rw-r--r-- | Carpet/LoopControl/param.ccl | 29 | ||||
-rw-r--r-- | Carpet/LoopControl/schedule.ccl | 8 | ||||
-rw-r--r-- | Carpet/LoopControl/src/make.code.defn | 2 | ||||
-rw-r--r-- | Carpet/LoopControl/src/wavetoy-loopcontrol.c | 37 |
5 files changed, 74 insertions, 8 deletions
diff --git a/Carpet/LoopControl/par/WaveToy_LoopControl.par b/Carpet/LoopControl/par/WaveToy_LoopControl.par new file mode 100644 index 000000000..81fe68df6 --- /dev/null +++ b/Carpet/LoopControl/par/WaveToy_LoopControl.par @@ -0,0 +1,6 @@ +ActiveThorns = "LoopControl GSL" + +LoopControl::run_demo = yes +LoopControl::nx = 300 +LoopControl::ny = 300 +LoopControl::nz = 300 diff --git a/Carpet/LoopControl/param.ccl b/Carpet/LoopControl/param.ccl index 5875c8dcc..5cd9727d0 100644 --- a/Carpet/LoopControl/param.ccl +++ b/Carpet/LoopControl/param.ccl @@ -1,5 +1,6 @@ # Parameter definitions for thorn LoopControl +################# # General options BOOLEAN printstats "Output timing statistics at shutdown" STEERABLE=recover @@ -14,8 +15,31 @@ BOOLEAN debug "Output debug information" STEERABLE=always { } "no" +###################################### +# LoopControl demonstration parameters +BOOLEAN run_demo "Run the embedded wavetoy as a LoopControl demo application" +{ +} "no" + +CCTK_INT nx "Number of grid points in X dimension (for the embedded wavetoy example)" +{ + 1:* :: "a positive integer" +} 100 +CCTK_INT ny "Number of grid points in Y dimension (for the embedded wavetoy example)" +{ + 1:* :: "a positive integer" +} 100 +CCTK_INT nz "Number of grid points in Z dimension (for the embedded wavetoy example)" +{ + 1:* :: "a positive integer" +} 100 +CCTK_INT nsteps "Number of time steps (for the embedded wavetoy example)" +{ + 1:* :: "a positive integer" +} 100 +################# # Thread topology CCTK_INT lc_inthreads "Number of threads in the i-direction" STEERABLE=recover @@ -38,6 +62,7 @@ CCTK_INT lc_knthreads "Number of threads in the k-direction" STEERABLE=recover +###################### # Tiling specification CCTK_INT lc_inpoints "Number of grid points in the i-direction" STEERABLE=recover @@ -60,6 +85,7 @@ CCTK_INT lc_knpoints "Number of grid points in the k-direction" STEERABLE=recove +########################## # Use legacy configuration BOOLEAN legacy_init "Initialise with legacy configuration (usually slower)" STEERABLE=recover @@ -68,6 +94,7 @@ BOOLEAN legacy_init "Initialise with legacy configuration (usually slower)" STEE +########################### # Automatic: simple cycling BOOLEAN cycle_j_tilings "Cycle through all available tilings in the j-direction" STEERABLE=recover @@ -76,6 +103,7 @@ BOOLEAN cycle_j_tilings "Cycle through all available tilings in the j-direction" +################################ # Automatic: simulated annealing BOOLEAN use_simulated_annealing "Find a good loop configuration through simulated annealing" STEERABLE=recover @@ -119,6 +147,7 @@ CCTK_REAL siman_T_min "stopping criterion" STEERABLE=recover +######################################### # Automatic: random restart hill climbing BOOLEAN use_random_restart_hill_climbing "http://en.wikipedia.org/wiki/Hill_climbing http://en.wikipedia.org/wiki/Tabu_search" STEERABLE=always diff --git a/Carpet/LoopControl/schedule.ccl b/Carpet/LoopControl/schedule.ccl index fc14c7b0d..1a7c28d10 100644 --- a/Carpet/LoopControl/schedule.ccl +++ b/Carpet/LoopControl/schedule.ccl @@ -6,3 +6,11 @@ if (printstats) { LANG: C } "Output loop control statistics" } + +if (run_demo) +{ + SCHEDULE lc_demo AT startup + { + LANG:C + } "Run embedded wavetoy as a LoopControl demo application" +} diff --git a/Carpet/LoopControl/src/make.code.defn b/Carpet/LoopControl/src/make.code.defn index 426f7ee52..961ce4edd 100644 --- a/Carpet/LoopControl/src/make.code.defn +++ b/Carpet/LoopControl/src/make.code.defn @@ -1,7 +1,7 @@ # Main make.code.defn file for thorn LoopControl # Source files in this directory -SRCS = loopcontrol.c loopcontrol.F90 loopcontrol_types.F90 lc_auto.c lc_siman.c lc_hill.c +SRCS = loopcontrol.c loopcontrol.F90 loopcontrol_types.F90 lc_auto.c lc_siman.c lc_hill.c wavetoy-loopcontrol.c # Subdirectories containing source files SUBDIRS = diff --git a/Carpet/LoopControl/src/wavetoy-loopcontrol.c b/Carpet/LoopControl/src/wavetoy-loopcontrol.c index 5082d7414..cc8e8ce8a 100644 --- a/Carpet/LoopControl/src/wavetoy-loopcontrol.c +++ b/Carpet/LoopControl/src/wavetoy-loopcontrol.c @@ -37,15 +37,21 @@ #include "loopcontrol.h" +/*** + define this if you want to build a standalone demo + (but beware of hidden LoopControl dependencies on Cactus) +#define BUILD_STANDALONE + ***/ -int NI; -int NJ; -int NK; +static int NI; +static int NJ; +static int NK; -int NSTEPS; +static int NSTEPS; +#ifdef BUILD_STANDALONE static int getint (char const * restrict const string) @@ -62,6 +68,11 @@ getint (char const * restrict const string) } return n; } +#else + +#include "cctk_Parameters.h" + +#endif @@ -74,10 +85,16 @@ ind3d (int const i, int const j, int const k) -int -main (int argc, char **argv) +#ifdef BUILD_STANDALONE +int main (int argc, char **argv) +{ +#else +int lc_demo (void) { + DECLARE_CCTK_PARAMETERS +#endif printf ("WaveToy\n"); +#if 0 if (argc != 5) { fprintf (stderr, "Synopsis:\n" @@ -91,6 +108,12 @@ main (int argc, char **argv) NJ = getint (argv[2]); NK = getint (argv[3]); NSTEPS = getint (argv[4]); +#else + NI = nx; + NJ = ny; + NK = nz; + NSTEPS = nsteps; +#endif printf (" NI=%d NJ=%d NK=%d\n", NI, NJ, NK); printf (" NSTEPS=%d\n", NSTEPS); @@ -202,7 +225,7 @@ main (int argc, char **argv) printf ("Analysis time: %g\n", time_analysis_end - time_analysis_start); printf ("Result: %.15g\n", avg); - lc_printstats(); + lc_printstats(0); // // Shutdown |