From 428aa9eb57e3743fb897947358209a15c79dddfd Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Wed, 10 Jan 2018 21:47:51 +0100 Subject: [PATCH 01/13] What ever is in PR#10 add static builds add fixed FindBLAS to fix mac static build add non sequential mkl to travis add openblas on mac make verbose breww misc install omp for parallel backend debug use intel thread + iomp even with GCC remove broken builds Add linux build static Remove apple builds cat cmake logs [fix] add dynamic thread libraries to the target --- .travis.yml | 34 +- CMakeLists.txt | 18 +- cmake/CMakePushCheckState.cmake | 86 +++ cmake/CheckFortranFunctionExists.cmake | 66 +++ cmake/CheckFunctionExists.cmake | 98 ++++ cmake/FindBLAS.cmake | 727 +++++++++++++++++++++++++ 6 files changed, 1011 insertions(+), 18 deletions(-) create mode 100644 cmake/CMakePushCheckState.cmake create mode 100644 cmake/CheckFortranFunctionExists.cmake create mode 100644 cmake/CheckFunctionExists.cmake create mode 100644 cmake/FindBLAS.cmake diff --git a/.travis.yml b/.travis.yml index 43b9571..1e274e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,12 +31,17 @@ matrix: - os: linux env: - BACKEND=Intel10_64lp_seq - - os: osx + - os: linux env: - - BACKEND=Apple - - os: osx + - BACKEND=Intel10_64lp + - os: linux env: - BACKEND=Intel10_64lp_seq + - BUILD_STATIC=1 + - os: linux + env: + - BACKEND=Intel10_64lp + - BUILD_STATIC=1 before_install: # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ @@ -58,6 +63,9 @@ before_install: export PATH=${DEPS_DIR}/cmake/bin:${PATH} else brew install cmake || brew upgrade cmake + if [[ "${BACKEND}" == "OpenBLAS" ]]; then + brew install openblas + fi fi - which cmake - cmake --version @@ -66,7 +74,7 @@ before_install: # Install MKL ############################################################################ - | - if [[ "${BACKEND}" == "Intel10_64lp_seq" ]]; then + if [[ "${BACKEND}" == *"Intel"* ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export MKL_INSTALL_DIR=$(pwd)/intel wget http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12070/l_mkl_2018.0.128.tgz @@ -92,9 +100,17 @@ before_install: script: - cd ${TRAVIS_BUILD_DIR} - mkdir -p build && cd build - - echo "cmake .. -DBLAS_VENDOR=$BACKEND" - - cmake .. -DCMAKE_CXX_STANDARD=11 -DBLA_VENDOR=$BACKEND - - cmake --build . + - export CMAKE_OPTIONS="-DCMAKE_CXX_STANDARD=11 -DBLA_VENDOR=$BACKEND" + - | + if [[ "${BUILD_STATIC}" == "1" ]]; then + export CMAKE_OPTIONS="${CMAKE_OPTIONS} -DBLA_STATIC=ON" + fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then echo $LD_LIBRARY_PATH; fi + - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then echo $DYLD_LIBRARY_PATH; fi + - echo "cmake .. ${CMAKE_OPTIONS}" + - cmake .. ${CMAKE_OPTIONS} + - make VERBOSE=1 + # - cmake --build . - | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ldd ./CMakeHelloWorld @@ -105,5 +121,9 @@ script: after_success: - ./CMakeHelloWorld +after_failure: + - cat CMakeFiles/CMakeOutput.log + - cat CMakeFiles/CMakeError.log + notifications: email: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 86f3017..a7ba5e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,14 +6,11 @@ set (CMakeHelloWorld_VERSION_MAJOR 1) set (CMakeHelloWorld_VERSION_MINOR 0) # Find the BLAS stuff +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) find_package(BLAS REQUIRED) message(STATUS "BLAS Libraries: ${BLAS_LIBRARIES}") -# find_path(BLAS_INCLUDE_DIRS NAMES cblas.h) -# message(STATUS "BLAS Include: ${BLAS_INCLUDE_DIRS}") -# include_directories(${BLAS_INCLUDE_DIRS}) - set(BLA_DEFINITIONS) if (BLA_VENDOR MATCHES Intel) if ("$ENV{MKLROOT}" STREQUAL "") @@ -29,17 +26,16 @@ elseif (BLA_VENDOR MATCHES ATLAS) set(BLAS_LIBRARIES "${BLAS_LIBRARIES};${CBLAS_LIB}") endif() -# include_directories(SYSTEM -# C:\\nuget_openblas\\OpenBLAS.0.2.14.1\\lib\\native\\include\\ -# C:\\OpenBLAS.0.2.14.1\\lib\\native\\include\\) - -#include the subdirectory containing our libs +# include the subdirectory containing our libs add_subdirectory(Hello) include_directories(Hello) -#indicate the entry point for the executable +# indicate the entry point for the executable add_executable(CMakeHelloWorld Hello HelloWorld.cpp) +# BLAS libraries compile dynamically against threads +LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM}) + # Indicate which libraries to include during the link process. -target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES}) +target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) # install (TARGETS CMakeHelloWorld DESTINATION bin) diff --git a/cmake/CMakePushCheckState.cmake b/cmake/CMakePushCheckState.cmake new file mode 100644 index 0000000..2a527d5 --- /dev/null +++ b/cmake/CMakePushCheckState.cmake @@ -0,0 +1,86 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CMakePushCheckState +# ------------------- +# +# +# +# This module defines three macros: CMAKE_PUSH_CHECK_STATE() +# CMAKE_POP_CHECK_STATE() and CMAKE_RESET_CHECK_STATE() These macros can +# be used to save, restore and reset (i.e., clear contents) the state of +# the variables CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, +# CMAKE_REQUIRED_LIBRARIES, CMAKE_REQUIRED_INCLUDES and CMAKE_EXTRA_INCLUDE_FILES +# used by the various Check-files coming with CMake, like e.g. +# check_function_exists() etc. The variable contents are pushed on a +# stack, pushing multiple times is supported. This is useful e.g. when +# executing such tests in a Find-module, where they have to be set, but +# after the Find-module has been executed they should have the same +# value as they had before. +# +# CMAKE_PUSH_CHECK_STATE() macro receives optional argument RESET. +# Whether it's specified, CMAKE_PUSH_CHECK_STATE() will set all +# CMAKE_REQUIRED_* variables to empty values, same as +# CMAKE_RESET_CHECK_STATE() call will do. +# +# Usage: +# +# :: +# +# cmake_push_check_state(RESET) +# set(CMAKE_REQUIRED_DEFINITIONS -DSOME_MORE_DEF) +# check_function_exists(...) +# cmake_reset_check_state() +# set(CMAKE_REQUIRED_DEFINITIONS -DANOTHER_DEF) +# check_function_exists(...) +# cmake_pop_check_state() + +macro(CMAKE_RESET_CHECK_STATE) + + set(CMAKE_EXTRA_INCLUDE_FILES) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) + +endmacro() + +macro(CMAKE_PUSH_CHECK_STATE) + + if(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER) + set(_CMAKE_PUSH_CHECK_STATE_COUNTER 0) + endif() + + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1") + + set(_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_EXTRA_INCLUDE_FILES}) + set(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) + + if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") + cmake_reset_check_state() + endif() + +endmacro() + +macro(CMAKE_POP_CHECK_STATE) + +# don't pop more than we pushed + if("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0") + + set(CMAKE_EXTRA_INCLUDE_FILES ${_CMAKE_EXTRA_INCLUDE_FILES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + + math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") + endif() + +endmacro() diff --git a/cmake/CheckFortranFunctionExists.cmake b/cmake/CheckFortranFunctionExists.cmake new file mode 100644 index 0000000..5fc740a --- /dev/null +++ b/cmake/CheckFortranFunctionExists.cmake @@ -0,0 +1,66 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CheckFortranFunctionExists +# -------------------------- +# +# macro which checks if the Fortran function exists +# +# CHECK_FORTRAN_FUNCTION_EXISTS(FUNCTION VARIABLE) +# +# :: +# +# FUNCTION - the name of the Fortran function +# VARIABLE - variable to store the result +# Will be created as an internal cache variable. +# +# +# +# The following variables may be set before calling this macro to modify +# the way the check is run: +# +# :: +# +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) + if(NOT DEFINED ${VARIABLE}) + message(STATUS "Looking for Fortran ${FUNCTION}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif() + file(WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f + " + program TESTFortran + external ${FUNCTION} + call ${FUNCTION}() + end program TESTFortran + " + ) + try_compile(${VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f + ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} + OUTPUT_VARIABLE OUTPUT + ) +# message(STATUS "${OUTPUT}") + if(${VARIABLE}) + set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") + message(STATUS "Looking for Fortran ${FUNCTION} - found") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" + "${OUTPUT}\n\n") + else() + message(STATUS "Looking for Fortran ${FUNCTION} - not found") + set(${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n\n") + endif() + endif() +endmacro() diff --git a/cmake/CheckFunctionExists.cmake b/cmake/CheckFunctionExists.cmake new file mode 100644 index 0000000..ef08062 --- /dev/null +++ b/cmake/CheckFunctionExists.cmake @@ -0,0 +1,98 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CheckFunctionExists +# ------------------- +# +# Check if a C function can be linked:: +# +# check_function_exists( ) +# +# Check that the ```` is provided by libraries on the system and store +# the result in a ````. ```` will be created as an internal +# cache variable. +# +# The following variables may be set before calling this macro to modify the +# way the check is run: +# +# :: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages +# +# .. note:: +# +# Prefer using :Module:`CheckSymbolExists` instead of this module, +# for the following reasons: +# +# * ``check_function_exists()`` can't detect functions that are inlined +# in headers or specified as a macro. +# +# * ``check_function_exists()`` can't detect anything in the 32-bit +# versions of the Win32 API, because of a mismatch in calling conventions. +# +# * ``check_function_exists()`` only verifies linking, it does not verify +# that the function is declared in system headers. + +macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION}") + endif() + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) + endif() + + if(CMAKE_C_COMPILER_LOADED) + set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c) + elseif(CMAKE_CXX_COMPILER_LOADED) + set(_cfe_source ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckFunctionExists/CheckFunctionExists.cxx) + configure_file(${CMAKE_ROOT}/Modules/CheckFunctionExists.c "${_cfe_source}" COPYONLY) + else() + message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled") + endif() + + try_compile(${VARIABLE} + ${CMAKE_BINARY_DIR} + ${_cfe_source} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + unset(_cfe_source) + + if(${VARIABLE}) + set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - found") + endif() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the function ${FUNCTION} exists passed with the following output:\n" + "${OUTPUT}\n\n") + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - not found") + endif() + set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the function ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n\n") + endif() + endif() +endmacro() diff --git a/cmake/FindBLAS.cmake b/cmake/FindBLAS.cmake new file mode 100644 index 0000000..0e2e502 --- /dev/null +++ b/cmake/FindBLAS.cmake @@ -0,0 +1,727 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindBLAS +# -------- +# +# Find BLAS library +# +# This module finds an installed fortran library that implements the +# BLAS linear-algebra interface (see http://www.netlib.org/blas/). The +# list of libraries searched for is taken from the autoconf macro file, +# acx_blas.m4 (distributed at +# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). +# +# This module sets the following variables: +# +# :: +# +# BLAS_FOUND - set to true if a library implementing the BLAS interface +# is found +# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l +# and -L). +# BLAS_LIBRARIES - uncached list of libraries (using full path name) to +# link against to use BLAS +# BLAS95_LIBRARIES - uncached list of libraries (using full path name) +# to link against to use BLAS95 interface +# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface +# is found +# BLA_STATIC if set on this determines what kind of linkage we do (static) +# BLA_VENDOR if set checks only the specified vendor, if not set checks +# all the possibilities +# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK +# +# List of vendors (BLA_VENDOR) valid in this module: +# +# * Goto +# * OpenBLAS +# * ATLAS +# * PhiPACK +# * CXML +# * DXML +# * SunPerf +# * SCSL +# * SGIMATH +# * IBMESSL +# * Intel10_32 (intel mkl v10 32 bit) +# * Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model) +# * Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model) +# * Intel (older versions of mkl 32 and 64 bit) +# * ACML +# * ACML_MP +# * ACML_GPU +# * Apple +# * NAS +# * Generic +# +# .. note:: +# +# C/CXX should be enabled to use Intel mkl +# + +include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) + +set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + +# Check the language being used +if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") + else() + message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") + return() + endif() +endif() + +macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) +# This macro checks for the existence of the combination of fortran libraries +# given by _list. If the combination is found, this macro checks (using the +# Check_Fortran_Function_Exists macro) whether can link against that library +# combination using the name of a routine given by _name using the linker +# flags given by _flags. If the combination of libraries is found and passes +# the link test, LIBRARIES is set to the list of complete library paths that +# have been found. Otherwise, LIBRARIES is set to FALSE. + +# N.B. _prefix is the prefix applied to the names of all cached variables that +# are generated internally and marked advanced by this macro. + +set(_libdir ${ARGN}) + +set(_libraries_work TRUE) +set(${LIBRARIES}) +set(_combined_name) +if (NOT _libdir) + if (WIN32) + set(_libdir ENV LIB) + elseif (APPLE) + set(_libdir ENV DYLD_LIBRARY_PATH) + else () + set(_libdir ENV LD_LIBRARY_PATH) + endif () +endif () + +foreach(_library ${_list}) + set(_combined_name ${_combined_name}_${_library}) + + if(_libraries_work) + if (BLA_STATIC) + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif () + if (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else () + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif () + else () + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif () + endif () + message(${CMAKE_FIND_LIBRARY_SUFFIXES}) + find_library(${_prefix}_${_library}_LIBRARY + NAMES ${_library} + HINTS ${_libdir} + ) + message("LIBDIR : ${_libdir}") + message(${${_prefix}_${_library}_LIBRARY}) + mark_as_advanced(${_prefix}_${_library}_LIBRARY) + set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + endif() +endforeach() +if(_libraries_work) + # Test this combination of libraries. + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) + # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + if (CMAKE_Fortran_COMPILER_LOADED) + check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) + else() + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + endif() + set(CMAKE_REQUIRED_LIBRARIES) + mark_as_advanced(${_prefix}${_combined_name}_WORKS) + set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) +endif() +if(NOT _libraries_work) + set(${LIBRARIES} FALSE) +endif() +# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") +endmacro() + +set(BLAS_LINKER_FLAGS) +set(BLAS_LIBRARIES) +set(BLAS95_LIBRARIES) +if (NOT $ENV{BLA_VENDOR} STREQUAL "") + set(BLA_VENDOR $ENV{BLA_VENDOR}) +else () + if(NOT BLA_VENDOR) + set(BLA_VENDOR "All") + endif() +endif () + +if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "goto2" + "" + ) + endif() +endif () + +if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # OpenBLAS (http://www.openblas.net) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "openblas" + "" + ) + endif() +endif () + +if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "f77blas;atlas" + "" + ) + endif() +endif () + +# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) +if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "sgemm;dgemm;blas" + "" + ) + endif() +endif () + +# BLAS in Alpha CXML library? +if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "cxml" + "" + ) + endif() +endif () + +# BLAS in Alpha DXML library? (now called CXML, see above) +if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "dxml" + "" + ) + endif() +endif () + +# BLAS in Sun Performance library? +if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "-xlic_lib=sunperf" + "sunperf;sunmath" + "" + ) + if(BLAS_LIBRARIES) + set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") + endif() + endif() +endif () + +# BLAS in SCSL library? (SGI/Cray Scientific Library) +if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "scsl" + "" + ) + endif() +endif () + +# BLAS in SGIMATH library? +if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "complib.sgimath" + "" + ) + endif() +endif () + +# BLAS in IBM ESSL library? (requires generic BLAS lib, too) +if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "essl;blas" + "" + ) + endif() +endif () + +#BLAS in acml library? +if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") + if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR + ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR + ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) + ) + # try to find acml in "standard" paths + if( WIN32 ) + file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) + else() + file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) + endif() + if( WIN32 ) + file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) + else() + file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) + endif() + list(GET _ACML_ROOT 0 _ACML_ROOT) + list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) + if( _ACML_ROOT ) + get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) + if( SIZEOF_INTEGER EQUAL 8 ) + set( _ACML_PATH_SUFFIX "_int64" ) + else() + set( _ACML_PATH_SUFFIX "" ) + endif() + if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) + set( _ACML_COMPILER32 "ifort32" ) + set( _ACML_COMPILER64 "ifort64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) + set( _ACML_COMPILER32 "sun32" ) + set( _ACML_COMPILER64 "sun64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) + set( _ACML_COMPILER32 "pgi32" ) + if( WIN32 ) + set( _ACML_COMPILER64 "win64" ) + else() + set( _ACML_COMPILER64 "pgi64" ) + endif() + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) + # 32 bit builds not supported on Open64 but for code simplicity + # We'll just use the same directory twice + set( _ACML_COMPILER32 "open64_64" ) + set( _ACML_COMPILER64 "open64_64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) + set( _ACML_COMPILER32 "nag32" ) + set( _ACML_COMPILER64 "nag64" ) + else() + set( _ACML_COMPILER32 "gfortran32" ) + set( _ACML_COMPILER64 "gfortran64" ) + endif() + + if( BLA_VENDOR STREQUAL "ACML_MP" ) + set(_ACML_MP_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) + else() + set(_ACML_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) + endif() + endif() + elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) + set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) + endif() + + if( BLA_VENDOR STREQUAL "ACML_MP" ) + foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) + foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + else() + foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) + check_fortran_libraries ( + BLAS_LIBRARIES + BLAS + sgemm + "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} + ) + if( BLAS_LIBRARIES ) + break() + endif() + endforeach() + endif() + + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml;acml_mv" + "" + ) + endif() + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" + "" + ) + endif() + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml;acml_mv;CALBLAS" + "" + ) + endif() +endif () # ACML + +# Apple BLAS library? +if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") +if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "Accelerate" + "" + ) + endif() +endif () + +if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + if ( NOT BLAS_LIBRARIES ) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + dgemm + "" + "vecLib" + "" + ) + endif () +endif () +# Generic BLAS library? +if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "blas" + "" + ) + endif() +endif () + +#BLAS in intel mkl 10 library? (em64t 64bit) +if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") + if (UNIX) + set(LM "-lm -ldl") + # if (NOT APPLE) + # set(LM "${LM} -ldl") + # endif () + endif () + if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) + if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + find_package(Threads) + else() + find_package(Threads REQUIRED) + endif() + + set(BLAS_SEARCH_LIBS "") + + if(BLA_F95) + set(BLAS_mkl_SEARCH_SYMBOL SGEMM) + set(_LIBRARIES BLAS95_LIBRARIES) + if (WIN32) + if (BLA_STATIC) + set(BLAS_mkl_DLL_SUFFIX "") + else() + set(BLAS_mkl_DLL_SUFFIX "_dll") + endif() + + # Find the main file (32-bit or 64-bit) + set(BLAS_SEARCH_LIBS_WIN_MAIN "") + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN + "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") + endif() + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN + "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") + endif () + + # Add threading/sequential libs + set(BLAS_SEARCH_LIBS_WIN_THREAD "") + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") + endif() + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") + # mkl >= 10.3 + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") + endif() + + # Cartesian product of the above + foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) + foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) + list(APPEND BLAS_SEARCH_LIBS + "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") + endforeach() + endforeach() + else () + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core iomp5") + # "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_sequential mkl_core") + endif () + endif () + else () + set(BLAS_mkl_SEARCH_SYMBOL sgemm) + set(_LIBRARIES BLAS_LIBRARIES) + if (WIN32) + if (BLA_STATIC) + set(BLAS_mkl_DLL_SUFFIX "") + else() + set(BLAS_mkl_DLL_SUFFIX "_dll") + endif() + + # Find the main file (32-bit or 64-bit) + set(BLAS_SEARCH_LIBS_WIN_MAIN "") + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN + "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") + endif() + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN + "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") + endif () + + # Add threading/sequential libs + set(BLAS_SEARCH_LIBS_WIN_THREAD "") + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") + # mkl >= 10.3 + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") + endif() + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") + endif() + + # Cartesian product of the above + foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) + foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) + list(APPEND BLAS_SEARCH_LIBS + "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") + endforeach() + endforeach() + else () # UNIX + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc") + list(APPEND BLAS_SEARCH_LIBS + # "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") + "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_sequential mkl_core") + endif () + + #older vesions of intel mkl libs + if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl") + list(APPEND BLAS_SEARCH_LIBS + "mkl_ia32") + list(APPEND BLAS_SEARCH_LIBS + "mkl_em64t") + endif () + endif () + endif () + + foreach (IT ${BLAS_SEARCH_LIBS}) + message("----sik---- DB: get in") + string(REPLACE " " ";" SEARCH_LIBS ${IT}) + if (${_LIBRARIES}) + message("----sik---- DB: get in _libraries is true") + else () + message("----sik---- DB: get in _libraries is false") + check_fortran_libraries( + ${_LIBRARIES} + BLAS + ${BLAS_mkl_SEARCH_SYMBOL} + "" + "${SEARCH_LIBS}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + message("----sik---- DB: libraries: ${_LIBRARIES} is ${${_LIBRARIES}}") + message("----sik---- DB: it : ${IT} ") + endif () + endforeach () + + endif () +endif () + + +if(BLA_F95) + if(BLAS95_LIBRARIES) + set(BLAS95_FOUND TRUE) + else() + set(BLAS95_FOUND FALSE) + endif() + + if(NOT BLAS_FIND_QUIETLY) + if(BLAS95_FOUND) + message(STATUS "A library with BLAS95 API found.") + else() + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with BLAS95 API not found. Please specify library location.") + else() + message(STATUS + "A library with BLAS95 API not found. Please specify library location.") + endif() + endif() + endif() + set(BLAS_FOUND TRUE) + set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") +else() + if(BLAS_LIBRARIES) + set(BLAS_FOUND TRUE) + else() + set(BLAS_FOUND FALSE) + endif() + + if(NOT BLAS_FIND_QUIETLY) + if(BLAS_FOUND) + message(STATUS "A library with BLAS API found.") + else() + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR + "A required library with BLAS API not found. Please specify library location." + ) + else() + message(STATUS + "A library with BLAS API not found. Please specify library location." + ) + endif() + endif() + endif() +endif() + +cmake_pop_check_state() +set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) From 9c5d7a90c273d51e9dc8af73bcfb36e2fddbb820 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 17:30:28 +0100 Subject: [PATCH 02/13] [to drop] Remove all builds but those from interest --- .appveyor.yml | 107 -------------------------------------------------- .travis.yml | 25 ------------ 2 files changed, 132 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index d667db2..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,107 +0,0 @@ -shallow_clone: true - -platform: - # - x86 - - x64 - -configuration: - - Debug - # - Release - -image: - - Visual Studio 2015 - # - Visual Studio 2017 - -# cache: - # - C:\cmake-3.10.1-win32-x86 - # - C:\Program Files (x86)\IntelSWTools - # - C:\w_mkl_2018.0.124.exe - -environment: - matrix: - # - BLAS_VERSION: Intel10_32 - # - BLAS_VERSION: Intel10_64lp - # - BLAS_VERSION: Intel - - BLAS_VERSION: Intel10_64lp_seq - BUILD_STATIC : ON - - - BLAS_VERSION: Intel10_64lp_seq - BUILD_STATIC : OFF - - -# init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -install: - ############################################################################ - # Install CMake - ############################################################################ - - ps: | - if (![IO.File]::Exists("C:\cmake-3.10.1-win64-x64\bin\cmake.exe")) { - Start-FileDownload 'https://cmake.org/files/v3.10/cmake-3.10.1-win64-x64.zip' - 7z x -y cmake-3.10.1-win64-x64.zip -oC:\ - } - $env:PATH="C:\cmake-3.10.1-win64-x64\bin;$env:PATH" - - ############################################################################ - # Install MKL - ############################################################################ - - ps: | - if (![IO.File]::Exists("C:\w_mkl_2018.0.124.exe")) { - ECHO 'w_mkl_2018.0.124.exe does not exist. Preparing to install MKL ..' - Start-FileDownload 'http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12079/w_mkl_2018.0.124.exe' -FileName 'C:\w_mkl_2018.0.124.exe' - C:\w_mkl_2018.0.124.exe -s -l c:\logs\extract-mkl.log -a install --eula=accept --components=all --output='C:\logs\install-mkl-output.txt' --installdir='C:\Program Files (x86)\IntelSWTools' --log='c:\logs\install-mkl.log' | Out-Null - ECHO 'Done' - } - $env:LD_MKL_PATH='C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.124\windows\mkl\lib\intel64_win\' - $env:LIB="$env:LD_MKL_PATH;$env:LIB" - $env:MKLROOT='C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.124\windows\mkl' - - ############################################################################ - # Install OpenBlAS - ############################################################################ - - nuget install openblas -o C:\ - -before_build: - - call "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.124\windows\bin\compilervars_arch.bat" intel64 vs2015 - - cd C:\projects\cpp-mkl-test - - "ECHO %BLAS_VERSION%" - - "ECHO 'cmake -DBLA_STATIC=%BUILD_STATIC% -DBLA_VENDOR=%BLAS_VERSION% -G \"Visual Studio 14 2015 Win64\" .. '" - - cmake --version - - "ECHO 'MKLROOT is %MKLROOT%'" - - ps: | - mkdir build - cd build - - cmake -DBLA_STATIC=%BUILD_STATIC% -DBLA_VENDOR=%BLAS_VERSION% -G "Visual Studio 14 2015 Win64" .. - -build_script: - - cmake --build . - -after_build: - - appveyor PushArtifact CMakeCache.txt - - appveyor PushArtifact CMakeFiles/CMakeOutput.log - - appveyor PushArtifact CMakeFiles/CMakeError.log - - -test_script: - - ps: | - if ($env:BUILD_STATIC -eq 'OFF') { - ECHO 'BUILD_STATIC is OFF. Compying shipping libraries' - cd 'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.124\windows\redist\intel64_win\mkl\' - cp *.dll C:\projects\cpp-mkl-test\build\ - }else{ - ECHO 'BUILD_STATIC is ON. No need to copy runtime dll' - } - - cd C:\projects\cpp-mkl-test\build\ - - .\Debug\CMakeHelloWorld.exe - -deploy: off - -on_failure: - - appveyor PushArtifact CMakeCache.txt - - appveyor PushArtifact CMakeFiles/CMakeOutput.log - - appveyor PushArtifact CMakeFiles/CMakeError.log - - -# on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/.travis.yml b/.travis.yml index 1e274e6..5f5cfb8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,31 +9,6 @@ env: matrix: include: - - os: linux - env: - - BACKEND=OpenBLAS - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libopenblas-base - - libopenblas-dev - - os: linux - env: - - BACKEND=ATLAS - addons: - sources: - - ubuntu-toolchain-r-test - apt: - packages: - - libatlas-base-dev - - os: linux - env: - - BACKEND=Intel10_64lp_seq - - os: linux - env: - - BACKEND=Intel10_64lp - os: linux env: - BACKEND=Intel10_64lp_seq From 6b60c50d9af7077770aa81cdc2c5f86a9b3fde12 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 17:26:04 +0100 Subject: [PATCH 03/13] Add a bunch of PRINT statements to try to trace the problem --- cmake/CheckFunctionExists.cmake | 24 +++++++++++++++++ cmake/FindBLAS.cmake | 48 +++++++++++++++++++++++++-------- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/cmake/CheckFunctionExists.cmake b/cmake/CheckFunctionExists.cmake index ef08062..ca0be07 100644 --- a/cmake/CheckFunctionExists.cmake +++ b/cmake/CheckFunctionExists.cmake @@ -39,6 +39,7 @@ # that the function is declared in system headers. macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) + message("DEBUG -- fucn_Exist -- :if ( NOT DEFINED \"${VARIABLE}\" OR \"x${${VARIABLE}}\" STREQUAL \"x${VARIABLE}\" )") if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") @@ -57,6 +58,12 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) else() set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES) endif() + message("---- sik [begin] --- CHECK_FUNCTION_EXISTS --") + message("MACRO_CHECK_FUNCTION_DEFINITIONS : ${MACRO_CHECK_FUNCTION_DEFINITIONS} ") + message("CMAKE_REQUIRED_LIBRARIES : ${CMAKE_REQUIRED_LIBRARIES} ") + message("CMAKE_REQUIRED_INCLUDES : ${CMAKE_REQUIRED_INCLUDES} ") + message("CHECK_FUNCTION_EXISTS_ADD_INCLUDES : ${CHECK_FUNCTION_EXISTS_ADD_INCLUDES} ") + message("---- sik [end] --- CHECK_FUNCTION_EXISTS --") if(CMAKE_C_COMPILER_LOADED) set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c) @@ -67,6 +74,19 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled") endif() + message("DEBUG --- func_exist --- ${VARIABLE} = ${${VARIABLE}}") + message("-------- sik [begin] --- TRY_COMPILE_CALL") + message("-------- sik --- CMAKE_BINARY_DIR : ${CMAKE_BINARY_DIR}") + message("-------- sik --- _cfe_source: ${_cfe_source}") + message("-------- sik --- COMPILE_DEFINITIONS CMAKE_REQUIRED_DEFINITIONS : COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}") + message("-------- sik --- CHECK_FUNCTION_EXISTS_ADD_LIBRARIES: ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}") + message("-------- sik --- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=MACRO_CHECK_FUNCTION_DEFINITIONS: CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}") + message("-------- sik --- \"CHECK_FUNCTION_EXISTS_ADD_INCLUDE S\" : \"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}\"") + message("-------- sik --- OUTPUT_VARIABLE OUTPUT : ${OUTPUT_VARIABLE} ${OUTPUT}") + message("-------- sik [other] --- ") + message("-------- sik --- COMPILE_DEFINITIONS : ${COMPILE_DEFINITIONS}") + message("-------- sik --- CMAKE_FLAGS : ${CMAKE_FLAGS}") + message("-------- sik [end] --- TRY_COMPILE_CALL") try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${_cfe_source} @@ -77,7 +97,10 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) OUTPUT_VARIABLE OUTPUT) unset(_cfe_source) + message("DEBUG --- func_exist --- VARIABLE = ${VARIABLE}") + message("DEBUG --- func_exist --- ${VARIABLE} = ${${VARIABLE}}") if(${VARIABLE}) + message("DEBUG --- func_exist --- VARIABLE is true and has value = ${VARIABLE}") set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for ${FUNCTION} - found") @@ -86,6 +109,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else() + message("DEBUG --- func_exist --- VARIABLE is false and has value = ${VARIABLE}") if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for ${FUNCTION} - not found") endif() diff --git a/cmake/FindBLAS.cmake b/cmake/FindBLAS.cmake index 0e2e502..236491f 100644 --- a/cmake/FindBLAS.cmake +++ b/cmake/FindBLAS.cmake @@ -90,6 +90,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) # N.B. _prefix is the prefix applied to the names of all cached variables that # are generated internally and marked advanced by this macro. + set(_libdir ${ARGN}) set(_libraries_work TRUE) @@ -105,8 +106,10 @@ if (NOT _libdir) endif () endif () + foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) + #message("DEBUG early stage variable: ${_prefix}${_combined_name}_WORKS is ${${_prefix}${_combined_name}_WORKS}") if(_libraries_work) if (BLA_STATIC) @@ -125,35 +128,50 @@ foreach(_library ${_list}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () endif () - message(${CMAKE_FIND_LIBRARY_SUFFIXES}) + # message(${CMAKE_FIND_LIBRARY_SUFFIXES}) find_library(${_prefix}_${_library}_LIBRARY NAMES ${_library} HINTS ${_libdir} ) - message("LIBDIR : ${_libdir}") - message(${${_prefix}_${_library}_LIBRARY}) + # message("---- sik [begin] --- ") + # message(" LIBDIR : ${_libdir}") + # message(" PREFIX : ${_prefix}") + # message(" LIBRARY : ${_libray}") + # message(" COMMAND : mark advanced : ${${_prefix}_${_library}_LIBRARY}") + # message(" COMMAND : set ${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY} ") + # message(" COMMAND : set _libraries_work ${${_prefix}_${_library}_LIBRARY}") + # message("---- sik [end] ---") mark_as_advanced(${_prefix}_${_library}_LIBRARY) set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) endif() endforeach() if(_libraries_work) + message("DEBUG: _libraries_work is ${_prefix}${_combined_name}_WORKS = ${${_prefix}${_combined_name}_WORKS}") # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) - # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + #message("DEBUG: before checking, ${LIBRARIES} = ${${LIBRARIES}}") + #message("DEBUG: CMAKE_Fortran_COMPILER_LOADED = ${CMAKE_Fortran_COMPILER_LOADED}") + #message("DEBUG: ${_prefix}${_combined_name}_WORKS before check is ${${_prefix}${_combined_name}_WORKS}") if (CMAKE_Fortran_COMPILER_LOADED) + #message("DEBUG call: check_fortran_function_exists(\"${_name}\" ${_prefix}${_combined_name}_WORKS)") check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() + #message("DEBUG call: check_function_exists(\"${_name}_\" ${_prefix}${_combined_name}_WORKS)") check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() + #message("DEBUG: ${_prefix}${_combined_name}_WORKS after check is ${${_prefix}${_combined_name}_WORKS}") set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) + #message("DEBUG: CMAKE_REQUIRED_LIBRARIES is ${CMAKE_REQUIRED_LIBRARIES}") + message("DEBUG: _libraries_work is ${_prefix}${_combined_name}_WORKS = ${${_prefix}${_combined_name}_WORKS}") endif() if(NOT _libraries_work) set(${LIBRARIES} FALSE) endif() -# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") + #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endmacro() set(BLAS_LINKER_FLAGS) @@ -501,7 +519,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") else() find_package(Threads REQUIRED) endif() - + # LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM}) set(BLAS_SEARCH_LIBS "") if(BLA_F95) @@ -654,12 +672,20 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") endif () foreach (IT ${BLAS_SEARCH_LIBS}) - message("----sik---- DB: get in") + # message("----sik---- DB: get in") string(REPLACE " " ";" SEARCH_LIBS ${IT}) if (${_LIBRARIES}) - message("----sik---- DB: get in _libraries is true") + # message("----sik---- DB: get in _libraries is true") else () - message("----sik---- DB: get in _libraries is false") + # message("----sik---- DB: get in _libraries is false") + message("---check_fortran_libraries (call)-- ---- sik [begin] --- CHECK_FUNCTION_EXISTS --") + message("---check_fortran_libraries (call)-- _LIBRARIES: ${_LIBRARIES} ") + message("---check_fortran_libraries (call)-- ${_LIBRARIES} : ${${_LIBRARIES}} ") + message("---check_fortran_libraries (call)-- BLAS_mkl_SEARCH_SYMBOL : ${BLAS_mkl_SEARCH_SYMBOL} ") + message("---check_fortran_libraries (call)-- SEARCH_LIBS : ${SEARCH_LIBS} ") + message("---check_fortran_libraries (call)-- CMAKE_THREAD_LIBS_INIT : ${CMAKE_THREAD_LIBS_INIT} ") + message("---check_fortran_libraries (call)-- LM : ${LM} ") + message("---check_fortran_libraries (call)-- ---- sik [end] --- CHECK_FUNCTION_EXISTS --") check_fortran_libraries( ${_LIBRARIES} BLAS @@ -668,8 +694,8 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "${SEARCH_LIBS}" "${CMAKE_THREAD_LIBS_INIT};${LM}" ) - message("----sik---- DB: libraries: ${_LIBRARIES} is ${${_LIBRARIES}}") - message("----sik---- DB: it : ${IT} ") + # message("----sik---- DB: libraries: ${_LIBRARIES} is ${${_LIBRARIES}}") + # message("----sik---- DB: it : ${IT} ") endif () endforeach () From 55ce4a26745243cabd3e678d9c56e1bf7db68f70 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 17:56:44 +0100 Subject: [PATCH 04/13] [to remove] Make travis show some extra info for the sake of argument --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5f5cfb8..73a72e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,6 +73,8 @@ before_install: fi script: + - ${MKLROOT}/tools/mkl_link_tool -libs --parallel=no --compiler=gnu_c --os=lnx --arch=intel64 --linking=static --interface=lp64 + - ${MKLROOT}/tools/mkl_link_tool -libs --parallel=yes --compiler=gnu_c --os=lnx --arch=intel64 --linking=static --interface=lp64 - cd ${TRAVIS_BUILD_DIR} - mkdir -p build && cd build - export CMAKE_OPTIONS="-DCMAKE_CXX_STANDARD=11 -DBLA_VENDOR=$BACKEND" @@ -83,7 +85,7 @@ script: - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then echo $LD_LIBRARY_PATH; fi - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then echo $DYLD_LIBRARY_PATH; fi - echo "cmake .. ${CMAKE_OPTIONS}" - - cmake .. ${CMAKE_OPTIONS} + - cmake .. ${CMAKE_OPTIONS} --debug-trycompile - make VERBOSE=1 # - cmake --build . - | From 66289914109e5db589b88a7e2de027a1c5089bda Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 18:42:39 +0100 Subject: [PATCH 05/13] remove mkl_link_tool execution (I've no idea why travis cannot find its there I've checked) --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73a72e5..eb28121 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,8 +73,6 @@ before_install: fi script: - - ${MKLROOT}/tools/mkl_link_tool -libs --parallel=no --compiler=gnu_c --os=lnx --arch=intel64 --linking=static --interface=lp64 - - ${MKLROOT}/tools/mkl_link_tool -libs --parallel=yes --compiler=gnu_c --os=lnx --arch=intel64 --linking=static --interface=lp64 - cd ${TRAVIS_BUILD_DIR} - mkdir -p build && cd build - export CMAKE_OPTIONS="-DCMAKE_CXX_STANDARD=11 -DBLA_VENDOR=$BACKEND" From 460e56baec0e448c4ae8b836ee69584744c3cdf5 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 18:44:09 +0100 Subject: [PATCH 06/13] no verbose wget in travis --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb28121..bc35cec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ before_install: - | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.[0-9]}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" - mkdir cmake && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake + mkdir cmake && travis_retry wget --no-verbose --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake export PATH=${DEPS_DIR}/cmake/bin:${PATH} else brew install cmake || brew upgrade cmake @@ -52,7 +52,7 @@ before_install: if [[ "${BACKEND}" == *"Intel"* ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export MKL_INSTALL_DIR=$(pwd)/intel - wget http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12070/l_mkl_2018.0.128.tgz + wget --no-verbose http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12070/l_mkl_2018.0.128.tgz tar -xzf l_mkl_2018.0.128.tgz cat l_mkl_2018.0.128/silent.cfg | grep -v EULA | grep -v PSET_INSTALL_DIR > silent.cfg echo "ACCEPT_EULA=accept" >> silent.cfg @@ -62,7 +62,7 @@ before_install: . ${MKL_INSTALL_DIR}/mkl/bin/mklvars.sh intel64 ilp64 else # Mac export MKL_INSTALL_DIR=/opt/intel - wget http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12185/m_mkl_2017.4.220.dmg + wget --no-verbose http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12185/m_mkl_2017.4.220.dmg hdiutil attach m_mkl_2017.4.220.dmg cat /Volumes/m_mkl_2017.4.220/m_mkl_2017.4.220.app/Contents/MacOS/silent.cfg | grep -v EULA | grep -v PSET_INSTALL_DIR > silent.cfg echo "ACCEPT_EULA=accept" >> silent.cfg From b56f3ff603b73cb3d417ee76d042645b006e68c4 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Wed, 17 Jan 2018 18:47:54 +0100 Subject: [PATCH 07/13] add some comments to trace findbla --- cmake/FindBLAS.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/FindBLAS.cmake b/cmake/FindBLAS.cmake index 236491f..2a6f4df 100644 --- a/cmake/FindBLAS.cmake +++ b/cmake/FindBLAS.cmake @@ -565,7 +565,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") endforeach() endforeach() - else () + else () # BLA_F95==True && WIN32==False if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") @@ -590,7 +590,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "mkl_intel_lp64 mkl_sequential mkl_core") endif () endif () - else () + else () # BLA_F95==False set(BLAS_mkl_SEARCH_SYMBOL sgemm) set(_LIBRARIES BLAS_LIBRARIES) if (WIN32) @@ -633,7 +633,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") endforeach() endforeach() - else () # UNIX + else () # BLA_F95==False && UNIX if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_intel mkl_intel_thread mkl_core guide") From 2edf1c5a6df8f215e7072c9366c00248c85bb93e Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Fri, 19 Jan 2018 15:15:25 +0100 Subject: [PATCH 08/13] fix static parallel linux? --- cmake/FindBLAS.cmake | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/FindBLAS.cmake b/cmake/FindBLAS.cmake index 236491f..ca50ef5 100644 --- a/cmake/FindBLAS.cmake +++ b/cmake/FindBLAS.cmake @@ -565,7 +565,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") endforeach() endforeach() - else () + else () # else not Windows if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") @@ -576,10 +576,10 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 - if (CMAKE_C_COMPILER MATCHES ".+gcc") + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core iomp5") - # "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") + # "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core iomp5") + "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") @@ -645,10 +645,9 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") "mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 - if (CMAKE_C_COMPILER MATCHES ".+gcc") + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list(APPEND BLAS_SEARCH_LIBS - # "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") - "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") From c903f63a00840940feaf165533065b30f5b26b87 Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Fri, 19 Jan 2018 15:43:26 +0100 Subject: [PATCH 09/13] add travis caching (1st attempt) --- .travis.yml | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc35cec..dfbe889 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,22 +7,41 @@ env: global: - secure: "ReYURSvDLRz078njJgh2i/KvwLc/3fGPkgjf6mLLoHWgz7vSuh24B5z10Th2UMQo9op66qcZ2WcooYIqeEHGbmYuBGGKd2axsGUEXqoclG9SdNsa5BoCA9iiLlLiMgIO+Kp1EuSbWcrpVRs/BiXya1iN+lpBErsWHGaXJP8idexnCepMLYgzUDu/FNuZJwRHMX1cvqK7wxOkCwXJRqEfbA+fn1/oCb+YAPpEet12kFNu1RRk6g+ui7g5XuAVHISj+UHbr5+GNYR6gD8476EkjUm38ssnPKxTvydj1QXcEw6weRDpevFByum5fDf2vHgojo5dNvhIio4gENkfbwbd2azVitHtE7boByb/AO3z3YcFhDRu0ETgCEZWIDrQWwkAubf+sB2MWyKGCPGQaECrVGDD2JzV6kX0lMCVaPQONggFBmJQwcHodLxXurpupmttJ+W4aZf5EsQsGPIYNegMnkdHAgTHxuPUtyDIlOJfTrUt1qPRh+yKGvmX7/C+AirXFIbxOemTdx3w0Y3CbhVxP2jDoP45rPzC17EI06gdQJaWzx5//LKkwcsAmox0bXrKHDOuMJNWVA6ZhBd3fGascMh4tgdSYc9yuRyAb0ygP0obUXp6PXU0TFxeenCaA9YAZrg6OXzS115lcnak8Xfyi+fmlfjrT8BSVk9bL9/3t2I=" +cache: + ccache: true + directories: + - $HOME/downloads + matrix: include: - os: linux env: - BACKEND=Intel10_64lp_seq - BUILD_STATIC=1 - - os: linux - env: - - BACKEND=Intel10_64lp - - BUILD_STATIC=1 + # - os: linux + # env: + # - BACKEND=Intel10_64lp + # - BUILD_STATIC=1 before_install: # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - mkdir -p "${DEPS_DIR}" + - export DL_DIR=$HOME/downloads + - | + function _download() { + url="$1"; f="${2:-$(basename $url)}"; + if [ ! -e $DL_DIR/$f ] ; then + mkdir -p $DL_DIR ; + echo "Downloading: ${DL_DIR}/$f" ; + travis_retry wget --no-verbose $url -O $DL_DIR/$f ; + else + echo "Reading from cache: ${DL_DIR}/$f" ; + fi + } + - function download() { _download "$1" "" ; } + # Travis machines have 2 cores - JOBS=2 @@ -52,8 +71,9 @@ before_install: if [[ "${BACKEND}" == *"Intel"* ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export MKL_INSTALL_DIR=$(pwd)/intel - wget --no-verbose http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12070/l_mkl_2018.0.128.tgz - tar -xzf l_mkl_2018.0.128.tgz + export ARCH_FNAME=l_mkl_2018.0.128.tgz + download http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12070/${ARCH_FNAME} + tar -xzf $DL_DIR/${ARCH_FNAME} cat l_mkl_2018.0.128/silent.cfg | grep -v EULA | grep -v PSET_INSTALL_DIR > silent.cfg echo "ACCEPT_EULA=accept" >> silent.cfg echo "PSET_INSTALL_DIR=${MKL_INSTALL_DIR}" >> silent.cfg @@ -62,8 +82,9 @@ before_install: . ${MKL_INSTALL_DIR}/mkl/bin/mklvars.sh intel64 ilp64 else # Mac export MKL_INSTALL_DIR=/opt/intel - wget --no-verbose http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12185/m_mkl_2017.4.220.dmg - hdiutil attach m_mkl_2017.4.220.dmg + export ARCH_FNAME=m_mkl_2017.4.220.dmg + download http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/12185/${ARCH_FNAME} + hdiutil attach $DL_DIR/${ARCH_FNAME} cat /Volumes/m_mkl_2017.4.220/m_mkl_2017.4.220.app/Contents/MacOS/silent.cfg | grep -v EULA | grep -v PSET_INSTALL_DIR > silent.cfg echo "ACCEPT_EULA=accept" >> silent.cfg echo "PSET_INSTALL_DIR=${MKL_INSTALL_DIR}" >> silent.cfg From 50c575b307a9e344af4de3b7e55e40a8f025636f Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Fri, 19 Jan 2018 16:03:58 +0100 Subject: [PATCH 10/13] put back travis parallel static build --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfbe889..8ce440d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,10 @@ matrix: env: - BACKEND=Intel10_64lp_seq - BUILD_STATIC=1 - # - os: linux - # env: - # - BACKEND=Intel10_64lp - # - BUILD_STATIC=1 + - os: linux + env: + - BACKEND=Intel10_64lp + - BUILD_STATIC=1 before_install: # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ From c5f51ec6693f10a514c0dc2b421234cf83be51ed Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Fri, 19 Jan 2018 16:50:16 +0100 Subject: [PATCH 11/13] try clang build --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8ce440d..f999387 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,13 +15,27 @@ cache: matrix: include: - os: linux + compiler: clang env: - BACKEND=Intel10_64lp_seq - BUILD_STATIC=1 + - CMAKE_C_COMPILER=clang + - CMAKE_CXX_COMPILER=clang++ - os: linux + compiler: clang env: - BACKEND=Intel10_64lp - BUILD_STATIC=1 + - CMAKE_C_COMPILER=clang + - CMAKE_CXX_COMPILER=clang++ + # - os: linux + # env: + # - BACKEND=Intel10_64lp_seq + # - BUILD_STATIC=1 + # - os: linux + # env: + # - BACKEND=Intel10_64lp + # - BUILD_STATIC=1 before_install: # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ From 1f399acf957f1d7e4daf9378ba729e3c3e10c019 Mon Sep 17 00:00:00 2001 From: Alexandre Gramfort Date: Fri, 19 Jan 2018 17:44:10 +0100 Subject: [PATCH 12/13] put back gcc builds --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index f999387..90833fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,14 +28,14 @@ matrix: - BUILD_STATIC=1 - CMAKE_C_COMPILER=clang - CMAKE_CXX_COMPILER=clang++ - # - os: linux - # env: - # - BACKEND=Intel10_64lp_seq - # - BUILD_STATIC=1 - # - os: linux - # env: - # - BACKEND=Intel10_64lp - # - BUILD_STATIC=1 + - os: linux + env: + - BACKEND=Intel10_64lp_seq + - BUILD_STATIC=1 + - os: linux + env: + - BACKEND=Intel10_64lp + - BUILD_STATIC=1 before_install: # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ From 8a38e945154b2ca833c0d67d31d1914abe9a9ab9 Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Tue, 23 Jan 2018 11:36:35 +0100 Subject: [PATCH 13/13] wip --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7ba5e3..8966f9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ set (CMakeHelloWorld_VERSION_MINOR 0) # Find the BLAS stuff set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package (Threads REQUIRED) find_package(BLAS REQUIRED) message(STATUS "BLAS Libraries: ${BLAS_LIBRARIES}") @@ -28,14 +30,14 @@ endif() # include the subdirectory containing our libs add_subdirectory(Hello) -include_directories(Hello) +target_include_directories(Hello) # indicate the entry point for the executable add_executable(CMakeHelloWorld Hello HelloWorld.cpp) -# BLAS libraries compile dynamically against threads -LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM}) +# # BLAS libraries compile dynamically against threads +# LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM}) # Indicate which libraries to include during the link process. -target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(CMakeHelloWorld Hello ${BLAS_LIBRARIES} Threads::Threads ${LM}) # install (TARGETS CMakeHelloWorld DESTINATION bin)