Skip to content
Snippets Groups Projects
Commit 4882467e authored by w.klijn's avatar w.klijn
Browse files

Add min and max duration to the testing.

Save values in a array, to prevent changes on the heap
parent 91781ba1
No related branches found
No related tags found
No related merge requests found
......@@ -31,32 +31,29 @@ int main(int argc, char** argv)
// very simple command line parsing
if (argc < 3) {
std::cout << "disk_io <int nrspikes> <int nr_repeats> <file_per_rank (true|false)> [simple_output (false|true)]"
<< " Simple performance test runner for the exporter manager"
<< " It exports nrspikes nr_repeats using the export_manager and will produce"
<< " the total, mean and std of the time needed to perform the output to disk"
<< " <file_per_rank> true will produce a single file per mpi rank"
<< " <simple_output> true will produce a simplyfied comma seperated output for automatic parsing"
<< " The application can be started with mpi support and will produce output on a single rank";
std::cout << " if nrspikes is not a multiple of the nr of mpi rank, floor is take" << std::endl;
exit(1);
std::cout << "disk_io <int nrspikes> <int nr_repeats> <file_per_rank (true|false)> [simple_output (false|true)]\n"
<< " Simple performance test runner for the exporter manager\n"
<< " It exports nrspikes nr_repeats using the export_manager and will produce\n"
<< " the total, mean and std of the time needed to perform the output to disk\n"
<< " <file_per_rank> true will produce a single file per mpi rank\n"
<< " <simple_output> true will produce a simplyfied comma seperated output for automatic parsing\n"
<< " The application can be started with mpi support and will produce output on a single rank\n"
<< " if nrspikes is not a multiple of the nr of mpi rank, floor is take\n" ;
return 1;
}
int nr_spikes = atoi(argv[1]);
if (nr_spikes == 0) {
std::cout << "disk_io <nrspikes>" << std::endl;
std::cout << " nrspikes should be a valid integer higher then zero"
<< std::endl;
exit(1);
std::cout << "disk_io <nrspikes>\n";
std::cout << " nrspikes should be a valid integer higher then zero\n";
return 1;
}
int nr_repeats = atoi(argv[2]);
if (nr_repeats == 0) {
std::cout << "disk_io <nrspikes>" << std::endl;
std::cout << " nr_repeats should be a valid integer higher then zero"
<< std::endl;
exit(1);
std::cout << "disk_io <nrspikes>\n";
std::cout << " nr_repeats should be a valid integer higher then zero\n";
return 1;
}
bool file_per_rank = false;
......@@ -100,8 +97,7 @@ int main(int argc, char** argv)
0.0f + 1 / (0.05f + idx % 20) }); // semi random float
}
std::vector<int> timings;
int timings_arr[nr_repeats];
int time_total = 0;
// now output to disk nr_repeats times, while keeping track of the times
......@@ -113,8 +109,16 @@ int main(int argc, char** argv)
int time_stop = clock();
int run_time = (time_stop - time_start);
time_total += run_time;
timings.push_back(run_time);
timings_arr[idx] = run_time;
}
std::vector<int> timings;
for (int idx = 0; idx < nr_repeats; ++idx)
{
timings.push_back(timings_arr[idx]);
}
// Calculate some statistics
double sum = std::accumulate(timings.begin(), timings.end(), 0.0);
......@@ -127,15 +131,21 @@ int main(int argc, char** argv)
0.0);
double stdev = std::sqrt(sq_sum / timings.size());
int min = *std::min_element(timings.begin(), timings.end());
int max = *std::max_element(timings.begin(), timings.end());
if (communication_policy.id() != 0) {
return 0;
}
// and output
if (simple_stats) {
std::cout << time_total / double(CLOCKS_PER_SEC) * 1000 << "," <<
mean / double(CLOCKS_PER_SEC) * 1000 << "," <<
stdev / double(CLOCKS_PER_SEC) * 1000;
std::cout << time_total / double(CLOCKS_PER_SEC) * 1000 << ","
<< mean / double(CLOCKS_PER_SEC) * 1000 << ","
<< stdev / double(CLOCKS_PER_SEC) * 1000 << ","
<< min / double(CLOCKS_PER_SEC) * 1000 << ","
<< max / double(CLOCKS_PER_SEC) * 1000 << std::endl;
}
else {
std::cout << "total time (ms): "
......@@ -144,6 +154,10 @@ int main(int argc, char** argv)
<< mean / double(CLOCKS_PER_SEC) * 1000 << std::endl;
std::cout << "stdev time (ms): "
<< stdev / double(CLOCKS_PER_SEC) * 1000 << std::endl;
std::cout << "min time (ms): "
<< min / double(CLOCKS_PER_SEC) * 1000 << std::endl;
std::cout << "max time (ms): "
<< max / double(CLOCKS_PER_SEC) * 1000 << std::endl;
}
return 0;
......
......@@ -9,6 +9,8 @@ spikes_to_save = 100000
range_nr_rank = [1, 2, 4, 8, 16, 24, 32, 48, 64]
mean = []
std = []
min = []
max = []
for n_rank in range_nr_rank:
# open the disk_io executable
p1 = subprocess.Popen(["mpirun", "-n",str(n_rank),
......@@ -24,6 +26,8 @@ for n_rank in range_nr_rank:
mean.append(float(stats[1]))
std.append(float(stats[2]))
min.append(float(stats[3]))
max.append(float(stats[4]))
print ("performed test for n_rank= " + str(n_rank))
......@@ -31,5 +35,8 @@ print (range_nr_rank)
print (mean)
print (std)
plt.errorbar(range_nr_rank, mean, yerr=std, fmt='-o')
plt.errorbar(range_nr_rank, mean, yerr=std, fmt='-o', label="mean (std)")
plt.errorbar(range_nr_rank, min, fmt='-', label="min")
plt.errorbar(range_nr_rank, max, fmt='-', label="max")
plt.legend()
plt.show()
\ No newline at end of file
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