Skip to content
Snippets Groups Projects
Commit 9b682c3e authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added timing information to the vectorization test

parent 0378bf24
No related branches found
No related tags found
1 merge request!64Agreed upon version of the density vectorization test
...@@ -120,6 +120,7 @@ int main(int argc, char *argv[]) { ...@@ -120,6 +120,7 @@ int main(int argc, char *argv[]) {
struct runner runner; struct runner runner;
char c; char c;
static unsigned long long partId = 0; static unsigned long long partId = 0;
ticks tic, toc, time;
while ((c = getopt(argc, argv, "h:p:r:t:")) != -1) { while ((c = getopt(argc, argv, "h:p:r:t:")) != -1) {
switch (c) { switch (c) {
...@@ -172,19 +173,40 @@ int main(int argc, char *argv[]) { ...@@ -172,19 +173,40 @@ int main(int argc, char *argv[]) {
zero_particle_fields(ci); zero_particle_fields(ci);
zero_particle_fields(cj); zero_particle_fields(cj);
tic = getticks();
/* Run the test */ /* Run the test */
runner_dopair1_density(&runner, ci, cj); runner_dopair1_density(&runner, ci, cj);
toc = getticks();
time += toc - tic;
/* Dump if necessary */ /* Dump if necessary */
if (i % 50 == 0) dump_particle_fields("swift_dopair.dat", ci, cj); if (i % 50 == 0) dump_particle_fields("swift_dopair.dat", ci, cj);
} }
/* Output timing */
message("SWIFT calculation took %lli ticks." , time / runs);
/* Now perform a brute-force version for accuracy tests */ /* Now perform a brute-force version for accuracy tests */
/* Zero the fields */
zero_particle_fields(ci); zero_particle_fields(ci);
zero_particle_fields(cj); zero_particle_fields(cj);
tic = getticks();
/* Run the test */
pairs_all_density(&runner, ci, cj); pairs_all_density(&runner, ci, cj);
toc = getticks();
/* Dump */
dump_particle_fields("brute_force.dat", ci, cj); dump_particle_fields("brute_force.dat", ci, cj);
/* Output timing */
message("Brute force calculation took %lli ticks." , toc - tic);
/* Clean things to make the sanitizer happy ... */ /* Clean things to make the sanitizer happy ... */
clean_up(ci); clean_up(ci);
clean_up(cj); clean_up(cj);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment