diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-03-04 18:47:52 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-03-04 18:47:52 +0100 |
commit | cefd9b888868bca6b23d67c0e6c69c49582508c3 (patch) | |
tree | e7cd032e6475afcee813cbefdf01d3c5bda33d9a /bench | |
parent | 65eba35f98941a1d5c7ff6f854ed17224ef65b40 (diff) | |
parent | 8ed1ef446998dc35f738ad9984cf479dbfc2cc6c (diff) |
merge with default branch
Diffstat (limited to 'bench')
-rw-r--r-- | bench/BenchTimer.h | 46 | ||||
-rwxr-xr-x | bench/bench_unrolling | 3 | ||||
-rwxr-xr-x | bench/benchmark_suite | 1 |
3 files changed, 32 insertions, 18 deletions
diff --git a/bench/BenchTimer.h b/bench/BenchTimer.h index e49afa07f..0a0a5e154 100644 --- a/bench/BenchTimer.h +++ b/bench/BenchTimer.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -27,18 +27,20 @@ #define EIGEN_BENCH_TIMERR_H #if defined(_WIN32) || defined(__CYGWIN__) -#define NOMINMAX -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +# ifndef NOMINMAX +# define NOMINMAX +# define EIGEN_BT_UNDEF_NOMINMAX +# endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# define EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN +# endif +# include <windows.h> #else -#include <sys/time.h> -#include <time.h> -#include <unistd.h> +# include <unistd.h> #endif -#include <cmath> -#include <cstdlib> -#include <numeric> +#include <Eigen/Core> namespace Eigen { @@ -126,14 +128,13 @@ public: inline double getRealTime() { #ifdef WIN32 - SYSTEMTIME st; - GetSystemTime(&st); - return (double)st.wSecond + 1.e-3 * (double)st.wMilliseconds; + SYSTEMTIME st; + GetSystemTime(&st); + return (double)st.wSecond + 1.e-3 * (double)st.wMilliseconds; #else - struct timeval tv; - struct timezone tz; - gettimeofday(&tv, &tz); - return (double)tv.tv_sec + 1.e-6 * (double)tv.tv_usec; + timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + return double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); #endif } @@ -161,4 +162,15 @@ protected: } +// clean #defined tokens +#ifdef EIGEN_BT_UNDEF_NOMINMAX +# undef EIGEN_BT_UNDEF_NOMINMAX +# undef NOMINMAX +#endif + +#ifdef EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN +# undef EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN +# undef WIN32_LEAN_AND_MEAN +#endif + #endif // EIGEN_BENCH_TIMERR_H diff --git a/bench/bench_unrolling b/bench/bench_unrolling index bf01cce7d..826443845 100755 --- a/bench/bench_unrolling +++ b/bench/bench_unrolling @@ -2,10 +2,11 @@ # gcc : CXX="g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000" # icc : CXX="icpc -fast -no-inline-max-size -fno-exceptions" +CXX=${CXX-g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000} # default value for ((i=1; i<16; ++i)); do echo "Matrix size: $i x $i :" - $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=1024 -DEIGEN_UNROLLING_LIMIT=400 -o benchmark && time ./benchmark >/dev/null + $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=400 -o benchmark && time ./benchmark >/dev/null $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null echo " " done diff --git a/bench/benchmark_suite b/bench/benchmark_suite index a8fc6dced..3f21d3661 100755 --- a/bench/benchmark_suite +++ b/bench/benchmark_suite @@ -1,4 +1,5 @@ #!/bin/bash +CXX=${CXX-g++} # default value unless caller has defined CXX echo "Fixed size 3x3, column-major, -DNDEBUG" $CXX -O3 -I .. -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null echo "Fixed size 3x3, column-major, with asserts" |