Commit 7a3bd480 authored by Douglas Serson's avatar Douglas Serson
Browse files

Remove dependency on boost timer

parent c4eaf3f7
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
#If the user has not set BOOST_ROOT, look in a couple common places first. #If the user has not set BOOST_ROOT, look in a couple common places first.
MESSAGE(STATUS "Searching for Boost:") MESSAGE(STATUS "Searching for Boost:")
SET(MIN_VER "1.56.0") SET(MIN_VER "1.56.0")
SET(NEEDED_BOOST_LIBS thread iostreams date_time filesystem system SET(NEEDED_BOOST_LIBS thread iostreams date_time filesystem program_options)
program_options regex timer chrono)
SET(Boost_DEBUG 0) SET(Boost_DEBUG 0)
SET(Boost_NO_BOOST_CMAKE ON) SET(Boost_NO_BOOST_CMAKE ON)
IF( BOOST_ROOT ) IF( BOOST_ROOT )
......
...@@ -37,10 +37,9 @@ ...@@ -37,10 +37,9 @@
#include <cstdlib> #include <cstdlib>
#include <iomanip> #include <iomanip>
#include <boost/timer/timer.hpp>
#include <LibUtilities/Memory/NekMemoryManager.hpp> #include <LibUtilities/Memory/NekMemoryManager.hpp>
#include <LibUtilities/BasicUtils/SessionReader.h> #include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/BasicUtils/Timer.h>
#include <LibUtilities/Communication/Comm.h> #include <LibUtilities/Communication/Comm.h>
#include <MultiRegions/ExpList3D.h> #include <MultiRegions/ExpList3D.h>
#include <Collections/Collection.h> #include <Collections/Collection.h>
...@@ -49,11 +48,6 @@ ...@@ -49,11 +48,6 @@
using namespace std; using namespace std;
using namespace Nektar; using namespace Nektar;
using boost::timer::cpu_timer;
using boost::timer::cpu_times;
using boost::timer::nanosecond_type;
using boost::timer::format;
MultiRegions::ExpListSharedPtr SetupExpList( MultiRegions::ExpListSharedPtr SetupExpList(
int N, int N,
LibUtilities::SessionReaderSharedPtr session, LibUtilities::SessionReaderSharedPtr session,
...@@ -71,33 +65,21 @@ MultiRegions::ExpListSharedPtr SetupExpList( ...@@ -71,33 +65,21 @@ MultiRegions::ExpListSharedPtr SetupExpList(
return expList; return expList;
} }
void printOutput(int N, int Ntest, cpu_timer &timer, bool fmt) void printOutput(int N, int Ntest, LibUtilities::Timer &timer, bool fmt)
{ {
cpu_times times = timer.elapsed(); // Get timings
nanosecond_type total = times.user + times.system; NekDouble total_sec = timer.TimePerTest(Ntest);
const double sec = 1000000000.0L;
// Normalize timings
double wall_sec = times.wall / sec;
double total_sec = total / sec;
wall_sec /= Ntest;
total_sec /= Ntest;
if (fmt) if (fmt)
{ {
cout << setw(6) << N-1 cout << setw(6) << N-1
<< setw(18) << wall_sec
<< setw(18) << total_sec << setw(18) << total_sec
<< endl; << endl;
} }
else else
{ {
cout << "P = " << N-1 << ": " cout << "P = " << N-1 << ": "
<< wall_sec << " (wall) " << total_sec << " s, "
<< total_sec << " (total), "
<< (100.0 * total_sec / wall_sec) << "% CPU"
<< endl; << endl;
} }
} }
...@@ -113,7 +95,7 @@ int main(int argc, char *argv[]) ...@@ -113,7 +95,7 @@ int main(int argc, char *argv[])
MultiRegions::ExpListSharedPtr expList; MultiRegions::ExpListSharedPtr expList;
cpu_timer timer; LibUtilities::Timer timer;
int Ntest, maxOrder; int Ntest, maxOrder;
session->LoadParameter("Ntest", Ntest, 1000); session->LoadParameter("Ntest", Ntest, 1000);
...@@ -141,12 +123,12 @@ int main(int argc, char *argv[]) ...@@ -141,12 +123,12 @@ int main(int argc, char *argv[])
Array<OneD, NekDouble> input (expList->GetNcoeffs()); Array<OneD, NekDouble> input (expList->GetNcoeffs());
Array<OneD, NekDouble> output(expList->GetNpoints()); Array<OneD, NekDouble> output(expList->GetNpoints());
timer.start(); timer.Start();
for (int i = 0; i < Ntest; ++i) for (int i = 0; i < Ntest; ++i)
{ {
expList->BwdTrans(input, output); expList->BwdTrans(input, output);
} }
timer.stop(); timer.Stop();
printOutput(N, Ntest, timer, fmt); printOutput(N, Ntest, timer, fmt);
} }
...@@ -158,12 +140,12 @@ int main(int argc, char *argv[]) ...@@ -158,12 +140,12 @@ int main(int argc, char *argv[])
Array<OneD, NekDouble> input (expList->GetNpoints()); Array<OneD, NekDouble> input (expList->GetNpoints());
Array<OneD, NekDouble> output(expList->GetNcoeffs()); Array<OneD, NekDouble> output(expList->GetNcoeffs());
timer.start(); timer.Start();
for (int i = 0; i < Ntest; ++i) for (int i = 0; i < Ntest; ++i)
{ {
expList->IProductWRTBase(input, output); expList->IProductWRTBase(input, output);
} }
timer.stop(); timer.Stop();
printOutput(N, Ntest, timer, fmt); printOutput(N, Ntest, timer, fmt);
} }
...@@ -181,12 +163,12 @@ int main(int argc, char *argv[]) ...@@ -181,12 +163,12 @@ int main(int argc, char *argv[])
input[i] = Array<OneD, NekDouble>(expList->GetNpoints()); input[i] = Array<OneD, NekDouble>(expList->GetNpoints());
} }
timer.start(); timer.Start();
for (int i = 0; i < Ntest; ++i) for (int i = 0; i < Ntest; ++i)
{ {
expList->IProductWRTDerivBase(input, output); expList->IProductWRTDerivBase(input, output);
} }
timer.stop(); timer.Stop();
printOutput(N, Ntest, timer, fmt); printOutput(N, Ntest, timer, fmt);
} }
...@@ -200,12 +182,12 @@ int main(int argc, char *argv[]) ...@@ -200,12 +182,12 @@ int main(int argc, char *argv[])
Array<OneD, NekDouble> output1(expList->GetNpoints()); Array<OneD, NekDouble> output1(expList->GetNpoints());
Array<OneD, NekDouble> output2(expList->GetNpoints()); Array<OneD, NekDouble> output2(expList->GetNpoints());
timer.start(); timer.Start();
for (int i = 0; i < Ntest; ++i) for (int i = 0; i < Ntest; ++i)
{ {
expList->PhysDeriv(input, output0, output1, output2); expList->PhysDeriv(input, output0, output1, output2);
} }
timer.stop(); timer.Stop();
printOutput(N, Ntest, timer, fmt); printOutput(N, Ntest, timer, fmt);
} }
......
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