diff --git a/README.md b/README.md index 2c36771..f22ae61 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,21 @@ # StencilParallelPattern +To compile with debug symbols: + +``` +cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build/ + +cd build/ + +make +``` + +To compile with optimizations: + +``` +cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/ + +cd build/ + +make +``` diff --git a/main.cpp b/main.cpp index e9acbfc..8b552e8 100644 --- a/main.cpp +++ b/main.cpp @@ -155,6 +155,25 @@ long long int sequential(vector images, return ret; } +long long int reading_writing(vector images) { + Reader reader(images); + Writer writer; + + ff::ff_Pipe<> pipe(reader, writer); + + UTimer timer; + timer.start(); + if (pipe.run_and_wait_end() < 0) { + error("running pipeline\n"); + return 1; + } + timer.stop(); + long long int ret = timer.print("\tElapsed time: "); + return ret; +} + +// ----------------------------------------------------------------------------- +// stencil used for the examples char gameOfLife(vector in) { auto v = std::accumulate(in.begin() + 1, in.end(), 0); if (in[0] && v < 2) { @@ -170,6 +189,7 @@ char gameOfLife(vector in) { // ----------------------------------------------------------------------------- int main(int argc, char *argv[]) { int average_max = 5; + int average_max_rw = 15; int iter_for_num_workers_images1 = 128; vector images1 = { @@ -193,6 +213,8 @@ int main(int argc, char *argv[]) { ofstream csvfile; csvfile.open("performance.csv"); + goto theend; + for (std::string image : images1) { cout << endl << "\033[1;31mProcessing: \t" << image << "\033[0m" << endl; @@ -376,6 +398,30 @@ int main(int argc, char *argv[]) { csvfile << "\n"; } } + +theend: + cout << "Computing reading and writing speeds" << endl; + for (auto image : images1) { + csvfile << "RWtime:," << image << ","; + vector results; + for (int i = 0; i < average_max_rw; ++i) { + results.push_back(reading_writing({image})); + } + csvfile << std::accumulate(results.begin(), results.end(), 0) / + average_max_rw + << "\n"; + } + for (auto image : images2) { + csvfile << "RWtime:," << image << ","; + vector results; + for (int i = 0; i < average_max_rw; ++i) { + results.push_back(reading_writing({image})); + } + csvfile << std::accumulate(results.begin(), results.end(), 0) / + average_max_rw + << "\n"; + } + csvfile.close(); return 0;