Commit 7b8e31bb authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Remove the option of a dry run. Print the number of BHs read in on startup. Do...

Remove the option of a dry run. Print the number of BHs read in on startup. Do not print the number of seeds to create in the fof_dump_data() function.
parent 9d85205d
......@@ -138,7 +138,6 @@ int main(int argc, char *argv[]) {
if (myrank == 0) greetings();
int with_aff = 0;
int dry_run = 0;
int dump_tasks = 0;
int dump_threadpool = 0;
int with_fof = 1;
......@@ -164,12 +163,6 @@ int main(int argc, char *argv[]) {
OPT_GROUP(" Control options:\n"),
OPT_BOOLEAN('a', "pin", &with_aff,
"Pin runners using processor affinity.", NULL, 0, 0),
OPT_BOOLEAN('d', "dry-run", &dry_run,
"Dry run. Read the parameter file, allocates memory but does "
"not read the particles from ICs. Exits before the start of "
"time integration. Checks the validity of parameters and IC "
"files as well as memory limits.",
NULL, 0, 0),
OPT_BOOLEAN('e', "fpe", &with_fp_exceptions,
"Enable floating-point exceptions (debugging mode).", NULL, 0,
0),
......@@ -277,10 +270,6 @@ int main(int argc, char *argv[]) {
/* How vocal are we ? */
const int talking = (verbose == 1 && myrank == 0) || (verbose == 2);
if (myrank == 0 && dry_run)
message(
"Executing a dry run. No i/o or time integration will be performed.");
/* Report CPU frequency.*/
cpufreq = clocks_get_cpufreq();
if (myrank == 0) {
......@@ -446,7 +435,7 @@ int main(int argc, char *argv[]) {
/*with_hydro=*/1, /*with_grav=*/ 1,
/*with_stars=*/1, /*with_black_holes=*/1, cleanup_h, cleanup_sqrt_a,
cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL, nr_threads, dry_run);
MPI_INFO_NULL, nr_threads, /*dry_run=*/0);
#else
read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
&Ngas, &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs,
......@@ -454,7 +443,7 @@ int main(int argc, char *argv[]) {
/*with_stars=*/1, /*with_black_holes=*/1,
cleanup_h, cleanup_sqrt_a,
cosmo.h, cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL, nr_threads, dry_run);
MPI_INFO_NULL, nr_threads, /*dry_run=*/0);
#endif
#else
read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
......@@ -462,7 +451,7 @@ int main(int argc, char *argv[]) {
/*with_hydro=*/1, /*with_grav=*/ 1,
/*with_stars=*/1, /*with_black_holes=*/1,
cleanup_h, cleanup_sqrt_a,
cosmo.h, cosmo.a, nr_threads, dry_run);
cosmo.h, cosmo.a, nr_threads, /*dry_run=*/0);
#endif
#endif
if (myrank == 0) {
......@@ -474,9 +463,8 @@ int main(int argc, char *argv[]) {
#ifdef SWIFT_DEBUG_CHECKS
/* Check that the other links are correctly set */
if (!dry_run)
part_verify_links(parts, gparts, sparts, bparts, Ngas, Ngpart, Nspart,
Nbpart, 1);
part_verify_links(parts, gparts, sparts, bparts, Ngas, Ngpart, Nspart,
Nbpart, 1);
#endif
/* Get the total number of particles across all nodes. */
......@@ -491,19 +479,19 @@ int main(int argc, char *argv[]) {
N_total[2] = Nspart;
N_total[3] = Nbpart;
#endif
if (myrank == 0)
message(
"Read %lld gas particles, %lld stars particles and %lld gparts from "
"the ICs.",
N_total[0], N_total[2], N_total[1]);
"Read %lld gas particles, %lld stars particles, %lld black hole "
"particles and %lld gparts from the ICs.",
N_total[0], N_total[2], N_total[3], N_total[1]);
/* Initialize the space with these data. */
if (myrank == 0) clocks_gettime(&tic);
space_init(&s, params, &cosmo, dim, parts, gparts, sparts, bparts, Ngas,
Ngpart, Nspart, Nbpart, periodic, replicate, /*generate_gas_in_ics=*/0,
N_total[0] > 0, 1, /*with_star_formation=*/0, talking,
dry_run);
/*dry_run=*/0);
if (myrank == 0) {
clocks_gettime(&toc);
......@@ -553,14 +541,14 @@ int main(int argc, char *argv[]) {
}
/* Verify that each particle is in it's proper cell. */
if (talking && !dry_run) {
if (talking) {
int icount = 0;
space_map_cells_pre(&s, 0, &map_cellcheck, &icount);
message("map_cellcheck picked up %i parts.", icount);
}
/* Verify the maximal depth of cells. */
if (talking && !dry_run) {
if (talking) {
int data[2] = {s.maxdepth, 0};
space_map_cells_pre(&s, 0, &map_maxdepth, data);
message("nr of cells at depth %i is %i.", data[0], data[1]);
......@@ -596,11 +584,12 @@ int main(int argc, char *argv[]) {
/* Get some info to the user. */
if (myrank == 0) {
long long N_DM = N_total[1] - N_total[2] - N_total[0];
long long N_DM = N_total[1] - N_total[2] - N_total[3] - N_total[0];
message(
"Running on %lld gas particles, %lld stars particles and %lld DM "
"particles (%lld gravity particles)",
N_total[0], N_total[2], N_total[1] > 0 ? N_DM : 0, N_total[1]);
"Running on %lld gas particles, %lld stars particles %lld black "
"hole particles and %lld DM particles (%lld gravity particles)",
N_total[0], N_total[2], N_total[3], N_total[1] > 0 ? N_DM : 0,
N_total[1]);
message(
"from t=%.3e until t=%.3e with %d ranks, %d threads / rank and %d "
"task queues / rank (dt_min=%.3e, dt_max=%.3e)...",
......@@ -609,29 +598,6 @@ int main(int argc, char *argv[]) {
fflush(stdout);
}
/* Time to say good-bye if this was not a serious run. */
if (dry_run) {
#ifdef WITH_MPI
if ((res = MPI_Finalize()) != MPI_SUCCESS)
error("call to MPI_Finalize failed with error %i.", res);
#endif
if (myrank == 0)
message("Time integration ready to start. End of dry-run.");
engine_clean(&e);
free(params);
return 0;
}
/* Initialise the table of Ewald corrections for the gravity checks */
#ifdef SWIFT_GRAVITY_FORCE_CHECKS
if (s.periodic) gravity_exact_force_ewald_init(e.s->dim[0]);
#endif
/* Init the runner history. */
#ifdef HIST
for (k = 0; k < runner_hist_N; k++) runner_hist_bins[k] = 0;
#endif
#ifdef WITH_MPI
/* Split the space. */
engine_split(&e, &initial_partition);
......@@ -689,9 +655,9 @@ int main(int argc, char *argv[]) {
#endif // SWIFT_DEBUG_THREADPOOL
/* used parameters */
parser_write_params_to_file(params, "used_parameters.yml", 1);
parser_write_params_to_file(params, "fof_used_parameters.yml", 1);
/* unused parameters */
parser_write_params_to_file(params, "unused_parameters.yml", 0);
parser_write_params_to_file(params, "fof_unused_parameters.yml", 0);
/* Dump memory use report */
#ifdef SWIFT_MEMUSE_REPORTS
......
......@@ -5014,7 +5014,6 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
if (strlen(e->run_name) == 0) {
error("The run name in the parameter file cannot be an empty string.");
}
if (e->nodeID == 0) message("Running simulation '%s'.", e->run_name);
/* Setup the timestep if non-cosmological */
if (!(e->policy & engine_policy_cosmology)) {
......@@ -5120,6 +5119,9 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
e->run_fof = 0;
engine_rank = nodeID;
/* Welcome message */
if (e->nodeID == 0) message("Running simulation '%s'.", e->run_name);
/* Get the number of queues */
int nr_queues =
parser_get_opt_param_int(params, "Scheduler:nr_queues", nr_threads);
......
......@@ -1926,8 +1926,6 @@ void fof_dump_group_data(const struct fof_props *props,
"#-------------------------------------------------------------------"
"-------------\n");
int bh_seed_count = 0;
for (int i = 0; i < num_groups; i++) {
const size_t group_offset = group_sizes[i].index;
......@@ -1945,8 +1943,6 @@ void fof_dump_group_data(const struct fof_props *props,
group_mass[i], max_part_density[i], max_part_density_index[i],
part_id);
#endif
if (max_part_density_index[i] >= 0) bh_seed_count++;
}
/* Dump the extra black hole seeds. */
......@@ -1956,23 +1952,8 @@ void fof_dump_group_data(const struct fof_props *props,
: -1;
fprintf(file, " %8zu %12zu %12e %12e %18lld %18lld\n", 0UL, 0UL, 0., 0.,
0LL, part_id);
if (max_part_density_index[i] >= 0) bh_seed_count++;
}
int total_bh_seed_count = 0;
#ifdef WITH_MPI
/* Sum the total number of black holes over each MPI rank. */
MPI_Reduce(&bh_seed_count, &total_bh_seed_count, 1, MPI_INT, MPI_SUM, 0,
MPI_COMM_WORLD);
#else
total_bh_seed_count = bh_seed_count;
#endif
if (engine_rank == 0)
message("Seeding %d black hole(s).", total_bh_seed_count);
fclose(file);
}
......
......@@ -637,8 +637,6 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
N[ptype] = (mpi_rank + 1) * N_total[ptype] / mpi_size - offset[ptype];
}
N[5] = 0;
/* Allocate memory to store SPH particles */
if (with_hydro) {
*Ngas = N[0];
......
......@@ -459,8 +459,6 @@ void read_ic_single(const char* fileName,
for (int ptype = 0; ptype < swift_type_count; ++ptype)
N[ptype] = (numParticles[ptype]) + (numParticles_highWord[ptype] << 32);
N[5] = 0;
/* Get the box size if not cubic */
dim[0] = boxSize[0];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment