Skip to content

Commit

Permalink
add --verbose command-line option
Browse files Browse the repository at this point in the history
Disables the printout throttling, which might get in the way if you are
trying to do fast validation.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information
tycho committed Feb 26, 2018
1 parent b0f2015 commit 21a2c4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -113,7 +113,7 @@ script:
- export
- ${CC} -v
- make CC=${CC} NO_OPENMP=${NO_OPENMP} CUDA=${CUDA}
- ./nbody --bodies 8 --cycle-after 3 --iterations 1
- ./nbody --bodies 8 --cycle-after 3 --iterations 1 --verbose

notifications:
pushover:
Expand Down
11 changes: 10 additions & 1 deletion src/nbody.cu
Expand Up @@ -569,6 +569,10 @@ static void print_usage(const char *argv0)
fprintf(stderr, " for the list of available algorithms for this argument.\n");
fprintf(stderr, " [default: %s]\n", s_algorithms[0].name);
fprintf(stderr, "\n");
fprintf(stderr, " --verbose\n");
fprintf(stderr, " By default, the output is rate limited to ten lines per seocnd. If this\n");
fprintf(stderr, " argument is specified, a status update is printed for every iteration.\n");
fprintf(stderr, "\n");
fprintf(stderr, " --help\n");
fprintf(stderr, " Prints this help text.\n");
}
Expand All @@ -593,6 +597,7 @@ int main(int argc, char **argv)
int idxFirstAlgorithm = 0;
int bPrintListOnly = 0;
int bUseGraphics = 0;
int bVerbose = 0;

static const struct option cli_options[] = {
{ "bodies", required_argument, NULL, 'n' },
Expand All @@ -604,6 +609,7 @@ int main(int argc, char **argv)
{ "list", no_argument, NULL, 'l' },
{ "algorithm", required_argument, NULL, 'a' },
{ "graphics", no_argument, NULL, 'G' },
{ "verbose", no_argument, NULL, 2 },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
Expand Down Expand Up @@ -737,6 +743,9 @@ int main(int argc, char **argv)
case 'l':
bPrintListOnly = 1;
break;
case 2:
bVerbose = 1;
break;
case 'h':
case '?':
print_usage(argv[0]);
Expand Down Expand Up @@ -842,7 +851,7 @@ int main(int argc, char **argv)
if (ComputeGravitation(&ms, &err, algorithm, g_bCrossCheck))
goto next_algorithm;

if ((now - print_deadline) > 0)
if (bVerbose || (now - print_deadline) > 0)
{
double interactionsPerSecond = (double) g_N*g_N*1000.0f / ms,
flops = interactionsPerSecond * (3 + 6 + 4 + 1 + 6) * 1e-3;
Expand Down

0 comments on commit 21a2c4a

Please sign in to comment.