This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

time algorithm added to main

parent 3112cc53
#include "functions.hpp"
#include <chrono>
using namespace chrono;
int main(int argc, char* argv[])
{
......@@ -9,6 +11,9 @@ int main(int argc, char* argv[])
}
int size = sizeof(arr) / sizeof(arr[0]);
cout << "Starting execution." << endl;
auto start = high_resolution_clock::now();
int ierr = MPI_Init(&argc, &argv);
int procid, numprocs;
ierr = MPI_Comm_rank(MPI_COMM_WORLD, &procid);
......@@ -22,6 +27,13 @@ int main(int argc, char* argv[])
<< result
<< endl;
auto finish = high_resolution_clock::now();
auto duration = duration_cast<seconds>(finish - start);
//output time to console
auto minutes = duration.count() / 60;
auto seconds = duration.count() % 60;
cout << "Execution time: " << minutes << "m" << seconds << "s." << endl;
return 0;
}
\ No newline at end of file
Markdown is supported
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