aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/btl
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-03-05 08:11:47 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-03-05 08:11:47 +0000
commita72ff5abc1a259c4d4510437a53acd7d47dd6e19 (patch)
treeae3ea873466072d39c353b54dc1e1ebd4f83837e /bench/btl
parent6a265063417db175eb436e6bcc0e3e74780a1b2f (diff)
BTL: - patch from Victor (add ACML support)
- fix overflow issues
Diffstat (limited to 'bench/btl')
-rw-r--r--bench/btl/actions/action_cholesky.hh10
-rw-r--r--bench/btl/actions/action_hessenberg.hh4
-rw-r--r--bench/btl/actions/action_lu_decomp.hh8
-rw-r--r--bench/btl/actions/action_trisolve.hh2
-rw-r--r--bench/btl/actions/action_trisolve_matrix.hh6
-rw-r--r--bench/btl/cmake/FindACML.cmake60
-rw-r--r--bench/btl/libs/C_BLAS/CMakeLists.txt11
-rw-r--r--bench/btl/libs/C_BLAS/C_BLAS_interface.hh16
8 files changed, 102 insertions, 15 deletions
diff --git a/bench/btl/actions/action_cholesky.hh b/bench/btl/actions/action_cholesky.hh
index 67495b9cb..a1a30977c 100644
--- a/bench/btl/actions/action_cholesky.hh
+++ b/bench/btl/actions/action_cholesky.hh
@@ -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
diff --git a/bench/btl/actions/action_hessenberg.hh b/bench/btl/actions/action_hessenberg.hh
index 3cb5034e4..1de43c22c 100644
--- a/bench/btl/actions/action_hessenberg.hh
+++ b/bench/btl/actions/action_hessenberg.hh
@@ -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;
}
}
diff --git a/bench/btl/actions/action_lu_decomp.hh b/bench/btl/actions/action_lu_decomp.hh
index cf455e87f..147884e76 100644
--- a/bench/btl/actions/action_lu_decomp.hh
+++ b/bench/btl/actions/action_lu_decomp.hh
@@ -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
diff --git a/bench/btl/actions/action_trisolve.hh b/bench/btl/actions/action_trisolve.hh
index f97f7dbc9..0d277eb77 100644
--- a/bench/btl/actions/action_trisolve.hh
+++ b/bench/btl/actions/action_trisolve.hh
@@ -130,7 +130,7 @@ private :
typename Interface::gene_vector B;
int _size;
- int _cost;
+ double _cost;
};
#endif
diff --git a/bench/btl/actions/action_trisolve_matrix.hh b/bench/btl/actions/action_trisolve_matrix.hh
index 18813a016..0fc2bb9ef 100644
--- a/bench/btl/actions/action_trisolve_matrix.hh
+++ b/bench/btl/actions/action_trisolve_matrix.hh
@@ -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);
diff --git a/bench/btl/cmake/FindACML.cmake b/bench/btl/cmake/FindACML.cmake
new file mode 100644
index 000000000..c530dbf90
--- /dev/null
+++ b/bench/btl/cmake/FindACML.cmake
@@ -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)
diff --git a/bench/btl/libs/C_BLAS/CMakeLists.txt b/bench/btl/libs/C_BLAS/CMakeLists.txt
index d567a00d0..ec6a74aa1 100644
--- a/bench/btl/libs/C_BLAS/CMakeLists.txt
+++ b/bench/btl/libs/C_BLAS/CMakeLists.txt
@@ -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)
diff --git a/bench/btl/libs/C_BLAS/C_BLAS_interface.hh b/bench/btl/libs/C_BLAS/C_BLAS_interface.hh
index a726fa89d..db02c2e2e 100644
--- a/bench/btl/libs/C_BLAS/C_BLAS_interface.hh
+++ b/bench/btl/libs/C_BLAS/C_BLAS_interface.hh
@@ -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;