aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/btl
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-12-19 15:31:47 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-12-19 15:31:47 +0000
commit8679d895d332162694477f06d6f369ee5652e458 (patch)
treeab01c3f5c2e9b3f85e634076f0579605b41c2f6b /bench/btl
parent22875683b9c382a8f327630014ae33d22ca64588 (diff)
various MSVC fixes in BTL
Diffstat (limited to 'bench/btl')
-rw-r--r--bench/btl/actions/action_atv_product.hh4
-rw-r--r--bench/btl/actions/action_axpby.hh4
-rw-r--r--bench/btl/actions/action_axpy.hh4
-rw-r--r--bench/btl/actions/action_matrix_vector_product.hh4
-rw-r--r--bench/btl/data/mean.cxx4
-rw-r--r--bench/btl/generic_bench/btl.hh8
-rwxr-xr-xbench/btl/generic_bench/timers/portable_timer.hh94
-rw-r--r--bench/btl/libs/eigen2/CMakeLists.txt2
-rw-r--r--bench/btl/libs/eigen2/eigen2_interface.hh2
-rw-r--r--bench/btl/libs/f77/CMakeLists.txt4
10 files changed, 80 insertions, 50 deletions
diff --git a/bench/btl/actions/action_atv_product.hh b/bench/btl/actions/action_atv_product.hh
index e148bc86d..22d25e23e 100644
--- a/bench/btl/actions/action_atv_product.hh
+++ b/bench/btl/actions/action_atv_product.hh
@@ -86,9 +86,9 @@ public :
}
BTL_DONT_INLINE void calculate( void ) {
- asm("#begin atv");
+ BTL_ASM_COMMENT("begin atv");
Interface::atv_product(A,B,X,_size);
- asm("#end atv");
+ BTL_ASM_COMMENT("end atv");
}
void check_result( void )
diff --git a/bench/btl/actions/action_axpby.hh b/bench/btl/actions/action_axpby.hh
index 705447a21..7815530ac 100644
--- a/bench/btl/actions/action_axpby.hh
+++ b/bench/btl/actions/action_axpby.hh
@@ -85,9 +85,9 @@ public :
}
inline void calculate( void ) {
- asm("#mybegin axpby");
+ BTL_ASM_COMMENT("mybegin axpby");
Interface::axpby(_alpha,X,_beta,Y,_size);
- asm("#myend axpby");
+ BTL_ASM_COMMENT("myend axpby");
}
void check_result( void ){
diff --git a/bench/btl/actions/action_axpy.hh b/bench/btl/actions/action_axpy.hh
index 50759f6f6..f127426db 100644
--- a/bench/btl/actions/action_axpy.hh
+++ b/bench/btl/actions/action_axpy.hh
@@ -96,9 +96,9 @@ public :
}
inline void calculate( void ) {
- asm("#mybegin axpy");
+ BTL_ASM_COMMENT("mybegin axpy");
Interface::axpy(_coef,X,Y,_size);
- asm("#myend axpy");
+ BTL_ASM_COMMENT("myend axpy");
}
void check_result( void ){
diff --git a/bench/btl/actions/action_matrix_vector_product.hh b/bench/btl/actions/action_matrix_vector_product.hh
index 272e9d417..8bab79d18 100644
--- a/bench/btl/actions/action_matrix_vector_product.hh
+++ b/bench/btl/actions/action_matrix_vector_product.hh
@@ -103,9 +103,9 @@ public :
}
BTL_DONT_INLINE void calculate( void ) {
- asm("#begin matrix_vector_product");
+ BTL_ASM_COMMENT("#begin matrix_vector_product");
Interface::matrix_vector_product(A,B,X,_size);
- asm("#end matrix_vector_product");
+ BTL_ASM_COMMENT("end matrix_vector_product");
}
BTL_DONT_INLINE void check_result( void ){
diff --git a/bench/btl/data/mean.cxx b/bench/btl/data/mean.cxx
index 3e1a82d22..c567ef33e 100644
--- a/bench/btl/data/mean.cxx
+++ b/bench/btl/data/mean.cxx
@@ -117,9 +117,7 @@ int main( int argc , char *argv[] )
cout << " <TH ALIGN=CENTER> comments </TH>" << endl ;
cout << " </TR>" << endl ;
- set<Lib_Mean>::iterator is ;
-
- is=s_lib_mean.begin();
+ multiset<Lib_Mean>::iterator is = s_lib_mean.begin();
Lib_Mean best(*is);
diff --git a/bench/btl/generic_bench/btl.hh b/bench/btl/generic_bench/btl.hh
index 6d6e048b3..38e2c5f45 100644
--- a/bench/btl/generic_bench/btl.hh
+++ b/bench/btl/generic_bench/btl.hh
@@ -38,7 +38,13 @@
#define BTL_DONT_INLINE
#endif
-#ifndef __INTEL_COMPILER
+#if (defined __GNUC__)
+#define BTL_ASM_COMMENT(X) asm("#"X)
+#else
+#define BTL_ASM_COMMENT(X)
+#endif
+
+#if (defined __GNUC__) && (!defined __INTEL_COMPILER)
#define BTL_DISABLE_SSE_EXCEPTIONS() { \
int aux; \
asm( \
diff --git a/bench/btl/generic_bench/timers/portable_timer.hh b/bench/btl/generic_bench/timers/portable_timer.hh
index de50394f9..30fc4e883 100755
--- a/bench/btl/generic_bench/timers/portable_timer.hh
+++ b/bench/btl/generic_bench/timers/portable_timer.hh
@@ -26,10 +26,6 @@
#include <cstdlib>
#include <time.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <unistd.h>
-#include <sys/times.h>
#define USEC_IN_SEC 1000000
@@ -38,38 +34,65 @@
// timer -------------------------------------------------------------------//
// A timer object measures CPU time.
+#ifdef _MSC_VER
-// class Portable_Timer
-// {
-// public:
-//
-// Portable_Timer( void )
-// {
-// }
-//
-//
-// void start() { m_val = getTime(); }
-//
-// void stop() { m_val = getTime() - m_val; }
-//
-// double elapsed() { return m_val; }
-//
-// double user_time() { return elapsed(); }
-//
-//
-// private:
-//
-// static inline double getTime(void)
-// {
-// struct timeval tv;
-// struct timezone tz;
-// gettimeofday(&tv, &tz);
-// return (double)tv.tv_sec + 1.e-6 * (double)tv.tv_usec;
-// }
-//
-// double m_val;
-//
-// }; // Portable_Timer
+#define NOMINMAX
+#include <windows.h>
+
+/*#ifndef hr_timer
+#include "hr_time.h"
+#define hr_timer
+#endif*/
+
+ class Portable_Timer
+ {
+ public:
+
+ typedef struct {
+ LARGE_INTEGER start;
+ LARGE_INTEGER stop;
+ } stopWatch;
+
+
+ Portable_Timer()
+ {
+ startVal.QuadPart = 0;
+ stopVal.QuadPart = 0;
+ QueryPerformanceFrequency(&frequency);
+ }
+
+ void start() { QueryPerformanceCounter(&startVal); }
+
+ void stop() { QueryPerformanceCounter(&stopVal); }
+
+ double elapsed() {
+ LARGE_INTEGER time;
+ time.QuadPart = stopVal.QuadPart - startVal.QuadPart;
+ return LIToSecs(time);
+ }
+
+ double user_time() { return elapsed(); }
+
+
+ private:
+
+ double LIToSecs(LARGE_INTEGER& L) {
+ return ((double)L.QuadPart /(double)frequency.QuadPart) ;
+ }
+
+ LARGE_INTEGER startVal;
+ LARGE_INTEGER stopVal;
+ LARGE_INTEGER frequency;
+
+
+ }; // Portable_Timer
+
+#else
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#include <sys/times.h>
class Portable_Timer
{
@@ -137,5 +160,6 @@ private:
}; // Portable_Timer
+#endif
#endif // PORTABLE_TIMER_HPP
diff --git a/bench/btl/libs/eigen2/CMakeLists.txt b/bench/btl/libs/eigen2/CMakeLists.txt
index c56aa8f83..f061a27de 100644
--- a/bench/btl/libs/eigen2/CMakeLists.txt
+++ b/bench/btl/libs/eigen2/CMakeLists.txt
@@ -40,5 +40,5 @@ if (EIGEN2_FOUND)
set_target_properties(btl_tiny_eigen2_novec PROPERTIES COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE")
endif(BUILD_btl_tiny_eigen2_novec)
ENDIF(NOT BTL_NOVEC)
-
+
endif (EIGEN2_FOUND)
diff --git a/bench/btl/libs/eigen2/eigen2_interface.hh b/bench/btl/libs/eigen2/eigen2_interface.hh
index 39eaa3b65..0f5b6f640 100644
--- a/bench/btl/libs/eigen2/eigen2_interface.hh
+++ b/bench/btl/libs/eigen2/eigen2_interface.hh
@@ -109,7 +109,7 @@ public :
X = (A*A.transpose()).lazy();
}
- static inline void matrix_vector_product(const gene_matrix & __restrict__ A, const gene_vector & __restrict__ B, gene_vector & __restrict__ X, int N){
+ static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){
X = (A*B)/*.lazy()*/;
}
diff --git a/bench/btl/libs/f77/CMakeLists.txt b/bench/btl/libs/f77/CMakeLists.txt
index c7c373641..cecb9160c 100644
--- a/bench/btl/libs/f77/CMakeLists.txt
+++ b/bench/btl/libs/f77/CMakeLists.txt
@@ -1,4 +1,6 @@
if(CMAKE_MINOR_VERSION GREATER 4)
- enable_language(Fortran)
+ if(NOT MSVC)
+ enable_language(Fortran)
+ endif(NOT MSVC)
btl_add_bench(btl_f77 main.cpp dmxv.f smxv.f dmxm.f smxm.f daxpy.f saxpy.f data.f sata.f daat.f saat.f OFF)
endif(CMAKE_MINOR_VERSION GREATER 4) \ No newline at end of file