[eigen] patch to add ACML support to BTL

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi.
Please find attached a patch that fixes some inconsistencies in C_BLAS
interface and adds btl_acml test as well as a FindACML.cmake file (to be
put in bench/cmake). Please double check the patch file as I've
commented out a couple of lines to make it build on my machine - there
seem to be some missing headers in bench/btl/actions, namely I suspect
action_ssyr2.

Sincerely,
Victor Prosolin.
# 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)
Index: bench/btl/libs/STL/main.cpp
===================================================================
--- bench/btl/libs/STL/main.cpp	(revision 935435)
+++ bench/btl/libs/STL/main.cpp	(working copy)
@@ -31,7 +31,7 @@
   bench<Action_matrix_vector_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
   bench<Action_atv_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
   bench<Action_symv<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
-  bench<Action_syr2<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
+//   bench<Action_syr2<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
   bench<Action_matrix_matrix_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
   bench<Action_ata_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
   bench<Action_aat_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
Index: bench/btl/libs/C_BLAS/C_BLAS_interface.hh
===================================================================
--- bench/btl/libs/C_BLAS/C_BLAS_interface.hh	(revision 935435)
+++ bench/btl/libs/C_BLAS/C_BLAS_interface.hh	(working copy)
@@ -248,7 +248,15 @@
   }
 
   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 @@
   }
 
   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;
Index: bench/btl/libs/C_BLAS/main.cpp
===================================================================
--- bench/btl/libs/C_BLAS/main.cpp	(revision 935435)
+++ bench/btl/libs/C_BLAS/main.cpp	(working copy)
@@ -41,7 +41,7 @@
   bench<Action_matrix_vector_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
   bench<Action_atv_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
   bench<Action_symv<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
-  bench<Action_syr2<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
+//   bench<Action_syr2<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
 
   bench<Action_matrix_matrix_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
   bench<Action_ata_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
Index: bench/btl/libs/C_BLAS/CMakeLists.txt
===================================================================
--- bench/btl/libs/C_BLAS/CMakeLists.txt	(revision 935435)
+++ bench/btl/libs/C_BLAS/CMakeLists.txt	(working copy)
@@ -28,3 +28,14 @@
     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)
begin:vcard
fn:Victor Prosolin
n:Prosolin;Victor
org:University of Calgary;Department of Physics and Astronomy
title:PhD student
version:2.1
end:vcard



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/