Skip to content
Snippets Groups Projects
Commit 87dfe4d8 authored by Administrator's avatar Administrator
Browse files

Merge branch 'cosmetics' into 'master'

New command line parameter for scaling tests

Following a request from Heinrich, I added a command-line parameter '-o' that stops the code writing output files. Useful for scaling tests where we don't want to generate tons of data output.



See merge request !43
parents 04f57782 b4f621dc
No related branches found
No related tags found
No related merge requests found
...@@ -567,6 +567,7 @@ int main(int argc, char *argv[]) { ...@@ -567,6 +567,7 @@ int main(int argc, char *argv[]) {
ticks tic; ticks tic;
int nr_nodes = 1, myrank = 0, grid[3] = {1, 1, 1}; int nr_nodes = 1, myrank = 0, grid[3] = {1, 1, 1};
FILE *file_thread; FILE *file_thread;
int with_outputs = 1;
/* Choke on FP-exceptions. */ /* Choke on FP-exceptions. */
// feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW ); // feenableexcept( FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
...@@ -604,7 +605,7 @@ int main(int argc, char *argv[]) { ...@@ -604,7 +605,7 @@ int main(int argc, char *argv[]) {
bzero(&s, sizeof(struct space)); bzero(&s, sizeof(struct space));
/* Parse the options */ /* Parse the options */
while ((c = getopt(argc, argv, "a:c:d:f:g:m:q:r:s:t:w:z:")) != -1) while ((c = getopt(argc, argv, "a:c:d:f:g:m:oq:r:s:t:w:z:")) != -1)
switch (c) { switch (c) {
case 'a': case 'a':
if (sscanf(optarg, "%lf", &scaling) != 1) if (sscanf(optarg, "%lf", &scaling) != 1)
...@@ -635,6 +636,9 @@ int main(int argc, char *argv[]) { ...@@ -635,6 +636,9 @@ int main(int argc, char *argv[]) {
if (myrank == 0) message("maximum h set to %e.", h_max); if (myrank == 0) message("maximum h set to %e.", h_max);
fflush(stdout); fflush(stdout);
break; break;
case 'o':
with_outputs = 0;
break;
case 'q': case 'q':
if (sscanf(optarg, "%d", &nr_queues) != 1) if (sscanf(optarg, "%d", &nr_queues) != 1)
error("Error parsing number of queues."); error("Error parsing number of queues.");
...@@ -806,21 +810,25 @@ int main(int argc, char *argv[]) { ...@@ -806,21 +810,25 @@ int main(int argc, char *argv[]) {
engine_redistribute(&e); engine_redistribute(&e);
#endif #endif
/* Write the state of the system as it is before starting time integration. */ if (with_outputs) {
tic = getticks(); /* Write the state of the system as it is before starting time integration.
*/
tic = getticks();
#if defined(WITH_MPI) #if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5) #if defined(HAVE_PARALLEL_HDF5)
write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL); MPI_INFO_NULL);
#else #else
write_output_serial(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL); write_output_serial(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL);
#endif #endif
#else #else
write_output_single(&e, &us); write_output_single(&e, &us);
#endif #endif
message("writing particle properties took %.3f ms.", message("writing particle properties took %.3f ms.",
((double)(getticks() - tic)) / CPU_TPS * 1000); ((double)(getticks() - tic)) / CPU_TPS * 1000);
fflush(stdout); fflush(stdout);
}
/* Init the runner history. */ /* Init the runner history. */
#ifdef HIST #ifdef HIST
...@@ -862,7 +870,7 @@ int main(int argc, char *argv[]) { ...@@ -862,7 +870,7 @@ int main(int argc, char *argv[]) {
/* Take a step. */ /* Take a step. */
engine_step(&e); engine_step(&e);
if (j % 100 == 0) { if (with_outputs && j % 100 == 0) {
#if defined(WITH_MPI) #if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5) #if defined(HAVE_PARALLEL_HDF5)
...@@ -943,17 +951,20 @@ int main(int argc, char *argv[]) { ...@@ -943,17 +951,20 @@ int main(int argc, char *argv[]) {
fclose(file_thread); fclose(file_thread);
#endif #endif
if (with_outputs) {
/* Write final output. */ /* Write final output. */
#if defined(WITH_MPI) #if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5) #if defined(HAVE_PARALLEL_HDF5)
write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, write_output_parallel(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL); MPI_INFO_NULL);
#else #else
write_output_serial(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL); write_output_serial(&e, &us, myrank, nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL);
#endif #endif
#else #else
write_output_single(&e, &us); write_output_single(&e, &us);
#endif #endif
}
#ifdef WITH_MPI #ifdef WITH_MPI
if (MPI_Finalize() != MPI_SUCCESS) if (MPI_Finalize() != MPI_SUCCESS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment