Commit df17b9ce authored by berenger-bramas's avatar berenger-bramas

Update the cmake (and the blas file)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@342 2616d619-271b-44dc-8df4-d4a8f33a7222
parent e952807f
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 2.8)
# check if compiling into source directories
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
......@@ -13,7 +13,6 @@ project(scalfmm)
# -----------------------
ENABLE_LANGUAGE(CXX )
# Options
OPTION( SCALFMM_USE_CBLAS "Set to ON to build ScaFMM with BLAS" OFF )
OPTION( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" OFF )
......@@ -62,7 +61,7 @@ if( SCALFMM_USE_CBLAS )
SET(CBLAS_LIBRARIES "-L$ENV{MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core")
else()
FIND_PACKAGE(BLAS)
SET(CBLAS_LIBRARIES "-lcblas")
SET(BLAS_LIBRARIES "-lcblas")
endif()
endif()
......
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
# check if compiling into source directories
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
......@@ -25,6 +25,12 @@ add_library(
${source_lib_files}
)
# Add blas library (even if it is set to off)
target_link_libraries(
scalfmm
${BLAS_LIBRARIES}
)
# Adding the entire project dir as an include dir
INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}/Src
......
......@@ -12,6 +12,8 @@
#include "FGlobal.hpp"
#ifdef SCALFMM_USE_CBLAS
#ifdef SCALFMM_USE_MKL_AS_BLAS
......@@ -19,24 +21,43 @@
#else
#include <cblas.h>
#endif
#else
enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102};
enum CBLAS_TRANSPOSE {CblasNoTrans, CblasTrans, CblasConjTrans};
#endif
template <typename T>
void cblas_gemv(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const void *alpha , const void *A , const int lda ,
const void *X , const int incX , const void *beta ,
void *Y , const int incY){
}
template <typename T>
void cblas_dotu_sub( const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
}
#ifdef SCALFMM_USE_CBLAS
///////////////////////////////////////////////////////
// GEMV
///////////////////////////////////////////////////////
void cblas_gemv(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const double *alpha , const double *A , const int lda ,
const double *X , const int incX , const double *beta ,
double *Y , const int incY){
template <>
void cblas_gemv<double>(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const void *alpha , const void *A , const int lda ,
const void *X , const int incX , const void *beta ,
void *Y , const int incY){
cblas_zgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY);
}
void cblas_gemv(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const float *alpha , const float *A , const int lda ,
const float *X , const int incX , const float *beta ,
float *Y , const int incY){
template <>
void cblas_gemv<float>(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const void *alpha , const void *A , const int lda ,
const void *X , const int incX , const void *beta ,
void *Y , const int incY){
cblas_cgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY);
}
......@@ -45,33 +66,21 @@
// Dotu
///////////////////////////////////////////////////////
void cblas_dotu_sub(const int N , const double *X , const int incX ,
const double *Y , const int incY , double *dotu){
template <>
void cblas_dotu_sub<double>(const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
cblas_zdotu_sub(N,X,incX,Y,incY,dotu);
}
void cblas_dotu_sub(const int N , const float *X , const int incX ,
const float *Y , const int incY , float *dotu){
template <>
void cblas_dotu_sub<float>(const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
cblas_cdotu_sub(N,X,incX,Y,incY,dotu);
}
#else
enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102};
enum CBLAS_TRANSPOSE {CblasNoTrans, CblasTrans, CblasConjTrans};
#endif //SCALFMM_USE_CBLAS
template <typename T>
void cblas_gemv(const CBLAS_ORDER order ,
const CBLAS_TRANSPOSE TransA , const int M , const int N ,
const void *alpha , const void *A , const int lda ,
const void *X , const int incX , const void *beta ,
void *Y , const int incY){
}
template <typename T>
void cblas_dotu_sub( const int N , const void *X , const int incX ,
const void *Y , const int incY , void *dotu){
}
#endif //SCALFMM_USE_CBLAS
#endif //FBLAS_HPP
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 2.8)
# check if compiling into source directories
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment