diff --git a/README b/README index ee7abd5a5709c81ecef1a89c1a651a925ce2f4a9..8d722a66da5083889e0adfb5af51206509bef53d 100644 --- a/README +++ b/README @@ -71,6 +71,8 @@ Parameters: from all ranks. -y, --task-dumps=<int> Time-step frequency at which task analysis files and/or tasks are dumped. + --cell-dumps=<int> Time-step frequency at which cell graphs + are dumped. -Y, --threadpool-dumps=<int> Time-step frequency at which threadpool tasks are dumped. diff --git a/README.md b/README.md index efffc9b4c43ff8f0821c4d7d49721ff7ff5949d0..f91b03d3f6a9656e33adc3216a15ed41e7b971de 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ Parameters: from all ranks. -y, --task-dumps=<int> Time-step frequency at which task analysis files and/or tasks are dumped. + --cell-dumps=<int> Time-step frequency at which cell graphs + are dumped. -Y, --threadpool-dumps=<int> Time-step frequency at which threadpool tasks are dumped. diff --git a/doc/RTD/source/AnalysisTools/index.rst b/doc/RTD/source/AnalysisTools/index.rst index f7f2f979666270ce371b532b6eab7bad3a23c9bd..8b4467f5f36a5e07f0b5446f4f590b2643990731 100644 --- a/doc/RTD/source/AnalysisTools/index.rst +++ b/doc/RTD/source/AnalysisTools/index.rst @@ -21,11 +21,13 @@ Cell graph ---------- An interactive graph of the cells is available with the configuration option ``--enable-cell-graph``. -During a run, SWIFT will generate a ``cell_hierarchy_*.csv`` file per MPI rank. -The command ``tools/make_cell_hierarchy.sh cell_hierarchy_*.csv`` merges the files together and generates the file ``cell_hierarchy.html`` +During a run, SWIFT will generate a ``cell_hierarchy_*.csv`` file per MPI rank at the frequency given by the parameter ``--cell-dumps=n``. +The command ``tools/make_cell_hierarchy.sh cell_hierarchy_0000_*.csv`` merges the files at time step 0 together and generates the file ``cell_hierarchy.html`` that contains the graph and can be read with your favorite web browser. -With chrome, you cannot access the files directly, you will need to either access them through an existing server (e.g. public http provided by your university) +With most web browsers, you cannot access the files directly. +If it is the case, the cells will never appear (but everything else should be fine). +To solve this problem, you will need to either access them through an existing server (e.g. public http provided by your university) or install ``npm`` and then run the following commands .. code-block:: bash @@ -34,6 +36,14 @@ or install ``npm`` and then run the following commands http-server . Now you can open the web page ``http://localhost:8080/cell_hierarchy.html``. +When running a large simulation, the data loading may take a while (a few seconds for EAGLE_6). +Your browser should not be hanging, but will seems to be idle. + +If you wish to add some information to the graph, you can do it by modifying the files ``src/space.c`` and ``tools/data/cell_hierarchy.html``. +In the first one, you will need to modify the calls to ``fprintf`` in the functions ``space_write_cell_hierarchy`` and ``space_write_cell``. +Here the code is simply writing CSV files containing all the required information about the cells. +In the second one, you will need to find the function ``mouseover`` and add the field that you have created. +You can also increase the size of the bubble through the style parameter ``height``. Memory usage reports -------------------- diff --git a/doc/RTD/source/CommandLineOptions/index.rst b/doc/RTD/source/CommandLineOptions/index.rst index 1144477548062bb61e47a88d3a1ee062b89b97cf..5251b36f7394465c59577932155544a755c0ee43 100644 --- a/doc/RTD/source/CommandLineOptions/index.rst +++ b/doc/RTD/source/CommandLineOptions/index.rst @@ -11,7 +11,10 @@ For instance, just running the ``swift`` binary will not use any SPH or gravity; the particles will just sit still! Below is a list of the command line options and when they should be used. The same list -can be found by typing ``./swift -h``:: +can be found by typing ``./swift -h``: + +.. code-block:: none + -h, --help show this help message and exit @@ -65,5 +68,7 @@ can be found by typing ``./swift -h``:: from all ranks. -y, --task-dumps=<int> Time-step frequency at which task analysis files and/or tasks are dumped. + --cell-dumps=<int> Time-step frequency at which cell graphs + are dumped. -Y, --threadpool-dumps=<int> Time-step frequency at which threadpool tasks are dumped. diff --git a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml index 93c8c740f58efb23a017a7d229f81a685e837b1a..bb7c935ffa7538883eccbf3e2c58f5e99b30d97e 100644 --- a/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_ICs/EAGLE_12/eagle_12.yml @@ -53,6 +53,11 @@ SPH: minimal_temperature: 100.0 # (internal units) initial_temperature: 268.7 +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml index d5307533c0ffccae7644f06dbe33c27bf46f4114..5131dad836b7b86e89d6b44f85a958430a969ec8 100644 --- a/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_ICs/EAGLE_25/eagle_25.yml @@ -53,6 +53,11 @@ SPH: minimal_temperature: 100.0 # (internal units) initial_temperature: 268.7 +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml index f757dc9dcf104237c6ecc5e472d29f79375a1d53..7e16740866dbae53d43aef59e59c0f9424a760f0 100644 --- a/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_ICs/EAGLE_50/eagle_50.yml @@ -53,6 +53,11 @@ SPH: minimal_temperature: 100.0 # (internal units) initial_temperature: 268.7 +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_low_z/EAGLE_100/eagle_100.yml b/examples/EAGLE_low_z/EAGLE_100/eagle_100.yml index f77036b5d55f33b4fd3f42c7bea0ccc124003a40..51ebde355c064103344f5ed7a07699d0d23b2394 100644 --- a/examples/EAGLE_low_z/EAGLE_100/eagle_100.yml +++ b/examples/EAGLE_low_z/EAGLE_100/eagle_100.yml @@ -58,6 +58,11 @@ SPH: CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. minimal_temperature: 100 # (internal units) +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters related to the initial conditions InitialConditions: file_name: ./EAGLE_ICs_100.hdf5 # The file to read diff --git a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml index f470c691a5a76207998f6d854f6e8d44f0a1aebb..4649dc372d39855161c3cb0aeb09a7a964255d5c 100644 --- a/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml +++ b/examples/EAGLE_low_z/EAGLE_12/eagle_12.yml @@ -59,6 +59,11 @@ SPH: CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. minimal_temperature: 100 # (internal units) +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml index 07685bf783b34b2872df4a32610fa791db01cded..cd2b4f06b3fc3723af480bd88d854f3d39d3eb12 100644 --- a/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml +++ b/examples/EAGLE_low_z/EAGLE_25/eagle_25.yml @@ -67,6 +67,11 @@ SPH: CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. minimal_temperature: 100 # (internal units) +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml index 943c64c7a29fd87b9b5f78a4edded6b14e0f3c57..54a1c47404c15a8574c02e93bba3e8931b5e59c3 100644 --- a/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml +++ b/examples/EAGLE_low_z/EAGLE_50/eagle_50.yml @@ -58,6 +58,11 @@ SPH: CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. minimal_temperature: 100 # (internal units) +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml index 48a825750fd2a927ba08dfc5a8a4607a490fe0d8..140dec0022e21091702ec61222be29be7fe3b56f 100644 --- a/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml +++ b/examples/EAGLE_low_z/EAGLE_6/eagle_6.yml @@ -68,6 +68,11 @@ SPH: CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration. minimal_temperature: 100 # (internal units) +# Parameters of the stars neighbour search +Stars: + resolution_eta: 1.1642 # Target smoothing length in units of the mean inter-particle separation + h_tolerance: 7e-3 + # Parameters for the Friends-Of-Friends algorithm FOF: basename: fof_output # Filename for the FOF outputs. diff --git a/examples/main.c b/examples/main.c index 5806d15cbd9e0141fe8de6e1a43e75865060f934..9f9c0a471370a208251fe1c3628d3d980b476af4 100644 --- a/examples/main.c +++ b/examples/main.c @@ -148,6 +148,7 @@ int main(int argc, char *argv[]) { int with_aff = 0; int dry_run = 0; int dump_tasks = 0; + int dump_cells = 0; int dump_threadpool = 0; int nsteps = -2; int restart = 0; @@ -263,6 +264,9 @@ int main(int argc, char *argv[]) { OPT_INTEGER('y', "task-dumps", &dump_tasks, "Time-step frequency at which task graphs are dumped.", NULL, 0, 0), + OPT_INTEGER(0, "cell-dumps", &dump_cells, + "Time-step frequency at which cell graphs are dumped.", NULL, + 0, 0), OPT_INTEGER('Y', "threadpool-dumps", &dump_threadpool, "Time-step frequency at which threadpool tasks are dumped.", NULL, 0, 0), @@ -323,6 +327,16 @@ int main(int argc, char *argv[]) { } #endif +#ifndef SWIFT_CELL_GRAPH + if (dump_cells) { + if (myrank == 0) { + error( + "complete cell dumps are only created when " + "configured with --enable-cell-graph."); + } + } +#endif + #ifndef SWIFT_DEBUG_THREADPOOL if (dump_threadpool) { printf( @@ -1264,6 +1278,13 @@ int main(int argc, char *argv[]) { task_dump_stats(dumpfile, &e, /* header = */ 0, /* allranks = */ 1); } +#ifdef SWIFT_CELL_GRAPH + /* Dump the cell data using the given frequency. */ + if (dump_cells && (dump_cells == 1 || j % dump_cells == 1)) { + space_write_cell_hierarchy(e.s, j + 1); + } +#endif + /* Dump memory use report if collected. */ #ifdef SWIFT_MEMUSE_REPORTS { diff --git a/src/cell.c b/src/cell.c index 4b9746e92e31f2a5ae6c4b5d01ade8d83939e412..66964105338dce740d0a5894274cd0b5aef0f56c 100644 --- a/src/cell.c +++ b/src/cell.c @@ -2443,7 +2443,8 @@ void cell_activate_star_resort_tasks(struct cell *c, struct scheduler *s) { /* The resort tasks are at either the chosen depth or the super level, * whichever comes first. */ - if (c->depth == engine_star_resort_task_depth || c->hydro.super == c) { + if ((c->depth == engine_star_resort_task_depth || c->hydro.super == c) && + c->hydro.count > 0) { scheduler_activate(s, c->hydro.stars_resort); } else { for (int k = 0; k < 8; ++k) { @@ -2486,6 +2487,10 @@ void cell_activate_star_formation_tasks(struct cell *c, struct scheduler *s) { * @param s The #scheduler. */ void cell_activate_super_spart_drifts(struct cell *c, struct scheduler *s) { + + /* Early abort? */ + if (c->hydro.count == 0) return; + if (c == c->hydro.super) { cell_activate_drift_spart(c, s); } else { diff --git a/src/cooling/EAGLE/cooling_tables.c b/src/cooling/EAGLE/cooling_tables.c index 4261e9ac0a6fee9f77c03afe22b7a9b66ade487d..1de3265df6298eeb955758e272c7e17afb64de00 100644 --- a/src/cooling/EAGLE/cooling_tables.c +++ b/src/cooling/EAGLE/cooling_tables.c @@ -293,7 +293,10 @@ void read_cooling_header(const char *fname, cooling->nH[i] = log10(cooling->nH[i]); } - /* Compute inverse of solar mass fractions */ + /* Compute inverse of solar mass fractions */ +#if defined(__ICC) +#pragma novector +#endif for (int i = 0; i < N_SolarAbundances; ++i) { cooling->SolarAbundances_inv[i] = 1.f / cooling->SolarAbundances[i]; } diff --git a/src/engine.c b/src/engine.c index e58590d2befd36f9a6f2d2ab0c78848158f87dca..04cfa15c48e2d0b8e7a040f374c09a93c0de74b5 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3557,7 +3557,6 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs, #endif scheduler_write_dependencies(&e->sched, e->verbose); - space_write_cell_hierarchy(e->s); if (e->nodeID == 0) scheduler_write_task_level(&e->sched); /* Run the 0th time-step */ diff --git a/src/space.c b/src/space.c index a417117f6e3fa92e1a491efbc11f70c7c9e9ef97..eb498035d7c912f331870cfb0bb8bf84ad1559c4 100644 --- a/src/space.c +++ b/src/space.c @@ -5670,14 +5670,15 @@ void space_write_cell(const struct space *s, FILE *f, const struct cell *c) { * @brief Write a csv file containing the cell hierarchy * * @param s The #space. + * @param j The file number. */ -void space_write_cell_hierarchy(const struct space *s) { +void space_write_cell_hierarchy(const struct space *s, int j) { #ifdef SWIFT_CELL_GRAPH /* Open file */ char filename[200]; - sprintf(filename, "cell_hierarchy_%04i.csv", engine_rank); + sprintf(filename, "cell_hierarchy_%04i_%04i.csv", j, engine_rank); FILE *f = fopen(filename, "w"); if (f == NULL) error("Error opening task level file."); diff --git a/src/space.h b/src/space.h index 0b332716645e733636b7ab0da57a0a31b28e3d31..ad20641e4dc11559d33f512794fddf1b7453317a 100644 --- a/src/space.h +++ b/src/space.h @@ -374,6 +374,6 @@ void space_free_foreign_parts(struct space *s); void space_struct_dump(struct space *s, FILE *stream); void space_struct_restore(struct space *s, FILE *stream); -void space_write_cell_hierarchy(const struct space *s); +void space_write_cell_hierarchy(const struct space *s, int j); #endif /* SWIFT_SPACE_H */ diff --git a/tools/make_cell_hierarchy.sh b/tools/make_cell_hierarchy.sh old mode 100644 new mode 100755 index 87fbe4c97f4aadcbb9be5867a62e8acb56415820..9d1d3caf7c4e2f0514c3d6ad5b2db48efa8958d5 --- a/tools/make_cell_hierarchy.sh +++ b/tools/make_cell_hierarchy.sh @@ -9,7 +9,7 @@ then rm $csv_output fi -for filename in ./cell_hierarchy_*.csv; +for filename in $@; do cat $filename >> cell_hierarchy.csv done