Commit 279c1e79 authored by Michael Turner's avatar Michael Turner

merge native blas, acml, accelerate and openblas

parent 18d09be6
......@@ -193,9 +193,6 @@ CMAKE_DEPENDENT_OPTION(NEKTAR_USE_MKL
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ACCELERATE_FRAMEWORK
"Use the Mac Accelerate Framework for BLAS and Lapack support." ON
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK; APPLE" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_WIN32_LAPACK
"Use Win32 Lapack provided with the Third Party Distribution."
ON "NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK; WIN32" OFF)
# Memory pools
OPTION(NEKTAR_USE_MEMORY_POOLS
......@@ -254,25 +251,13 @@ IF( NEKTAR_USE_MKL )
INCLUDE (FindMKL)
ENDIF( NEKTAR_USE_MKL )
IF( NEKTAR_USE_OPENBLAS )
INCLUDE (FindOpenBlas)
ENDIF( NEKTAR_USE_OPENBLAS )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK OR
NEKTAR_USE_OPENBLAS OR
NEKTAR_USE_ACCELERATE_FRAMEWORK OR
NEKTAR_USE_ACML)
IF( NEKTAR_USE_ACCELERATE_FRAMEWORK )
INCLUDE (FindAccelerateFramework)
ENDIF( NEKTAR_USE_ACCELERATE_FRAMEWORK )
IF( NEKTAR_USE_ACML )
INCLUDE (FindACML)
ENDIF( NEKTAR_USE_ACML )
IF( NEKTAR_USE_WIN32_LAPACK )
INCLUDE (FindWin32Lapack)
ENDIF( NEKTAR_USE_WIN32_LAPACK )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
INCLUDE(ThirdPartyBlasLapack)
ENDIF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
INCLUDE(ThirdPartyBlasLapack)
ENDIF()
IF( NEKTAR_USE_TINYXML_STL )
ADD_DEFINITIONS( -DTIXML_USE_STL)
......
SET(ACML_USE_SHARED_LIBRARIES OFF CACHE BOOL "Use the ACLM shared library." )
SET(ACML_USE_OPENMP_LIBRARIES ON CACHE BOOL "Use the OpenMP implementation.")
MACRO(RESET_VAR_IF_CHANGED toChange toCheck)
IF( NOT ACML_${toCheck}_PREV_VALUE )
IF( ${toCheck} )
SET(NEED_TO_CLEAR TRUE)
ENDIF( ${toCheck} )
ENDIF( NOT ACML_${toCheck}_PREV_VALUE )
IF( NOT ${toCheck} )
IF( ACML_${toCheck}_PREV_VALUE )
SET(NEED_TO_CLEAR TRUE)
ENDIF( ACML_${toCheck}_PREV_VALUE )
ENDIF( NOT ${toCheck} )
IF( NEED_TO_CLEAR )
SET(${toChange} "NOTFOUND" CACHE PATH "" FORCE)
ENDIF( NEED_TO_CLEAR )
SET(ACML_${toCheck}_PREV_VALUE ${${toCheck}} CACHE INTERNAL "" FORCE)
ENDMACRO(RESET_VAR_IF_CHANGED toChange)
RESET_VAR_IF_CHANGED( ACML_INCLUDE_PATH ACML_USE_OPENMP_LIBRARIES)
RESET_VAR_IF_CHANGED( ACML_INCLUDE_PATH ACML_USE_SHARED_LIBRARIES)
RESET_VAR_IF_CHANGED( ACML ACML_USE_OPENMP_LIBRARIES)
RESET_VAR_IF_CHANGED( ACML ACML_USE_SHARED_LIBRARIES)
RESET_VAR_IF_CHANGED( ACML_SEARCH_PATHS ACML_USE_OPENMP_LIBRARIES)
RESET_VAR_IF_CHANGED( ACML_SEARCH_PATHS ACML_USE_SHARED_LIBRARIES)
SET(ACML_BASE_SEARCH_PATHS "/opt/acml" "C:\\AMD\\acml" "C:\\Program Files\\AMD\\acml")
SET(ACML_SEARCH_PATHS "")
SET(MP_COMPILER_VERSIONS gfortran64_mp gfortran64_mp_int64 pgi32_mp ifort32_mp)
SET(COMPILER_VERSIONS gfortran64 gfortran64_int64 pgi32 ifort32)
SET(COMPILER_VERSION_TO_USE "a")
IF( ACML_USE_OPENMP_LIBRARIES )
SET(COMPILER_VERSION_TO_USE ${MP_COMPILER_VERSIONS})
ELSE( ACML_USE_OPENMP_LIBRARIES )
SET(COMPILER_VERSION_TO_USE ${COMPILER_VERSIONS})
ENDIF( ACML_USE_OPENMP_LIBRARIES )
FOREACH(path_iter ${ACML_BASE_SEARCH_PATHS})
FILE( GLOB install_path ${path_iter}*/ACML-EULA.txt )
IF (install_path)
LIST( GET install_path 0 install_path)
GET_FILENAME_COMPONENT( install_path ${install_path} PATH)
FOREACH(compiler_iter ${COMPILER_VERSION_TO_USE})
LIST(APPEND ACML_SEARCH_PATHS
${install_path}/${compiler_iter}/include)
ENDFOREACH(compiler_iter ${COMPILER_VERSION_TO_USE})
ENDIF (install_path)
ENDFOREACH(path_iter ${ACML_BASE_SEARCH_PATHS})
FIND_PATH(ACML_INCLUDE_PATH acml.h ${ACML_SEARCH_PATHS} )
SET(ACML_LIB_PATH ${ACML_INCLUDE_PATH}/../lib)
IF( ACML_USE_SHARED_LIBRARIES )
IF( ACML_USE_OPENMP_LIBRARIES )
SET(ACML_LIB_NAMES acml_mp acml_mp_dll libacml_mp_dll)
ELSE( ACML_USE_OPENMP_LIBRARIES )
SET(ACML_LIB_NAMES acml acml_dll libacml_dll)
ENDIF( ACML_USE_OPENMP_LIBRARIES )
ELSE( ACML_USE_SHARED_LIBRARIES )
IF( ACML_USE_OPENMP_LIBRARIES )
SET(ACML_LIB_NAMES acml_mp libacml_mp)
ELSE( ACML_USE_OPENMP_LIBRARIES )
SET(ACML_LIB_NAMES acml libacml)
ENDIF( ACML_USE_OPENMP_LIBRARIES )
ENDIF( ACML_USE_SHARED_LIBRARIES )
FIND_LIBRARY( ACML NAMES ${ACML_LIB_NAMES} PATHS ${ACML_LIB_PATH} )
IF( ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" )
SET( ACML_TARGET_LINK_LIBRARIES ${ACML} gfortran )
ELSE( ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" )
SET( ACML_TARGET_LINK_LIBRARIES ${ACML} )
ENDIF( ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" )
IF (ACML_INCLUDE_PATH)
SET(ACML_FOUND ON)
ENDIF (ACML_INCLUDE_PATH)
IF (ACML_FOUND)
IF (NOT ACML_FIND_QUIETLY)
MESSAGE(STATUS "Found ACML: ${ACML_INCLUDE_PATH}")
ENDIF (NOT ACML_FIND_QUIETLY)
ELSE(ACML_FOUND)
IF (ACML_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ACML")
ENDIF (ACML_FIND_REQUIRED)
ENDIF (ACML_FOUND)
MARK_AS_ADVANCED(ACML ACML_INCLUDE_PATH ACML_SEARCH_PATHS
ACML_USE_OPENMP_LIBRARIES ACML_USE_SHARED_LIBRARIES)
FIND_PATH(ACCELERATE_FRAMEWORK_INCLUDE_DIR cblas.h /usr/include /usr/local/include
/System/Library/Frameworks/vecLib.framework/Versions/A/Headers/ )
MARK_AS_ADVANCED(ACCELERATE_FRAMEWORK_INCLUDE_DIR)
SET( ACCELERATE_FRAMEWORK_LINK_FLAGS "-framework Accelerate" )
IF (ACCELERATE_FRAMEWORK_FOUND)
IF (NOT ACCELERATE_FRAMEWORK_FIND_QUIETLY)
MESSAGE(STATUS "Found ACCELERATE_FRAMEWORK: ${ACCELERATE_FRAMEWORK_INCLUDE_DIR}")
ENDIF (NOT ACCELERATE_FRAMEWORK_FIND_QUIETLY)
ELSE(ACCELERATE_FRAMEWORK_FOUND)
IF (ACCELERATE_FRAMEWORK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ACCELERATE_FRAMEWORK")
ENDIF (ACCELERATE_FRAMEWORK_FIND_REQUIRED)
ENDIF (ACCELERATE_FRAMEWORK_FOUND)
FIND_PATH(ATLAS_INCLUDE_DIR cblas.h /usr/include /usr/local/include /usr/local/include/atlas)
#FIND_LIBRARY( BOOST_UNIT_TEST_LIB NAMES boost_unit_test_framework
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
#FIND_LIBRARY( BOOST_PROGRAM_OPTIONS_LIB NAMES boost_program_options
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
#FIND_LIBRARY( BOOST_FILESYSTEM_LIB NAMES boost_filesystem
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
SET(ATLAS_LIB_SEARCH_DIRS /usr/lib/sse2 /usr/lib/atlas/sse2 /usr/local/lib/atlas)
FIND_LIBRARY( ATLAS NAMES atlas PATHS ${ATLAS_LIB_SEARCH_DIRS})
FIND_LIBRARY( ATLAS_CBLAS NAMES cblas PATHS ${ATLAS_LIB_SEARCH_DIRS})
FIND_LIBRARY( ATLAS_LAPACK NAMES lapack PATHS ${ATLAS_LIB_SEARCH_DIRS})
SET( ATLAS_INCLUDE_FILE ${ATLAS_INCLUDE_DIR}/cblas.h )
IF (ATLAS_INCLUDE_DIR)
SET(ATLAS_FOUND ON)
ENDIF (ATLAS_INCLUDE_DIR)
IF (ATLAS_FOUND)
IF (NOT ATLAS_FIND_QUIETLY)
MESSAGE(STATUS "Found ATLAS: ${ATLAS_INCLUDE_DIR}")
ENDIF (NOT ATLAS_FIND_QUIETLY)
ELSE(ATLAS_FOUND)
IF (ATLAS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ATLAS")
ENDIF (ATLAS_FIND_REQUIRED)
ENDIF (ATLAS_FOUND)
IF(NEKTAR_USE_SYSTEM_BLAS_LAPACK)
SET(TEST_ENV $ENV{LAPACK_DIR})
IF(NOT DEFINED LAPACK_DIR AND DEFINED TEST_ENV)
SET(LAPACK_DIR $ENV{LAPACK_DIR})
ENDIF()
SET(TEST_ENV $ENV{BLAS_DIR})
IF(NOT DEFINED BLAS_DIR AND DEFINED TEST_ENV)
SET(BLAS_DIR $ENV{BLAS_DIR})
ENDIF()
SET(VENDOR Generic)
ELSEIF(NEKTAR_USE_OPENBLAS)
SET(TEST_ENV $ENV{OPENBLAS_HOME})
IF(NOT DEFINED BLAS_DIR AND DEFINED TEST_ENV)
SET(BLAS_DIR $ENV{OPENBLAS_HOME})
ENDIF()
IF(NOT DEFINED LAPACK_DIR AND DEFINED TEST_ENV)
SET(LAPACK_DIR $ENV{OPENBLAS_HOME})
ENDIF()
SET(VENDOR OpenBLAS)
ELSEIF(NEKTAR_USE_ACCELERATE_FRAMEWORK)
SET(VENDOR Apple)
ELSEIF(NEKTAR_USE_ACML)
SET(VENDOR ACML)
ENDIF()
SET(BLA_VENDOR ${VENDOR})
find_package(BLAS QUIET)
find_package(LAPACK QUIET)
IF(NEKTAR_USE_SYSTEM_BLAS_LAPACK)
SET(BLAS_LAPACK ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
ELSE()
SET(BLAS_LAPACK ${LAPACK_LIBRARIES})
ENDIF()
IF (BLAS_LAPACK)
MESSAGE(STATUS "Found Blas and Lapack")
ELSE()
IF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Native blas and lapack libraries.")
ENDIF ()
ENDIF ()
SET(TEST_ENV $ENV{LAPACK_DIR})
IF(NOT DEFINED LAPACK_DIR AND DEFINED TEST_ENV)
SET(LAPACK_DIR $ENV{LAPACK_DIR})
ENDIF()
SET(TEST_ENV $ENV{BLAS_DIR})
IF(NOT DEFINED BLAS_DIR AND DEFINED TEST_ENV)
SET(BLAS_DIR $ENV{BLAS_DIR})
ENDIF()
SET(BLA_VENDOR Generic)
find_package(BLAS QUIET)
find_package(LAPACK QUIET)
IF (BLAS_FOUND AND LAPACK_FOUND)
SET(NATIVE_BLAS_LAPACK_FOUND ON)
ENDIF ()
IF (NATIVE_BLAS_LAPACK_FOUND)
MESSAGE(STATUS "Found Native Blas and Lapack")
ELSE(NATIVE_BLAS_LAPACK_FOUND)
IF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Native blas and lapack libraries.")
ENDIF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
ENDIF (NATIVE_BLAS_LAPACK_FOUND)
SET(OPEN_BLAS_SEARCH_PATHS /lib/ /lib64/ /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 /opt/OpenBLAS/lib $ENV{OPENBLAS_HOME}/lib )
FIND_LIBRARY(OPENBLAS NAMES openblas PATHS ${OPEN_BLAS_SEARCH_PATHS})
IF (OPENBLAS)
SET(OPENBLAS_FOUND ON)
ENDIF (OPENBLAS)
IF (OPENBLAS_FOUND)
# IF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenBLAS")
# ENDIF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
ELSE(OPENBLAS_FOUND)
# IF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find OpenBLAS libraries.")
# ENDIF (NATIVE_BLAS_LAPACK_FIND_REQUIRED)
ENDIF (OPENBLAS_FOUND)
MARK_AS_ADVANCED(OPENBLAS)
......@@ -7,15 +7,15 @@
########################################################################
INCLUDE(FindNativeBlasLapack)
INCLUDE(FindBlasLapack)
IF(NATIVE_BLAS_LAPACK_FOUND)
IF(LAPACK_FOUND)
SET(BUILD_BLAS_LAPACK OFF)
ELSE()
IF(CMAKE_Fortran_COMPILER)
IF(CMAKE_Fortran_COMPILER AND NATIVE_BLAS_LAPACK_FIND_REQUIRED)
SET(BUILD_BLAS_LAPACK ON)
ELSE()
MESSAGE(SEND_ERROR "No blas installation or fortran compiler found")
MESSAGE(SEND_ERROR "No blas/lapack installation found and cannot self build")
ENDIF()
ENDIF()
......@@ -46,14 +46,7 @@ IF(THIRDPARTY_BUILD_BLAS_LAPACK)
${TPSRC}/lapack-3.7.0
)
SET(NATIVE_BLAS blas CACHE FILEPATH "BLAS library" FORCE)
SET(NATIVE_LAPACK lapack CACHE FILEPATH "LAPACK library" FORCE)
SET(NATIVE_BLAS_LIB_DIR ${TPDIST}/lib CACHE FILEPATH "BLAS library dir" FORCE)
SET(NATIVE_LAPACK_LIB_DIR ${TPDIST}/lib CACHE FILEPATH "LAPACK library dir" FORCE)
MARK_AS_ADVANCED(NATIVE_BLAS)
MARK_AS_ADVANCED(NATIVE_LAPACK)
MARK_AS_ADVANCED(NATIVE_BLAS_LIB_DIR)
MARK_AS_ADVANCED(NATIVE_LAPACK_LIB_DIR)
SET(BLAS_LAPACK ${NATIVE_BLAS} ${NATIVE_LAPACK})
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include)
......
......@@ -54,8 +54,6 @@ IF (NEKTAR_USE_PETSC)
IF( NEKTAR_USE_BLAS_LAPACK )
IF( NEKTAR_USE_MKL AND MKL_FOUND )
SET(PETSC_MUMPS ${PETSC_MUMPS} --with-blas-lapack-dir=${MKL_LIB_DIR})
ELSEIF( NEKTAR_USE_WIN32_LAPACK )
SET(PETSC_MUMPS ${PETSC_MUMPS} --with-blas-lapack-dir=${LAPACK_DIR})
ELSEIF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
SET(PETSC_MUMPS ${PETSC_MUMPS} --with-blas-lapack-dir=${NATIVE_LAPACK_LIB_DIR})
IF(THIRDPARTY_BUILD_BLAS_LAPACK)
......
......@@ -418,27 +418,9 @@ IF( NEKTAR_USE_MKL AND MKL_FOUND )
PROPERTIES COMPILE_FLAGS "${THE_COMPILE_FLAGS} -DMKL_ILP64")
ENDIF( NEKTAR_USE_MKL AND MKL_FOUND )
IF( NEKTAR_USE_ACML AND ACML_FOUND )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${ACML_TARGET_LINK_LIBRARIES} )
ENDIF( NEKTAR_USE_ACML AND ACML_FOUND )
IF( NEKTAR_USE_ACCELERATE_FRAMEWORK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${ACCELERATE_FRAMEWORK_LINK_FLAGS})
ENDIF ( NEKTAR_USE_ACCELERATE_FRAMEWORK )
IF( NEKTAR_USE_WIN32_LAPACK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${WIN32_LAPACK} ${WIN32_BLAS})
INSTALL(FILES ${WIN32_LAPACK_DLL} ${WIN32_BLAS_DLL}
DESTINATION ${NEKTAR_BIN_DIR})
ENDIF( NEKTAR_USE_WIN32_LAPACK )
IF( NEKTAR_USE_OPENBLAS AND OPENBLAS_FOUND )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${OPENBLAS})
ENDIF( NEKTAR_USE_OPENBLAS AND OPENBLAS_FOUND )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
ENDIF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK OR NEKTAR_USE_OPENBLAS OR NEKTAR_USE_ACCELERATE_FRAMEWORK)
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${BLAS_LAPACK})
ENDIF( )
IF(THIRDPARTY_BUILD_BLAS_LAPACK)
ADD_DEPENDENCIES(LibUtilities lapack-3.7.0)
......
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