Commit 16b3a43f authored by PRUVOST Florent's avatar PRUVOST Florent

add the ability to use BLAS/LAPACK/FFTW from IBM ESSL

parent 26421d22
......@@ -329,7 +329,8 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
# SYMBOLS init testPPM:init)
message(STATUS "CMAKE_CXX_COMPILER_ID STREQUAL ${CMAKE_CXX_COMPILER_ID}")
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL CBLAS" OFF )
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( SCALFMM_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
if( SCALFMM_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
......@@ -338,6 +339,16 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
if (BLAS_LIBRARIES)
set(BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_ESSL_AS_BLAS)
set(BLA_VENDOR "IBMESSL")
find_package(BLASEXT QUIET) # not REQUIRED
find_package(LAPACKEXT QUIET) # not REQUIRED
if (LAPACK_LIBRARIES)
set(BLASLAPACK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
if (BLAS_LIBRARIES)
list(APPEND BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_EXTERNAL_BLAS)
message(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
......@@ -363,6 +374,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
endif()
message (STATUS "check BLAS Fortran mangling")
# check blas and lapack symbols naming
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
check_function_exists(dgemv_ DGEMV_ADD_)
......@@ -404,28 +416,25 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
# FFT option
#
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_MKL_AS_FFTW "Set to ON to use MKL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_MKL_AS_BLAS" OFF )
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_ESSL_AS_FFTW "Set to ON to use ESSL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_ESSL_AS_BLAS" OFF )
if( SCALFMM_USE_FFT )
message(STATUS "SCALFMM USE FFT Configure:")
# The package find_package(FFTW) can be used with the following COMPONENTS:
# MKL, ESSL, THREADS|OMP and/or SIMPLE|LONG|QUAD
# Default will find the real double precision fftw library version without THREADS|OMP
if( SCALFMM_USE_MKL_AS_FFTW )
message(STATUS " SCALFMM USE MKL ")
if( SCALFMM_USE_MKL_AS_BLAS )
unset(FFT_LIBRARIES CACHE)
message(STATUS " SCALFMM USE MKL already defined")
set(FFT_INCLUDES "$ENV{MKLROOT}/include/fftw" CACHE STRING "Set your MKL flags")
if (BLAS_FOUND)
set(FFTW_FOUND ON)
message(STATUS " SCALFMM USE FFT from MKL")
find_package(FFTW COMPONENTS MKL)
elseif (SCALFMM_USE_ESSL_AS_FFTW)
message(STATUS " SCALFMM USE FFT from ESSL ")
find_package(FFTW COMPONENTS ESSL)
add_definitions(-DSCALFMM_USE_ESSL_AS_FFTW)
else()
message(STATUS " SCALFMM USE FFTW")
find_package(FFTW COMPONENTS SIMPLE)
endif()
else(SCALFMM_USE_MKL_AS_BLAS)
# The package can be used with the following COMPONENTS:
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW COMPONENTS MKL) # not REQUIRED
if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
endif()
......@@ -434,57 +443,31 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
endforeach()
endif()
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}")
endif()
endif(SCALFMM_USE_MKL_AS_BLAS)
else(SCALFMM_USE_MKL_AS_FFTW)
message(STATUS " SCALFMM USE FFTW ")
# The package can be used with the following COMPONENTS:
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW COMPONENTS SIMPLE) # not REQUIRED
if (FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your FFTW path")
endif()
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};")
endforeach()
endif()
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFT_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}")
endif()
if(FFTW_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${FFTW_LIBRARY_DIRS}")
endif()
endif(SCALFMM_USE_MKL_AS_FFTW)
if (FFT_INCLUDES)
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${FFT_INCLUDES}")
endif()
if(FFTW_FOUND)
message(STATUS " SCALFMM_LIBRARIES = ${SCALFMM_LIBRARIES}")
message(STATUS " SCALFMM_INCLUDES = ${SCALFMM_INCLUDES}")
else()
if(NOT FFTW_FOUND)
message(WARNING "FFTW has not been found, SCALFMM will continue to compile but some applications will be disabled.")
message(WARNING "If you have FFTW set FFTW_LIBDIR, FFTW_INCDIR or FFTW_DIR (CMake variables using -D or environment variables).")
set(SCALFMM_USE_FFT OFF)
endif()
endif(SCALFMM_USE_FFT)
list(APPEND FUSE_LIST "FFT")
message(STATUS " SCALFMM_LIBRARIES = ${SCALFMM_LIBRARIES}")
message(STATUS " SCALFMM_INCLUDES = ${SCALFMM_INCLUDES}")
message(STATUS "SCALFMM_USE_FFT = ${SCALFMM_USE_FFT}")
list(REMOVE_DUPLICATES SCALFMM_INCLUDES)
list(REMOVE_DUPLICATES SCALFMM_LIBRARIES)
#
# C++ 2011
......
......@@ -38,6 +38,7 @@
#cmakedefine SCALFMM_USE_FFT
#cmakedefine SCALFMM_USE_MKL_AS_FFTW
#cmakedefine SCALFMM_USE_ESSL_AS_FFTW
//////////////////////////////////////////////////////
// MPI
......
......@@ -26,10 +26,11 @@
#include <iostream>
#include <stdlib.h>
// include fftw3 (specify path in cmake)
// if MKL: path/to/mkl/include/fftw/fftw3.h
// elseif libfftw_dev: usr/include/fftw3.h
#ifdef SCALFMM_USE_ESSL_AS_FFTW
#include <fftw3_essl.h>
#else
#include <fftw3.h>
#endif
// for @class FDft only
#include "FBlas.hpp"
......
......@@ -21,7 +21,11 @@
#include <iostream>
#include <stdlib.h>
#ifdef SCALFMM_USE_ESSL_AS_FFTW
#include <fftw3_essl.h>
#else
#include <fftw3.h>
#endif
#include "Utils/FGlobal.hpp"
#include "Utils/FComplex.hpp"
......
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