diff --git a/examples/main.c b/examples/main.c index 4c62bea2e8beb8d41a0a2e7267bb844317c50aed..811b2d94697e0e28569a8a27204bbdcc1ff3e472 100644 --- a/examples/main.c +++ b/examples/main.c @@ -104,6 +104,7 @@ void print_help_message() { printf(" %2s %14s %s\n", "-v", "[12]", "Increase the level of verbosity:"); printf(" %2s %14s %s\n", "", "", "1: MPI-rank 0 writes,"); printf(" %2s %14s %s\n", "", "", "2: All MPI-ranks write."); + printf(" %2s %14s %s\n", "-x", "", "Run with structure finding."); printf(" %2s %14s %s\n", "-y", "{int}", "Time-step frequency at which task graphs are dumped."); printf(" %2s %14s %s\n", "-Y", "{int}", @@ -192,6 +193,7 @@ int main(int argc, char *argv[]) { int with_fp_exceptions = 0; int with_drift_all = 0; int with_mpole_reconstruction = 0; + int with_structure_finding = 0; int verbose = 0; int nr_threads = 1; int with_verbose_timers = 0; @@ -203,7 +205,7 @@ int main(int argc, char *argv[]) { /* Parse the parameters */ int c; - while ((c = getopt(argc, argv, "acCdDef:FgGhMn:P:rsSt:Tv:y:Y:")) != -1) + while ((c = getopt(argc, argv, "acCdDef:FgGhMn:P:rsSt:Tv:xy:Y:")) != -1) switch (c) { case 'a': #if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA) @@ -291,6 +293,9 @@ int main(int argc, char *argv[]) { return 1; } break; + case 'x': + with_structure_finding = 1; + break; case 'y': if (sscanf(optarg, "%d", &dump_tasks) != 1) { if (myrank == 0) printf("Error parsing dump_tasks (-y). \n"); @@ -772,6 +777,7 @@ int main(int argc, char *argv[]) { if (with_cooling) engine_policies |= engine_policy_cooling; if (with_sourceterms) engine_policies |= engine_policy_sourceterms; if (with_stars) engine_policies |= engine_policy_stars; + if (with_structure_finding) engine_policies |= engine_policy_structure_finding; /* Initialize the engine with the space and policies. */ if (myrank == 0) clocks_gettime(&tic); @@ -844,7 +850,7 @@ int main(int argc, char *argv[]) { engine_print_stats(&e); /* Call VELOCIraptor before first step. */ - invoke_velociraptor(&e); + if(with_structure_finding) invoke_velociraptor(&e); } /* Legend */ diff --git a/src/engine.c b/src/engine.c index 074592171108baba8919891db60d5ae70d181495..e39d8ccb805fe3b703e579692a15a9bbc0714153 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4515,7 +4515,7 @@ void engine_step(struct engine *e) { } /* Invoke VELOCIraptor every 250 timesteps thereafter. */ - if (e->step%250 == 0) invoke_velociraptor(e); + if ((e->policy & engine_policy_structure_finding) && e->step%250 == 0) invoke_velociraptor(e); /* Now apply all the collected time step updates and particle counts. */ collectgroup1_apply(&e->collect_group1, e); @@ -5337,7 +5337,7 @@ void engine_config(int restart, struct engine *e, engine_rank = nodeID; /* Initialise VELOCIraptor. */ - init_velociraptor(e); + if (e->policy & engine_policy_structure_finding) init_velociraptor(e); /* Get the number of queues */ int nr_queues = diff --git a/src/engine.h b/src/engine.h index 0fa8ca93b84760d0d92d9494f6e8e6224e3d1d9a..e95a2c950e19af268d004d66977b7f65341a69bf 100644 --- a/src/engine.h +++ b/src/engine.h @@ -69,7 +69,8 @@ enum engine_policy { engine_policy_reconstruct_mpoles = (1 << 12), engine_policy_cooling = (1 << 13), engine_policy_sourceterms = (1 << 14), - engine_policy_stars = (1 << 15) + engine_policy_stars = (1 << 15), + engine_policy_structure_finding = (1 << 16) }; #define engine_maxpolicy 15 extern const char *engine_policy_names[];