mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
BTL: - patch from Victor (add ACML support)
- fix overflow issues
This commit is contained in:
parent
6a26506341
commit
a72ff5abc1
@ -43,7 +43,7 @@ public :
|
||||
init_matrix<pseudo_random>(tmp,_size);
|
||||
init_matrix<null_function>(X_stl,_size);
|
||||
STL_interface<typename Interface::real_type>::ata_product(tmp,X_stl,_size);
|
||||
|
||||
|
||||
init_matrix<null_function>(C_stl,_size);
|
||||
init_matrix<null_function>(resu_stl,_size);
|
||||
|
||||
@ -55,7 +55,7 @@ public :
|
||||
_cost = 0;
|
||||
for (int j=0; j<_size; ++j)
|
||||
{
|
||||
int r = std::max(_size - j -1,0);
|
||||
double r = std::max(_size - j -1,0);
|
||||
_cost += 2*(r*j+r+j);
|
||||
}
|
||||
}
|
||||
@ -104,10 +104,10 @@ public :
|
||||
Interface::matrix_to_stl(C,resu_stl);
|
||||
|
||||
// STL_interface<typename Interface::real_type>::cholesky(X_stl,C_stl,_size);
|
||||
//
|
||||
//
|
||||
// typename Interface::real_type error=
|
||||
// STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
|
||||
//
|
||||
//
|
||||
// if (error>1.e-6){
|
||||
// INFOS("WRONG CALCULATION...residual=" << error);
|
||||
// exit(0);
|
||||
@ -126,7 +126,7 @@ private :
|
||||
typename Interface::gene_matrix C;
|
||||
|
||||
int _size;
|
||||
int _cost;
|
||||
double _cost;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -52,8 +52,8 @@ public :
|
||||
_cost = 0;
|
||||
for (int j=0; j<_size-2; ++j)
|
||||
{
|
||||
int r = std::max(0,_size-j-1);
|
||||
int b = std::max(0,_size-j-2);
|
||||
double r = std::max(0,_size-j-1);
|
||||
double b = std::max(0,_size-j-2);
|
||||
_cost += 6 + 3*b + r*r*4 + r*_size*4;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public :
|
||||
|
||||
// STL vector initialization
|
||||
init_matrix<pseudo_random>(X_stl,_size);
|
||||
|
||||
|
||||
init_matrix<null_function>(C_stl,_size);
|
||||
init_matrix<null_function>(resu_stl,_size);
|
||||
|
||||
@ -96,10 +96,10 @@ public :
|
||||
Interface::matrix_to_stl(C,resu_stl);
|
||||
|
||||
// STL_interface<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);
|
||||
//
|
||||
//
|
||||
// typename Interface::real_type error=
|
||||
// STL_interface<typename Interface::real_type>::norm_diff(C_stl,resu_stl);
|
||||
//
|
||||
//
|
||||
// if (error>1.e-6){
|
||||
// INFOS("WRONG CALCULATION...residual=" << error);
|
||||
// exit(0);
|
||||
@ -118,7 +118,7 @@ private :
|
||||
typename Interface::gene_matrix C;
|
||||
|
||||
int _size;
|
||||
int _cost;
|
||||
double _cost;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -130,7 +130,7 @@ private :
|
||||
typename Interface::gene_vector B;
|
||||
|
||||
int _size;
|
||||
int _cost;
|
||||
double _cost;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -125,12 +125,12 @@ public :
|
||||
// calculation check
|
||||
|
||||
// Interface::matrix_to_stl(X,resu_stl);
|
||||
//
|
||||
//
|
||||
// STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);
|
||||
//
|
||||
//
|
||||
// typename Interface::real_type error=
|
||||
// STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
|
||||
//
|
||||
//
|
||||
// if (error>1.e-6){
|
||||
// INFOS("WRONG CALCULATION...residual=" << error);
|
||||
// // exit(1);
|
||||
|
60
bench/btl/cmake/FindACML.cmake
Normal file
60
bench/btl/cmake/FindACML.cmake
Normal file
@ -0,0 +1,60 @@
|
||||
# include(FindLibraryWithDebug)
|
||||
|
||||
if (ACML_INCLUDES AND ACML_LIBRARIES)
|
||||
set(ACML_FIND_QUIETLY TRUE)
|
||||
endif (ACML_INCLUDES AND ACML_LIBRARIES)
|
||||
|
||||
find_path(ACML_INCLUDES
|
||||
NAMES
|
||||
acml.h
|
||||
PATHS
|
||||
$ENV{ACMLDIR}/include
|
||||
$ENV{ACML_DIR}/include
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
find_library(ACML_LIBRARIES
|
||||
NAMES
|
||||
acml_mp acml_mv
|
||||
PATHS
|
||||
$ENV{ACMLDIR}/lib
|
||||
$ENV{ACML_DIR}/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
find_file(ACML_LIBRARIES
|
||||
NAMES
|
||||
libacml_mp.so
|
||||
PATHS
|
||||
/usr/lib
|
||||
$ENV{ACMLDIR}/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
if(NOT ACML_LIBRARIES)
|
||||
message(STATUS "Multi-threaded library not found, looking for single-threaded")
|
||||
find_library(ACML_LIBRARIES
|
||||
NAMES
|
||||
acml acml_mv
|
||||
PATHS
|
||||
$ENV{ACMLDIR}/lib
|
||||
$ENV{ACML_DIR}/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
find_file(ACML_LIBRARIES
|
||||
libacml.so libacml_mv.so
|
||||
PATHS
|
||||
/usr/lib
|
||||
$ENV{ACMLDIR}/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ACML DEFAULT_MSG
|
||||
ACML_INCLUDES ACML_LIBRARIES)
|
||||
|
||||
mark_as_advanced(ACML_INCLUDES ACML_LIBRARIES)
|
@ -28,3 +28,14 @@ if (GOTO_FOUND)
|
||||
set_target_properties(btl_goto PROPERTIES COMPILE_FLAGS "-DCBLASNAME=GOTO -DPUREBLAS")
|
||||
endif(BUILD_btl_goto)
|
||||
endif (GOTO_FOUND)
|
||||
|
||||
|
||||
find_package(ACML)
|
||||
if (ACML_FOUND)
|
||||
include_directories(${ACML_INCLUDES} ${PROJECT_SOURCE_DIR}/libs/f77)
|
||||
btl_add_bench(btl_acml main.cpp)
|
||||
if(BUILD_btl_acml)
|
||||
target_link_libraries(btl_acml ${ACML_LIBRARIES} )
|
||||
set_target_properties(btl_acml PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ACML -DHAS_LAPACK=1 -DPUREBLAS")
|
||||
endif(BUILD_btl_acml)
|
||||
endif (ACML_FOUND)
|
||||
|
@ -248,7 +248,15 @@ public :
|
||||
}
|
||||
|
||||
static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
|
||||
#ifdef PUREBLAS
|
||||
{
|
||||
int N2 = N*N;
|
||||
int inc = 1;
|
||||
scopy_(&N2, X, &inc, C, &inc);
|
||||
}
|
||||
#else
|
||||
cblas_scopy(N*N, X, 1, C, 1);
|
||||
#endif
|
||||
int info = 0;
|
||||
int ilo = 1;
|
||||
int ihi = N;
|
||||
@ -260,7 +268,15 @@ public :
|
||||
}
|
||||
|
||||
static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
|
||||
#ifdef PUREBLAS
|
||||
{
|
||||
int N2 = N*N;
|
||||
int inc = 1;
|
||||
scopy_(&N2, X, &inc, C, &inc);
|
||||
}
|
||||
#else
|
||||
cblas_scopy(N*N, X, 1, C, 1);
|
||||
#endif
|
||||
char uplo = 'U';
|
||||
int info = 0;
|
||||
int ilo = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user