Support CSV output for triad only running mode

Fixes #54
This commit is contained in:
Tom Deakin 2018-10-04 14:36:59 +01:00
parent 96216628bf
commit a1f7b94820
2 changed files with 49 additions and 21 deletions

View File

@ -6,7 +6,8 @@ All notable changes to this project will be documented in this file.
### Added
- OpenACC flags to build for Volta.
- Kokkos list CLI argument shows some information about which device will be used.
- OpenMP GNU compiler now uses native target flag
- OpenMP GNU compiler now uses native target flag.
- Support CSV output for Triad only running mode.
### Changed
- Update SYCL implementation to SYCL 1.2.1 interface.

View File

@ -285,6 +285,9 @@ void run()
template <typename T>
void run_triad()
{
if (!output_as_csv)
{
std::cout << "Running triad " << num_times << " times" << std::endl;
std::cout << "Number of elements: " << ARRAY_SIZE << std::endl;
@ -294,10 +297,6 @@ void run_triad()
else
std::cout << "Precision: double" << std::endl;
// Create host vectors
std::vector<T> a(ARRAY_SIZE);
std::vector<T> b(ARRAY_SIZE);
std::vector<T> c(ARRAY_SIZE);
std::streamsize ss = std::cout.precision();
std::cout << std::setprecision(1) << std::fixed
<< "Array size: " << ARRAY_SIZE*sizeof(T)*1.0E-3 << " KB"
@ -305,6 +304,12 @@ void run_triad()
std::cout << "Total size: " << 3.0*ARRAY_SIZE*sizeof(T)*1.0E-3 << " KB"
<< " (=" << 3.0*ARRAY_SIZE*sizeof(T)*1.0E-6 << " MB)" << std::endl;
std::cout.precision(ss);
}
// Create host vectors
std::vector<T> a(ARRAY_SIZE);
std::vector<T> b(ARRAY_SIZE);
std::vector<T> c(ARRAY_SIZE);
Stream<T> *stream;
@ -365,6 +370,27 @@ void run_triad()
// Display timing results
double total_bytes = 3 * sizeof(T) * ARRAY_SIZE * num_times;
double bandwidth = 1.0E-9 * (total_bytes / runtime);
if (output_as_csv)
{
std::cout
<< "function" << csv_separator
<< "num_times" << csv_separator
<< "n_elements" << csv_separator
<< "sizeof" << csv_separator
<< "gbytes_per_sec" << csv_separator
<< "runtime"
<< std::endl;
std::cout
<< "Triad" << csv_separator
<< num_times << csv_separator
<< ARRAY_SIZE << csv_separator
<< sizeof(T) << csv_separator
<< bandwidth << csv_separator
<< runtime
<< std::endl;
}
else
{
std::cout
<< "--------------------------------"
<< std::endl << std::fixed
@ -372,6 +398,7 @@ void run_triad()
<< runtime << std::endl
<< "Bandwidth (GB/s): " << std::left << std::setprecision(3)
<< bandwidth << std::endl;
}
delete stream;
}