various MSVC fixes in BTL

This commit is contained in:
Gael Guennebaud 2008-12-19 15:31:47 +00:00
parent 22875683b9
commit 8679d895d3
10 changed files with 80 additions and 50 deletions

View File

@ -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 )

View File

@ -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 ){

View File

@ -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 ){

View File

@ -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 ){

View File

@ -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);

View File

@ -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( \

View File

@ -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

View File

@ -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)

View File

@ -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()*/;
}

View File

@ -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)