Commit e90793d6 by Chris Cantwell

Merge branch 'feature/cmake-blas' into 'master'

feature/cmake-blas

Closes #72 and #74

See merge request !865
parents c06f50f3 efc56d8b
......@@ -54,15 +54,6 @@ INCLUDE(CMakeParseArguments)
# Enable CTest.
ENABLE_TESTING()
# Use the CMake 2.4 policy for CMake 2.6
IF(COMMAND cmake_policy)
# Silence warnings when using generator expressions in
# TARGET_LINK_LIBRARIES.
IF(POLICY CMP0022)
CMAKE_POLICY(SET CMP0022 NEW)
ENDIF()
ENDIF(COMMAND cmake_policy)
# Find the modules included with Nektar
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
......@@ -129,10 +120,6 @@ SET(NEKTAR_LIBRARY_TYPE "SHARED")
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
IF (APPLE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
ENDIF()
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
......@@ -175,26 +162,6 @@ IF (${CMAKE_COMPILER_IS_GNUCXX})
MARK_AS_ADVANCED(NEKTAR_ENABLE_PROFILE)
ENDIF (${CMAKE_COMPILER_IS_GNUCXX})
# BLAS Support
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SYSTEM_BLAS_LAPACK
"Use the system provided blas and lapack libraries" ON
"UNIX; NOT APPLE; NOT NEKTAR_USE_OPENBLAS; NOT NEKTAR_USE_MKL; NOT NEKTAR_USE_ACML; NOT NEKTAR_USE_ACCELERATE_FRAMEWORK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_OPENBLAS
"Use OpenBLAS library as a substitute to native BLAS." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ACML
"Use the AMD Core Math Library (ACML) for BLAS and Lapack support." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_MKL
"Use the Intel Math Kernel Library (MKL) for BLAS and Lapack support." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
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
"Use memory pools to accelerate memory allocation." ON)
......@@ -246,35 +213,12 @@ INCLUDE (ThirdPartyOCE)
INCLUDE (ThirdPartyTriangle)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyCCM)
INCLUDE (ThirdPartyBlasLapack)
INCLUDE (ThirdPartyCwipi)
INCLUDE (FindCFI)
INCLUDE (Doxygen)
IF( NEKTAR_USE_MKL )
INCLUDE (FindMKL)
ENDIF( NEKTAR_USE_MKL )
IF( NEKTAR_USE_OPENBLAS )
INCLUDE (FindOpenBlas)
ENDIF( NEKTAR_USE_OPENBLAS )
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 )
IF( NEKTAR_USE_TINYXML_STL )
ADD_DEFINITIONS( -DTIXML_USE_STL)
ENDIF( NEKTAR_USE_TINYXML_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_MKL)
# Deal with MKL due to issues with FindBLAS VENDOR variable.
INCLUDE (FindMKL)
ELSEIF(NEKTAR_USE_WIN32_LAPACK)
INCLUDE (FindWin32Lapack)
ELSE()
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 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()
IF(VENDOR)
SET(BLA_VENDOR ${VENDOR})
find_package(LAPACK QUIET)
SET(BLAS_LAPACK ${LAPACK_LIBRARIES} CACHE INTERNAL "BLAS/LAPACK location")
ENDIF()
ENDIF()
FIND_PATH(MKL_INCLUDE_DIR mkl_cblas.h
HINTS $ENV{MKL_HOME}/include $ENV{MKLROOT}/include
)
IF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
SET(INTEL_LIBDIR "intel64")
ELSE ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
......@@ -14,74 +9,58 @@ FIND_LIBRARY(MKL_LAPACK
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR} $ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
IF ( MKL_LAPACK_FOUND )
# old MKL versions
IF ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
FIND_LIBRARY(MKL
NAMES mkl_ia64
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
ELSE ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
FIND_LIBRARY(MKL
NAMES mkl_ia32
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
ENDIF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
FIND_LIBRARY(MKL_GUIDE
NAMES guide
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
SET (MKL ${MKL} ${MKL_LAPACK} ${MKL_GUIDE} )
SET (BLAS_LAPACK ${MKL} ${MKL_LAPACK} ${MKL_GUIDE} CACHE INTERNAL "BLAS/LAPACK location (MKL)")
ELSE (MKL_LAPACK_FOUND )
# newer MKL version
SET (MKL_LAPACK "")
FIND_LIBRARY(MKL_INTEL
NAMES mkl_intel_lp64
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
FIND_LIBRARY(MKL_SEQUENTIAL
NAMES mkl_sequential
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
FIND_LIBRARY(MKL_CORE
NAMES mkl_core
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
HINTS $ENV{MKL_HOME}/lib/${INTEL_LIBDIR}
$ENV{MKLROOT}/lib/${INTEL_LIBDIR}
)
SET (MKL ${MKL_INTEL} ${MKL_SEQUENTIAL} ${MKL_CORE} )
SET (BLAS_LAPACK ${MKL_INTEL} ${MKL_SEQUENTIAL} ${MKL_CORE} CACHE INTERNAL "BLAS/LAPACK location (MKL)")
ENDIF ( MKL_LAPACK_FOUND )
IF (MKL OR MKL_CORE)
SET(LAPACK_FOUND TRUE)
ENDIF ()
SET( MKL_BLAS_INCLUDE_FILE ${MKL_INCLUDE_DIR}/mkl_blas.h )
SET( MKL_LAPACK_INCLUDE_FILE ${MKL_INCLUDE_DIR}/mkl_lapack.h )
GET_FILENAME_COMPONENT(MKL_LIB_DIR ${MKL_CORE} PATH)
IF (MKL_INCLUDE_DIR)
SET(MKL_FOUND ON)
ENDIF (MKL_INCLUDE_DIR)
IF (MKL_FOUND OR MKL_INTEL_FOUND )
IF (NOT MKL_FIND_QUIETLY)
MESSAGE(STATUS "Found MKL: ${MKL_INCLUDE_DIR}")
ENDIF (NOT MKL_FIND_QUIETLY)
ELSE(MKL_FOUND OR MKL_INTEL_FOUND )
IF (MKL_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find MKL")
ENDIF (MKL_FIND_REQUIRED)
ENDIF (MKL_FOUND OR MKL_INTEL_FOUND )
IF (NOT LAPACK_FOUND )
MESSAGE(FATAL_ERROR "Could not find MKL")
ENDIF()
MARK_AS_ADVANCED(MKL_INCLUDE_DIR)
MARK_AS_ADVANCED(MKL_LIB_DIR)
MARK_AS_ADVANCED(MKL_LAPACK)
MARK_AS_ADVANCED(MKL)
MARK_AS_ADVANCED(MKL_GUIDE)
MARK_AS_ADVANCED(MKL_INTEL)
MARK_AS_ADVANCED(MKL_SEQUENTIAL)
......
SET(TEST_ENV $ENV{LAPACK_DIR})
IF(NOT DEFINED LAPACK_DIR AND DEFINED TEST_ENV)
SET(LAPACK_DIR $ENV{LAPACK_DIR})
ENDIF()
SET( NATIVE_BLAS_LAPACK_SEARCH_PATHS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
${LAPACK_DIR}/lib64
${LAPACK_DIR}/lib)
FIND_LIBRARY(NATIVE_BLAS NAMES blas PATHS ${NATIVE_BLAS_LAPACK_SEARCH_PATHS})
FIND_LIBRARY(NATIVE_LAPACK NAMES lapack PATHS ${NATIVE_BLAS_LAPACK_SEARCH_PATHS})
GET_FILENAME_COMPONENT(NATIVE_BLAS_LIB_DIR ${NATIVE_BLAS} PATH)
GET_FILENAME_COMPONENT(NATIVE_LAPACK_LIB_DIR ${NATIVE_LAPACK} PATH)
IF (NATIVE_BLAS AND NATIVE_LAPACK)
SET(NATIVE_BLAS_LAPACK_FOUND ON)
ENDIF (NATIVE_BLAS AND NATIVE_LAPACK)
IF (NATIVE_BLAS_LAPACK_FOUND)
IF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
MESSAGE(STATUS "Found Native Blas and Lapack")
ENDIF (NOT NATIVE_BLAS_LAPACK_FIND_QUIETLY)
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)
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(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)
......@@ -42,7 +42,7 @@ IF (NOT WIN32_BLAS OR NOT WIN32_LAPACK)
# For some reason CMake refuses to run FIND_LIBRARY again so we
# force this to the correct library.
SET(WIN32_BLAS "${TPSRC}/libblas.lib" CACHE FILEPATH "Blas" FORCE)
SET(WIN32_BLAS "${TPSRC}/libblas.lib" CACHE FILEPATH "BLAS" FORCE)
SET(WIN32_LAPACK "${TPSRC}/liblapack.lib" CACHE FILEPATH "LAPACK" FORCE)
IF (NOT WIN32_BLAS)
......@@ -56,6 +56,7 @@ ENDIF ()
GET_FILENAME_COMPONENT(LAPACK_DIR ${WIN32_LAPACK} PATH CACHE)
LINK_DIRECTORIES(${LAPACK_DIR})
SET(LAPACK_FOUND TRUE)
SET(BLAS_LAPACK ${WIN32_BLAS} ${WIN32_LAPACK} CACHE INTERNAL "BLAS/LAPACK location (Win32)")
MESSAGE(STATUS "Found Win32 BLAS: ${WIN32_BLAS}")
MESSAGE(STATUS "Found Win32 Lapack: ${WIN32_LAPACK}")
MESSAGE(STATUS "Found Win32 BLAS/LAPACK: ${BLAS_LAPACK}")
\ No newline at end of file
......@@ -6,37 +6,68 @@
#
########################################################################
# Test for if BLAS is in compiler.
INCLUDE(CheckFunctionExists)
INCLUDE(FindNativeBlasLapack)
CHECK_FUNCTION_EXISTS(dgemm_ HAVE_DGEMM)
IF(NATIVE_BLAS_LAPACK_FOUND)
SET(BUILD_BLAS_LAPACK OFF)
IF (HAVE_DGEMM)
MESSAGE(STATUS "Found BLAS/LAPACK: built in")
SET(BLAS_LAPACK_BUILTIN ON)
ELSE()
IF(CMAKE_Fortran_COMPILER)
SET(BUILD_BLAS_LAPACK ON)
SET(BLAS_LAPACK_BUILTIN OFF)
# BLAS Support
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SYSTEM_BLAS_LAPACK
"Use the system provided blas and lapack libraries" ON
"UNIX; NOT APPLE; NOT NEKTAR_USE_OPENBLAS; NOT NEKTAR_USE_MKL; NOT NEKTAR_USE_ACML; NOT NEKTAR_USE_ACCELERATE_FRAMEWORK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_OPENBLAS
"Use OpenBLAS library as a substitute to native BLAS." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ACML
"Use the AMD Core Math Library (ACML) for BLAS and Lapack support." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_MKL
"Use the Intel Math Kernel Library (MKL) for BLAS and Lapack support." OFF
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
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)
INCLUDE(FindBlasLapack)
IF(LAPACK_FOUND)
MESSAGE(STATUS "Found BLAS and LAPACK: ${BLAS_LAPACK}")
SET(BUILD_BLAS_LAPACK OFF)
ELSE()
MESSAGE(SEND_ERROR "No blas installation or fortran compiler found")
IF(CMAKE_Fortran_COMPILER)
SET(BUILD_BLAS_LAPACK ON)
ELSE()
MESSAGE(SEND_ERROR "No BLAS/LAPACK installation found and cannot self build")
ENDIF()
ENDIF()
ENDIF()
OPTION(THIRDPARTY_BUILD_BLAS_LAPACK "Build blas and lapack libraries from ThirdParty."
${BUILD_BLAS_LAPACK})
OPTION(THIRDPARTY_BUILD_BLAS_LAPACK "Build BLAS and LAPACK libraries from ThirdParty."
${BUILD_BLAS_LAPACK})
IF(THIRDPARTY_BUILD_BLAS_LAPACK)
INCLUDE(ExternalProject)
IF(THIRDPARTY_BUILD_BLAS_LAPACK)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
lapack-3.7.0
PREFIX ${TPSRC}
URL http://www.netlib.org/lapack/lapack-3.7.0.tgz
URL_MD5 "697bb8d67c7d336a0f339cc9dd0fa72f"
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/lapack-3.7.0
BINARY_DIR ${TPBUILD}/lapack-3.7.0
TMP_DIR ${TPBUILD}/lapack-3.7.0-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
EXTERNALPROJECT_ADD(
lapack-3.7.0
PREFIX ${TPSRC}
URL http://www.netlib.org/lapack/lapack-3.7.0.tgz
URL_MD5 "697bb8d67c7d336a0f339cc9dd0fa72f"
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/lapack-3.7.0
BINARY_DIR ${TPBUILD}/lapack-3.7.0
TMP_DIR ${TPBUILD}/lapack-3.7.0-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_Fortran_COMPILER:FILEPATH=${CMAKE_Fortran_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
......@@ -44,25 +75,9 @@ IF(THIRDPARTY_BUILD_BLAS_LAPACK)
-DBUILD_SHARED_LIBS:STRING=ON
-DBUILD_TESTING:STRING=OFF
${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)
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include)
)
IF (WIN32)
MESSAGE(STATUS "Build blas: ${TPDIST}/${LIB_DIR}/${NATIVE_BLAS}.dll")
MESSAGE(STATUS "Build lapack: ${TPDIST}/${LIB_DIR}/${NATIVE_LAPACK}.dll")
ELSE ()
MESSAGE(STATUS "Build blas: ${TPDIST}/${LIB_DIR}/lib${NATIVE_BLAS}.a")
MESSAGE(STATUS "Build lapack: ${TPDIST}/${LIB_DIR}/${NATIVE_LAPACK}.a")
THIRDPARTY_LIBRARY(BLAS_LAPACK SHARED blas lapack DESCRIPTION "BLAS and LAPACK libraries")
MESSAGE(STATUS "Build BLAS/LAPACK: ${BLAS_LAPACK}")
ENDIF()
ENDIF()
......@@ -10,7 +10,6 @@
MESSAGE(STATUS "Searching for Boost:")
SET(MIN_VER "1.56.0")
SET(NEEDED_BOOST_LIBS thread iostreams filesystem system program_options regex)
SET(Boost_DEBUG 0)
SET(Boost_NO_BOOST_CMAKE ON)
IF( BOOST_ROOT )
SET(Boost_NO_SYSTEM_PATHS ON)
......@@ -165,13 +164,7 @@ IF (THIRDPARTY_BUILD_BOOST)
STRING(TOUPPER ${BOOSTLIB} BOOSTLIB_UPPER)
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library")
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY_DEBUG
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library, debug")
THIRDPARTY_LIBRARY(Boost_${BOOSTLIB_UPPER}_LIBRARY_RELEASE
SHARED boost_${BOOSTLIB} DESCRIPTION "Boost ${BOOSTLIB} library, release")
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY)
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY_DEBUG)
MARK_AS_ADVANCED(Boost_${BOOSTLIB_UPPER}_LIBRARY_RELEASE)
LIST(APPEND Boost_LIBRARIES ${Boost_${BOOSTLIB_UPPER}_LIBRARY})
ENDFOREACH()
......
......@@ -51,13 +51,11 @@ IF (NEKTAR_USE_PETSC)
SET(PETSC_MUMPS --download-scalapack --download-mumps)
SET(PETSC_DEPS "")
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(NOT BLAS_LAPACK_BUILTIN )
LIST(GET BLAS_LAPACK 0 BLAS)
GET_FILENAME_COMPONENT(BLAS_LAPACK_DIR ${BLAS} PATH)
IF( NEKTAR_USE_MKL OR NEKTAR_USE_SYSTEM_BLAS_LAPACK)
SET(PETSC_MUMPS ${PETSC_MUMPS} --with-blas-lapack-dir=${BLAS_LAPACK_DIR})
IF(THIRDPARTY_BUILD_BLAS_LAPACK)
SET(PETSC_DEPS ${PETSC_DEPS} lapack-3.7.0)
ENDIF()
......
......@@ -7,42 +7,31 @@
########################################################################
IF(NEKTAR_USE_MESHGEN)
SET(BUILD_TETGEN ON)
OPTION(THIRDPARTY_BUILD_TETGEN
"Build TetGen library from ThirdParty." ${BUILD_TETGEN})
IF (THIRDPARTY_BUILD_TETGEN)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
tetgen-1.5
PREFIX ${TPSRC}
URL ${TPURL}/tetgen.zip
URL_MD5 6d62e63f9b1e7a8ce53d5bc87e6a0a09
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/tetgen-1.5
BINARY_DIR ${TPBUILD}/tetgen-1.5
TMP_DIR ${TPBUILD}/tetgen-1.5-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
${TPSRC}/tetgen-1.5
)
THIRDPARTY_LIBRARY(TETGEN_LIBRARY STATIC tetgen
DESCRIPTION "Tetgen library")
SET(TETGEN_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"TetGen include" FORCE)
MESSAGE(STATUS "Build TetGen: ${TETGEN_LIBRARY}")
SET(TETGEN_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
ADD_CUSTOM_TARGET(tetgen-1.5 ALL)
MESSAGE(STATUS "Found Tetgen: ${TETGEN_LIBRARY}")
SET(TRIANGLE_CONFIG_INCLUDE_DIR ${TETGEN_INCLUDE_DIR})
ENDIF (THIRDPARTY_BUILD_TETGEN)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
tetgen-1.5
PREFIX ${TPSRC}
URL ${TPURL}/tetgen.zip
URL_MD5 6d62e63f9b1e7a8ce53d5bc87e6a0a09
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/tetgen-1.5
BINARY_DIR ${TPBUILD}/tetgen-1.5
TMP_DIR ${TPBUILD}/tetgen-1.5-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
${TPSRC}/tetgen-1.5
)
THIRDPARTY_LIBRARY(TETGEN_LIBRARY STATIC tetgen
DESCRIPTION "Tetgen library")
SET(TETGEN_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"TetGen include" FORCE)
MESSAGE(STATUS "Build TetGen: ${TETGEN_LIBRARY}")
SET(TETGEN_CONFIG_INCLUDE_DIR ${TPINC})
MARK_AS_ADVANCED(TETGEN_LIBRARY)
MARK_AS_ADVANCED(TETGEN_INCLUDE_DIR)
......
......@@ -72,8 +72,7 @@ IF (THIRDPARTY_BUILD_TINYXML)
)
ENDIF()
THIRDPARTY_LIBRARY(TINYXML_LIBRARY STATIC tinyxml
DESCRIPTION "TinyXML library")
THIRDPARTY_LIBRARY(TINYXML_LIBRARY STATIC tinyxml DESCRIPTION "TinyXML library")
SET(TINYXML_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"TinyXML include" FORCE)
MESSAGE(STATUS "Build TinyXML: ${TINYXML_LIBRARY}")
......@@ -88,3 +87,4 @@ INCLUDE_DIRECTORIES(${TINYXML_INCLUDE_DIR})
MARK_AS_ADVANCED(TINYXML_INCLUDE_DIR)
MARK_AS_ADVANCED(TINYXML_LIBRARY)
MARK_AS_ADVANCED(TINYXML_CONFIG_INCLUDE_DIR)
......@@ -15,18 +15,8 @@ ENDIF()
# Find a system ZLIB library. If not found enable the THIRDPARTY_BUILD_ZLIB
# option.
SET(ZLIB_FIND_QUIETLY ON)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(ZLIB QUIET)
IF (ZLIB_FOUND AND NOT ZLIB_VERSION_PATCH LESS 7)
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES} CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_DEBUG ${ZLIB_LIBRARIES} CACHE FILEPATH
"Zlib library" FORCE)
SET(ZLIB_LIBRARY_RELEASE ${ZLIB_LIBRARIES} CACHE FILEPATH
"Zlib library" FORCE)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_LIBRARY_DEBUG ZLIB_LIBRARY_RELEASE)
SET(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS} CACHE PATH
"Zlib include" FORCE)
SET(BUILD_ZLIB OFF)
ELSE ()
SET(BUILD_ZLIB ON)
......@@ -62,32 +52,18 @@ IF (THIRDPARTY_BUILD_ZLIB)
ENDIF ()
IF (WIN32)
THIRDPARTY_LIBRARY(ZLIB_LIBRARY STATIC zlib
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_DEBUG STATIC zlibd
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARY_RELEASE STATIC zlib
DESCRIPTION "Zlib library")
THIRDPARTY_LIBRARY(ZLIB_LIBRARIES STATIC zlib DESCRIPTION "Zlib library")