From 129e5d3116c5b90b7a2e32ac5ea178769eafe8af Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Fri, 18 Dec 2020 13:27:25 -0800 Subject: [PATCH 001/122] Tweaks after testing modules --- FindBLAS.cmake | 8 +++++--- FindBLIS.cmake | 11 ++++++----- FindIBMESSL.cmake | 11 ++++++----- FindIntelMKL.cmake | 22 +++++++++++++++++---- FindLAPACK.cmake | 4 ++-- FindReferenceLAPACK.cmake | 8 ++++++++ FindStandardFortran.cmake | 41 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 FindStandardFortran.cmake diff --git a/FindBLAS.cmake b/FindBLAS.cmake index a2ff8a0..3e87aae 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.11 ) # Require CMake 3.11+ +cmake_minimum_required( VERSION 3.17 ) # Require CMake 3.17+ include( CMakePushCheckState ) include( CheckLibraryExists ) @@ -49,8 +49,8 @@ if( NOT BLAS_LIBRARIES ) set( BLAS_VENDOR "${blas_type}" ) set( BLAS_LIBRARIES "${${blas_type}_LIBRARIES}" ) set( BLAS_COMPILE_DEFINITIONS "${${blas_type}_COMPILE_DEFINITIONS}" ) - set( BLAS_INCLUDE_DIR "${${blas_type}_INCLUDE_DIR}" ) - + set( BLAS_INCLUDE_DIRS "${${blas_type}_INCLUDE_DIR}" ) + set( BLAS_COMPILE_OPTIONS "${${blas_type}_C_COMPILE_FLAGS}" ) # Generic Components #set( BLAS_headers_FOUND ${${blas_type}_headers_FOUND} ) @@ -110,6 +110,8 @@ if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) add_library( BLAS::BLAS INTERFACE IMPORTED ) set_target_properties( BLAS::BLAS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}" + INTERFACE_COMPILE_OPTIONS "${BLAS_COMPILE_OPTIONS}" INTERFACE_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" ) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index d7f5a65..4345ac2 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -9,6 +9,8 @@ else() set( BLIS_LIBRARY_NAME "blis" ) endif() +set( BLIS_PREFIX ${BLISROOT} $ENV{BLISROOT} ) + find_library( BLIS_LIBRARIES NAMES ${BLIS_LIBRARY_NAME} HINTS ${BLIS_PREFIX} @@ -25,11 +27,10 @@ find_path( BLIS_INCLUDE_DIR DOC "BLIS header" ) -#if( BLIS_LIBRARY AND BLIS_PREFERS_STATIC ) -# include( CMakeFindDependency ) -# find_package( Threads QUIET ) -# set( BLIS_LIBRARIES ${BLIS_LIBRARY} Threads::Threads "m") -#endif() +if( BLIS_LIBRARIES ) + find_package( Threads QUIET ) + set( BLIS_LIBRARIES ${BLIS_LIBRARIES} Threads::Threads "m") +endif() # check ILP64 if( BLIS_INCLUDE_DIR ) diff --git a/FindIBMESSL.cmake b/FindIBMESSL.cmake index bcd003a..b1c569f 100644 --- a/FindIBMESSL.cmake +++ b/FindIBMESSL.cmake @@ -8,11 +8,11 @@ set( IBMESSL_ILP64_SERIAL_LIBRARY_NAME "essl6464" ) set( IBMESSL_ILP64_SMP_LIBRARY_NAME "esslsmp6464" ) -if( NOT IBMESSL_PREFERED_THREAD_LEVEL ) - set( IBMESSL_PREFERED_THREAD_LEVEL "smp" ) +if( NOT IBMESSL_THREAD_LAYER ) + set( IBMESSL_THREAD_LAYER "smp" ) endif() -if( IBMESSL_PREFERED_THREAD_LEVEL MATCHES "smp" ) +if( IBMESSL_THREAD_LAYER MATCHES "smp" ) set( IBMESSL_LP64_LIBRARY_NAME ${IBMESSL_LP64_SMP_LIBRARY_NAME} ) set( IBMESSL_ILP64_LIBRARY_NAME ${IBMESSL_ILP64_SMP_LIBRARY_NAME} ) else() @@ -20,6 +20,9 @@ else() set( IBMESSL_ILP64_LIBRARY_NAME ${IBMESSL_ILP64_SERIAL_LIBRARY_NAME} ) endif() +if( NOT IBMESSL_PREFIX ) + set( IBMESSL_PREFIX ${ESSLROOT} $ENV{ESSLROOT} ) +endif() find_path( IBMESSL_INCLUDE_DIR NAMES essl.h @@ -71,12 +74,10 @@ endif() # LP64 Default if( "ilp64" IN_LIST IBMESSL_FIND_COMPONENTS ) set( IBMESSL_LIBRARIES "${IBMESSL_ILP64_LIBRARIES}" ) - else() set( IBMESSL_LIBRARIES "${IBMESSL_LP64_LIBRARIES}" ) endif() - include(FindPackageHandleStandardArgs) find_package_handle_standard_args( IBMESSL REQUIRED_VARS IBMESSL_LIBRARIES IBMESSL_INCLUDE_DIR diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 721d379..6a4fab8 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -67,6 +67,11 @@ else() set( IntelMKL_ILP64_SGIMPT_BLACS_LIBRARY_NAME "mkl_blacs_sgimpt_ilp64" ) endif() +if( IntelMKL_PREFERS_STATIC AND ENABLE_DPCPP) + set( IntelMKL_SYCL_LIBRARY_NAME "libmkl_sycl.a" ) +elseif(ENABLE_DPCPP) + set( IntelMKL_SYCL_LIBRARY_NAME "mkl_sycl" ) +endif() # Defaults if( NOT IntelMKL_THREAD_LAYER ) @@ -78,7 +83,7 @@ if( NOT IntelMKL_MPI_LIBRARY ) endif() if( NOT IntelMKL_PREFIX ) - set( IntelMKL_PREFIX $ENV{MKLROOT} ) + set( IntelMKL_PREFIX ${MKLROOT} $ENV{MKLROOT} ) endif() @@ -193,8 +198,6 @@ find_library( IntelMKL_CORE_LIBRARY DOC "Intel(R) MKL CORE Library" ) - - # Check version if( EXISTS ${IntelMKL_INCLUDE_DIR}/mkl_version.h ) set( version_pattern @@ -253,6 +256,16 @@ else() set( IntelMKL_lp64_FOUND FALSE ) endif() +# SYCL +if(ENABLE_DPCPP) + find_library( Intelmkl_SYCL_LIBRARY + NAMES ${IntelMKL_SYCL_LIBRARY_NAME} + HINTS ${Intelmkl_PREFIX} + PATHS ${Intelmkl_LIBRARY_DIR} ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES} + PATH_SUFFIXES lib/intel64 lib/ia32 + DOC "Intel(R) MKL SYCL Library" + ) +endif() # BLACS / ScaLAPACK @@ -343,7 +356,8 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) set( IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_LIBRARY} ${IntelMKL_THREAD_LIBRARY} - ${IntelMKL_CORE_LIBRARY} ) + ${IntelMKL_CORE_LIBRARY} + ${Intelmkl_SYCL_LIBRARY}) if( "blacs" IN_LIST IntelMKL_FIND_COMPONENTS ) set( IntelMKL_BLACS_LIBRARIES diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index dbcfab2..8e99bf7 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.11 ) # Require CMake 3.11+ +cmake_minimum_required( VERSION 3.17 ) # Require CMake 3.17+ include( CMakePushCheckState ) include( CheckLibraryExists ) @@ -44,7 +44,7 @@ if( NOT LAPACK_LIBRARIES ) # Check if BLAS contains a LAPACK linker message( STATUS "LAPACK_LIBRARIES Not Given: Checking for LAPACK in BLAS" ) set( LAPACK_LIBRARIES ${BLAS_LIBRARIES} ) - set( LAPACK_INCLUDE_DIR ${BLAS_INCLUDE_DIR} ) + set( LAPACK_INCLUDE_DIR ${BLAS_INCLUDE_DIRS} ) set( LAPACK_COMPILE_DEFINITIONS ${BLAS_COMPILE_DEFINITIONS} ) check_dpstrf_exists( LAPACK_LIBRARIES BLAS_HAS_LAPACK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE diff --git a/FindReferenceLAPACK.cmake b/FindReferenceLAPACK.cmake index 238cf55..f01959e 100644 --- a/FindReferenceLAPACK.cmake +++ b/FindReferenceLAPACK.cmake @@ -11,6 +11,8 @@ else() set( ReferenceLAPACK_ILP64_LIBRARY_NAME "lapack64" ) endif() +set( ReferenceLAPACK_PREFIX ${ReferenceLAPACKROOT} $ENV{ReferenceLAPACKROOT} ) + find_library( ReferenceLAPACK_LP64_LIBRARIES NAMES ${ReferenceLAPACK_LP64_LIBRARY_NAME} HINTS ${ReferenceLAPACK_PREFIX} @@ -46,6 +48,12 @@ else() set( ReferenceLAPACK_LIBRARIES ${ReferenceLAPACK_LP64_LIBRARIES} ) endif() +find_package(StandardFortran REQUIRED) + +if( STANDARDFORTRAN_LIBRARIES ) + set( ReferenceLAPACK_LIBRARIES ${ReferenceLAPACK_LIBRARIES} ${STANDARDFORTRAN_LIBRARIES} ) +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args( ReferenceLAPACK diff --git a/FindStandardFortran.cmake b/FindStandardFortran.cmake new file mode 100644 index 0000000..95ef5fa --- /dev/null +++ b/FindStandardFortran.cmake @@ -0,0 +1,41 @@ +# +# This module will locate the Fortran standard libraries so that a Fortran +# object or library can be linked against using a C/C++ compiler. +# +# After calling this module the following will be set: +# STANDARDFORTRAN_LIBRARIES : A list of libraries to link against +# StandardFortran_FOUND : True if we found the standard Fortran libraries +# +# Implemenation note. CMake provides a variable +# CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES which is a list of all libraries a +# compiler implicitly links against. Unfortunately, at least for GNU, this +# list includes a lot of extra libraries that we don't necessarilly want to +# link against (including both static and shared versions of libgcc). This is +# why we've hardcoded the list per compiler. +# +enable_language(Fortran) +include(FindPackageHandleStandardArgs) + +if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") + set(STANDARDFORTRAN_LIBS gfortran) +elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + set(STANDARDFORTRAN_LIBS ifcore) +elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang") + set(STANDARDFORTRAN_LIBS flang flangrti pgmath) +else() + message(FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} not supported yet.") +endif() + +foreach(STANDARDFORTRAN_LIB ${STANDARDFORTRAN_LIBS}) + set(STANDARDFORTRAN_LIB_NAME + lib${STANDARDFORTRAN_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX}) + find_library(${STANDARDFORTRAN_LIB}_LIBRARY + ${STANDARDFORTRAN_LIB_NAME} + HINTS ${CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES} + ) + list(APPEND STANDARDFORTRAN_LIBRARIES ${${STANDARDFORTRAN_LIB}_LIBRARY}) +endforeach() + +find_package_handle_standard_args(StandardFortran DEFAULT_MSG + STANDARDFORTRAN_LIBRARIES) +set(STANDARDFORTRAN_FOUND ${StandardFortran_FOUND}) From 3b337834e5d810b2b2169d06d2494c09b75d4246 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Fri, 18 Dec 2020 13:29:46 -0800 Subject: [PATCH 002/122] fix --- FindBLAS.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 3e87aae..81055e5 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -110,7 +110,6 @@ if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) add_library( BLAS::BLAS INTERFACE IMPORTED ) set_target_properties( BLAS::BLAS PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}" INTERFACE_COMPILE_OPTIONS "${BLAS_COMPILE_OPTIONS}" INTERFACE_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" From e206ac8814dbe388b0565d964c1666899b4f8b8a Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Fri, 18 Dec 2020 15:08:58 -0800 Subject: [PATCH 003/122] check BLIS_PREFIX --- FindBLIS.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index 4345ac2..db4ed2a 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -9,7 +9,9 @@ else() set( BLIS_LIBRARY_NAME "blis" ) endif() -set( BLIS_PREFIX ${BLISROOT} $ENV{BLISROOT} ) +if( NOT BLIS_PREFIX ) + set( BLIS_PREFIX ${BLISROOT} $ENV{BLISROOT} ) +endif() find_library( BLIS_LIBRARIES NAMES ${BLIS_LIBRARY_NAME} From eff61c6398245ef97014e25649bedcb86d28fa7c Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Sat, 19 Dec 2020 22:23:43 -0800 Subject: [PATCH 004/122] fix prefix --- FindOpenBLAS.cmake | 4 +++ FindReferenceLAPACK.cmake | 4 ++- FindReferenceScaLAPACK.cmake | 4 +++ FindScaLAPACK.cmake | 64 ++++-------------------------------- 4 files changed, 17 insertions(+), 59 deletions(-) diff --git a/FindOpenBLAS.cmake b/FindOpenBLAS.cmake index 93f5e9c..56fb6f6 100644 --- a/FindOpenBLAS.cmake +++ b/FindOpenBLAS.cmake @@ -9,6 +9,10 @@ else() set( OpenBLAS_LIBRARY_NAME "openblas" ) endif() +if( NOT OpenBLAS_PREFIX ) + set( OpenBLAS_PREFIX ${OpenBLASROOT} $ENV{OpenBLASROOT} ) +endif() + find_library( OpenBLAS_LIBRARIES NAMES ${OpenBLAS_LIBRARY_NAME} HINTS ${OpenBLAS_PREFIX} diff --git a/FindReferenceLAPACK.cmake b/FindReferenceLAPACK.cmake index f01959e..f458bc8 100644 --- a/FindReferenceLAPACK.cmake +++ b/FindReferenceLAPACK.cmake @@ -11,7 +11,9 @@ else() set( ReferenceLAPACK_ILP64_LIBRARY_NAME "lapack64" ) endif() -set( ReferenceLAPACK_PREFIX ${ReferenceLAPACKROOT} $ENV{ReferenceLAPACKROOT} ) +if( NOT ReferenceLAPACK_PREFIX ) + set( ReferenceLAPACK_PREFIX ${ReferenceLAPACKROOT} $ENV{ReferenceLAPACKROOT} ) +endif() find_library( ReferenceLAPACK_LP64_LIBRARIES NAMES ${ReferenceLAPACK_LP64_LIBRARY_NAME} diff --git a/FindReferenceScaLAPACK.cmake b/FindReferenceScaLAPACK.cmake index 2de366c..1a8b0dd 100644 --- a/FindReferenceScaLAPACK.cmake +++ b/FindReferenceScaLAPACK.cmake @@ -16,6 +16,10 @@ else() set( ReferenceScaLAPACK_ILP64_LIBRARY_NAME "scalapack64" ) endif() +if( NOT ReferenceScaLAPACK_PREFIX ) + set( ReferenceScaLAPACK_PREFIX ${ReferenceScaLAPACKROOT} $ENV{ReferenceScaLAPACKROOT} ) +endif() + find_library( ReferenceScaLAPACK_LP64_LIBRARIES NAMES ${ReferenceScaLAPACK_LP64_LIBRARY_NAME} HINTS ${ReferenceScaLAPACK_PREFIX} diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 79697cc..52d6775 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -9,10 +9,7 @@ # # This module will export the following targets if SCALAPACK_FOUND # -# ScaLAPACK::scalapack -# -# -# +# ScaLAPACK::ScaLAPACK # # Proper usage: # @@ -21,64 +18,18 @@ # # if( ScaLAPACK_FOUND ) # add_executable( test test.cxx ) -# target_link_libraries( test ScaLAPACK::scalapack ) +# target_link_libraries( test ScaLAPACK::ScaLAPACK ) # endif() # # -# -# # This module will use the following variables to change # default behaviour if set # -# scalapack_PREFIX -# scalapack_LIBRARY_DIR -# scalapack_LIBRARIES -# -#================================================================== -# Copyright (c) 2018 The Regents of the University of California, -# through Lawrence Berkeley National Laboratory. -# -# Author: David Williams-Young -# -# This file is part of cmake-modules. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# (3) Neither the name of the University of California, Lawrence Berkeley -# National Laboratory, U.S. Dept. of Energy nor the names of its contributors may -# be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# You are under no obligation whatsoever to provide any bug fixes, patches, or -# upgrades to the features, functionality or performance of the source code -# ("Enhancements") to anyone; however, if you choose to make your Enhancements -# available either publicly, or directly to Lawrence Berkeley National -# Laboratory, without imposing a separate written license agreement for such -# Enhancements, then you hereby grant the following license: a non-exclusive, -# royalty-free perpetual license to install, use, modify, prepare derivative -# works, incorporate into other computer software, distribute, and sublicense -# such enhancements or derivative works thereof, in binary and source code form. -# -#================================================================== +# ScaLAPACK_PREFIX +# ScaLAPACK_LIBRARY_DIR +# ScaLAPACK_LIBRARIES -cmake_minimum_required( VERSION 3.11 ) # Require CMake 3.11+ +cmake_minimum_required( VERSION 3.17 ) # Require CMake 3.17+ include( CMakeFindDependencyMacro ) @@ -220,9 +171,6 @@ else() endif() - - - find_package_handle_standard_args( ScaLAPACK REQUIRED_VARS ScaLAPACK_LINK_OK HANDLE_COMPONENTS From dbdf45fa95c027ed33b3aa5f1887988eb0ada745 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Sat, 19 Dec 2020 22:27:36 -0800 Subject: [PATCH 005/122] missed Ref.BLAS prefix --- FindReferenceBLAS.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FindReferenceBLAS.cmake b/FindReferenceBLAS.cmake index 8a9904b..7f6b992 100644 --- a/FindReferenceBLAS.cmake +++ b/FindReferenceBLAS.cmake @@ -11,6 +11,10 @@ else() set( ReferenceBLAS_ILP64_LIBRARY_NAME "blas64" ) endif() +if( NOT ReferenceBLAS_PREFIX ) + set( ReferenceBLAS_PREFIX ${ReferenceBLASROOT} $ENV{ReferenceBLASROOT} ) +endif() + find_library( ReferenceBLAS_LP64_LIBRARIES NAMES ${ReferenceBLAS_LP64_LIBRARY_NAME} HINTS ${ReferenceBLAS_PREFIX} From dcaf472706d3a49e6e7706e5260d2626d453b027 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Mon, 21 Dec 2020 17:36:09 -0800 Subject: [PATCH 006/122] throw error when ilp64 interface is requested for ScaLAPACK discovery --- FindReferenceScaLAPACK.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FindReferenceScaLAPACK.cmake b/FindReferenceScaLAPACK.cmake index 1a8b0dd..3ea984b 100644 --- a/FindReferenceScaLAPACK.cmake +++ b/FindReferenceScaLAPACK.cmake @@ -3,6 +3,10 @@ if( "ilp64" IN_LIST ReferenceScaLAPACK_FIND_COMPONENTS AND "lp64" IN_LIST Refere message( FATAL_ERROR "ReferenceScaLAPACK cannot link to both ILP64 and LP64 iterfaces" ) endif() +if( "ilp64" IN_LIST ReferenceScaLAPACK_FIND_COMPONENTS ) + message( FATAL_ERROR "ReferenceScaLAPACK ILP64 interface discovery is currently not supported" ) +endif() + if( NOT TARGET MPI::MPI_C ) enable_language(C) find_dependency( MPI ) From a5cd7fc23041ef6da554c130a743b7458b02f555 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Mon, 21 Dec 2020 19:04:27 -0800 Subject: [PATCH 007/122] Add Fortran compile flags for Flang --- FindIntelMKL.cmake | 4 ++++ FindStandardFortran.cmake | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 6a4fab8..aadb000 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -309,7 +309,11 @@ if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS ) set( IntelMKL_COMPILE_DEFINITIONS "MKL_ILP64" ) if( CMAKE_C_COMPILER_ID MATCHES "GNU" ) set( IntelMKL_C_COMPILE_FLAGS "-m64" ) + endif() + if( CMAKE_Fortran_COMPILER_ID MATCHES "GNU" ) set( IntelMKL_Fortran_COMPILE_FLAGS "-m64" "-fdefault-integer-8" ) + elseif( CMAKE_Fortran_COMPILER_ID MATCHES "Flang" ) + set( IntelMKL_Fortran_COMPILE_FLAGS "-fdefault-integer-8" ) elseif( CMAKE_C_COMPILER_ID MATCHES "PGI" ) set( IntelMKL_Fortran_COMPILE_FLAGS "-i8" ) endif() diff --git a/FindStandardFortran.cmake b/FindStandardFortran.cmake index 95ef5fa..9b288bd 100644 --- a/FindStandardFortran.cmake +++ b/FindStandardFortran.cmake @@ -16,11 +16,11 @@ enable_language(Fortran) include(FindPackageHandleStandardArgs) -if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") +if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(STANDARDFORTRAN_LIBS gfortran) -elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") set(STANDARDFORTRAN_LIBS ifcore) -elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang") set(STANDARDFORTRAN_LIBS flang flangrti pgmath) else() message(FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} not supported yet.") From 45ef468637795034a759619516bc4bc98c2d0e40 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 22 Dec 2020 17:24:54 -0800 Subject: [PATCH 008/122] mkl_sycl discovery cleanup --- FindIntelMKL.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index aadb000..eca47ea 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -36,6 +36,7 @@ if( IntelMKL_PREFERS_STATIC ) set( IntelMKL_OMP_PGI_LIBRARY_NAME "libmkl_pgi_thread.a" ) set( IntelMKL_TBB_LIBRARY_NAME "libmkl_tbb_thread.a" ) set( IntelMKL_CORE_LIBRARY_NAME "libmkl_core.a" ) + set( IntelMKL_SYCL_LIBRARY_NAME "libmkl_sycl.a" ) set( IntelMKL_LP64_ScaLAPACK_LIBRARY_NAME "libmkl_scalapack_lp64.a" ) set( IntelMKL_ILP64_ScaLAPACK_LIBRARY_NAME "libmkl_scalapack_ilp64.a" ) @@ -55,6 +56,7 @@ else() set( IntelMKL_OMP_PGI_LIBRARY_NAME "mkl_pgi_thread" ) set( IntelMKL_TBB_LIBRARY_NAME "mkl_tbb_thread" ) set( IntelMKL_CORE_LIBRARY_NAME "mkl_core" ) + set( IntelMKL_SYCL_LIBRARY_NAME "mkl_sycl" ) set( IntelMKL_LP64_ScaLAPACK_LIBRARY_NAME "mkl_scalapack_lp64" ) set( IntelMKL_ILP64_ScaLAPACK_LIBRARY_NAME "mkl_scalapack_ilp64" ) @@ -67,11 +69,6 @@ else() set( IntelMKL_ILP64_SGIMPT_BLACS_LIBRARY_NAME "mkl_blacs_sgimpt_ilp64" ) endif() -if( IntelMKL_PREFERS_STATIC AND ENABLE_DPCPP) - set( IntelMKL_SYCL_LIBRARY_NAME "libmkl_sycl.a" ) -elseif(ENABLE_DPCPP) - set( IntelMKL_SYCL_LIBRARY_NAME "mkl_sycl" ) -endif() # Defaults if( NOT IntelMKL_THREAD_LAYER ) @@ -257,11 +254,11 @@ else() endif() # SYCL -if(ENABLE_DPCPP) - find_library( Intelmkl_SYCL_LIBRARY +if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) + find_library( IntelMKL_SYCL_LIBRARY NAMES ${IntelMKL_SYCL_LIBRARY_NAME} - HINTS ${Intelmkl_PREFIX} - PATHS ${Intelmkl_LIBRARY_DIR} ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES} + HINTS ${IntelMKL_PREFIX} + PATHS ${IntelMKL_LIBRARY_DIR} ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES} PATH_SUFFIXES lib/intel64 lib/ia32 DOC "Intel(R) MKL SYCL Library" ) @@ -360,8 +357,11 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) set( IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_LIBRARY} ${IntelMKL_THREAD_LIBRARY} - ${IntelMKL_CORE_LIBRARY} - ${Intelmkl_SYCL_LIBRARY}) + ${IntelMKL_CORE_LIBRARY} ) + + if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) + list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_SYCL_LIBRARY} ) + endif() if( "blacs" IN_LIST IntelMKL_FIND_COMPONENTS ) set( IntelMKL_BLACS_LIBRARIES From 0b4024946f1deb518bb2d1a45d6a1c6a968a5cc4 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 22 Dec 2020 18:16:14 -0800 Subject: [PATCH 009/122] fix --- FindIntelMKL.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index eca47ea..d12a607 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -254,7 +254,7 @@ else() endif() # SYCL -if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) +if(ENABLE_DPCPP) find_library( IntelMKL_SYCL_LIBRARY NAMES ${IntelMKL_SYCL_LIBRARY_NAME} HINTS ${IntelMKL_PREFIX} @@ -358,8 +358,8 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) ${IntelMKL_LIBRARY} ${IntelMKL_THREAD_LIBRARY} ${IntelMKL_CORE_LIBRARY} ) - - if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) + + if(ENABLE_DPCPP) list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_SYCL_LIBRARY} ) endif() From a886d313445031e99e26c3846e29182cf4745ed3 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Mon, 28 Dec 2020 16:30:17 -0800 Subject: [PATCH 010/122] Fix for Threads discovery on MACOS --- FindBLIS.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index db4ed2a..ccea774 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -30,8 +30,11 @@ find_path( BLIS_INCLUDE_DIR ) if( BLIS_LIBRARIES ) - find_package( Threads QUIET ) - set( BLIS_LIBRARIES ${BLIS_LIBRARIES} Threads::Threads "m") + if(CMAKE_HOST_SYSTEM_NAME MATCHES Darwin) + set(THREADS_PREFER_PTHREAD_FLAG ON) + endif() + find_package( Threads QUIET ) + set( BLIS_LIBRARIES ${BLIS_LIBRARIES} Threads::Threads "m") endif() # check ILP64 From 89c82b78505f60657ef33b5bf38e5da059dff7f2 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Tue, 29 Dec 2020 14:53:02 -0500 Subject: [PATCH 011/122] Hardcode macro installation paths --- LinAlgModulesMacros.cmake | 50 +++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index 5c42131..fb66bb2 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -2,13 +2,49 @@ set( LINALG_MACROS_DIR ${CMAKE_CURRENT_LIST_DIR} ) function( install_linalg_modules _dest_dir ) -install( DIRECTORY ${LINALG_MACROS_DIR} - DESTINATION ${${_dest_dir}} - FILES_MATCHING - REGEX "Find.*cmake" - REGEX "util/.*" - REGEX ".*git.*" EXCLUDE - REGEX ".*examples.*" EXCLUDE +set( LINALG_FIND_MODULES + FindBLAS.cmake + FindBLIS.cmake + FindIBMESSL.cmake + FindIntelMKL.cmake + FindLAPACK.cmake + FindOpenBLAS.cmake + FindReferenceBLAS.cmake + FindReferenceLAPACK.cmake + FindReferenceScaLAPACK.cmake + FindScaLAPACK.cmake + LinAlgModulesMacros.cmake ) +set( LINALG_UTIL_FILES + util/blis_int_size.c + util/func_check.c + util/get_mpi_vendor.c + util/ilp64_checker.c + util/lapack_ilp64_checker.c + util/openblas_int_size.c + util/BLASUtilities.cmake + util/CommonFunctions.cmake + util/IntrospectMPI.cmake + util/IntrospectOpenMP.cmake + util/LAPACKUtilities.cmake + util/ScaLAPACKUtilities.cmake ) + +list( TRANSFORM LINALG_FIND_MODULES + PREPEND ${LINALG_MACROS_DIR}/ ) +list( TRANSFORM LINALG_UTIL_FILES + PREPEND ${LINALG_MACROS_DIR}/ ) + +install( + FILES ${LINALG_FIND_MODULES} + DESTINATION ${${_dest_dir}}/linalg-cmake-modules +) + +install( + FILES ${LINALG_UTIL_FILES} + DESTINATION ${${_dest_dir}}/linalg-cmake-modules/util +) + + + endfunction() From 6c871d63cf91b58d151654e21f9490a2c46b71ab Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 29 Dec 2020 14:18:57 -0800 Subject: [PATCH 012/122] revert --- FindBLIS.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index ccea774..1a11d12 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -30,9 +30,6 @@ find_path( BLIS_INCLUDE_DIR ) if( BLIS_LIBRARIES ) - if(CMAKE_HOST_SYSTEM_NAME MATCHES Darwin) - set(THREADS_PREFER_PTHREAD_FLAG ON) - endif() find_package( Threads QUIET ) set( BLIS_LIBRARIES ${BLIS_LIBRARIES} Threads::Threads "m") endif() From fcfbc517d0adbdbcced36a85241755057b3d5e69 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Sun, 3 Jan 2021 17:17:48 -0800 Subject: [PATCH 013/122] remove ROOT vars --- FindBLIS.cmake | 4 ---- FindIBMESSL.cmake | 4 ---- FindIntelMKL.cmake | 2 +- FindOpenBLAS.cmake | 4 ---- FindReferenceBLAS.cmake | 4 ---- FindReferenceLAPACK.cmake | 4 ---- FindReferenceScaLAPACK.cmake | 4 ---- 7 files changed, 1 insertion(+), 25 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index 1a11d12..9bee08c 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -9,10 +9,6 @@ else() set( BLIS_LIBRARY_NAME "blis" ) endif() -if( NOT BLIS_PREFIX ) - set( BLIS_PREFIX ${BLISROOT} $ENV{BLISROOT} ) -endif() - find_library( BLIS_LIBRARIES NAMES ${BLIS_LIBRARY_NAME} HINTS ${BLIS_PREFIX} diff --git a/FindIBMESSL.cmake b/FindIBMESSL.cmake index b1c569f..1de3947 100644 --- a/FindIBMESSL.cmake +++ b/FindIBMESSL.cmake @@ -20,10 +20,6 @@ else() set( IBMESSL_ILP64_LIBRARY_NAME ${IBMESSL_ILP64_SERIAL_LIBRARY_NAME} ) endif() -if( NOT IBMESSL_PREFIX ) - set( IBMESSL_PREFIX ${ESSLROOT} $ENV{ESSLROOT} ) -endif() - find_path( IBMESSL_INCLUDE_DIR NAMES essl.h HINTS ${IBMESSL_PREFIX} diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index d12a607..b82e7df 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -80,7 +80,7 @@ if( NOT IntelMKL_MPI_LIBRARY ) endif() if( NOT IntelMKL_PREFIX ) - set( IntelMKL_PREFIX ${MKLROOT} $ENV{MKLROOT} ) + set( IntelMKL_PREFIX $ENV{MKLROOT} ) endif() diff --git a/FindOpenBLAS.cmake b/FindOpenBLAS.cmake index 56fb6f6..93f5e9c 100644 --- a/FindOpenBLAS.cmake +++ b/FindOpenBLAS.cmake @@ -9,10 +9,6 @@ else() set( OpenBLAS_LIBRARY_NAME "openblas" ) endif() -if( NOT OpenBLAS_PREFIX ) - set( OpenBLAS_PREFIX ${OpenBLASROOT} $ENV{OpenBLASROOT} ) -endif() - find_library( OpenBLAS_LIBRARIES NAMES ${OpenBLAS_LIBRARY_NAME} HINTS ${OpenBLAS_PREFIX} diff --git a/FindReferenceBLAS.cmake b/FindReferenceBLAS.cmake index 7f6b992..8a9904b 100644 --- a/FindReferenceBLAS.cmake +++ b/FindReferenceBLAS.cmake @@ -11,10 +11,6 @@ else() set( ReferenceBLAS_ILP64_LIBRARY_NAME "blas64" ) endif() -if( NOT ReferenceBLAS_PREFIX ) - set( ReferenceBLAS_PREFIX ${ReferenceBLASROOT} $ENV{ReferenceBLASROOT} ) -endif() - find_library( ReferenceBLAS_LP64_LIBRARIES NAMES ${ReferenceBLAS_LP64_LIBRARY_NAME} HINTS ${ReferenceBLAS_PREFIX} diff --git a/FindReferenceLAPACK.cmake b/FindReferenceLAPACK.cmake index f458bc8..1421194 100644 --- a/FindReferenceLAPACK.cmake +++ b/FindReferenceLAPACK.cmake @@ -11,10 +11,6 @@ else() set( ReferenceLAPACK_ILP64_LIBRARY_NAME "lapack64" ) endif() -if( NOT ReferenceLAPACK_PREFIX ) - set( ReferenceLAPACK_PREFIX ${ReferenceLAPACKROOT} $ENV{ReferenceLAPACKROOT} ) -endif() - find_library( ReferenceLAPACK_LP64_LIBRARIES NAMES ${ReferenceLAPACK_LP64_LIBRARY_NAME} HINTS ${ReferenceLAPACK_PREFIX} diff --git a/FindReferenceScaLAPACK.cmake b/FindReferenceScaLAPACK.cmake index 3ea984b..95bae4e 100644 --- a/FindReferenceScaLAPACK.cmake +++ b/FindReferenceScaLAPACK.cmake @@ -20,10 +20,6 @@ else() set( ReferenceScaLAPACK_ILP64_LIBRARY_NAME "scalapack64" ) endif() -if( NOT ReferenceScaLAPACK_PREFIX ) - set( ReferenceScaLAPACK_PREFIX ${ReferenceScaLAPACKROOT} $ENV{ReferenceScaLAPACKROOT} ) -endif() - find_library( ReferenceScaLAPACK_LP64_LIBRARIES NAMES ${ReferenceScaLAPACK_LP64_LIBRARY_NAME} HINTS ${ReferenceScaLAPACK_PREFIX} From 23bc3623307c6fa5eabb048b16c10188056b5ebe Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 5 Jan 2021 20:23:51 -0800 Subject: [PATCH 014/122] find std. fortran libs --- FindBLAS.cmake | 6 +++- FindIntelMKL.cmake | 1 + FindLAPACK.cmake | 2 +- FindReferenceLAPACK.cmake | 7 ----- FindStandardFortran.cmake | 2 +- LinAlgModulesMacros.cmake | 59 ++++++++++++++++++++++++++++++----- util/BLASUtilities.cmake | 11 +++---- util/LAPACKUtilities.cmake | 13 +++----- util/ScaLAPACKUtilities.cmake | 13 +++----- 9 files changed, 72 insertions(+), 42 deletions(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 81055e5..565fcc6 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -8,6 +8,7 @@ include( FindPackageHandleStandardArgs ) include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) include( ${CMAKE_CURRENT_LIST_DIR}/util/BLASUtilities.cmake ) +include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) # SANITY CHECK: Make sure only one integer interface is requested if( "ilp64" IN_LIST BLAS_FIND_COMPONENTS AND "lp64" IN_LIST BLAS_FIND_COMPONENTS ) @@ -50,7 +51,7 @@ if( NOT BLAS_LIBRARIES ) set( BLAS_LIBRARIES "${${blas_type}_LIBRARIES}" ) set( BLAS_COMPILE_DEFINITIONS "${${blas_type}_COMPILE_DEFINITIONS}" ) set( BLAS_INCLUDE_DIRS "${${blas_type}_INCLUDE_DIR}" ) - set( BLAS_COMPILE_OPTIONS "${${blas_type}_C_COMPILE_FLAGS}" ) + set( BLAS_COMPILE_OPTIONS "${${blas_type}_COMPILE_OPTIONS}" ) # Generic Components #set( BLAS_headers_FOUND ${${blas_type}_headers_FOUND} ) @@ -63,6 +64,8 @@ if( NOT BLAS_LIBRARIES ) endforeach() +else() + find_linalg_dependencies( BLAS_LIBRARIES ) endif() @@ -110,6 +113,7 @@ if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) add_library( BLAS::BLAS INTERFACE IMPORTED ) set_target_properties( BLAS::BLAS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}" INTERFACE_COMPILE_OPTIONS "${BLAS_COMPILE_OPTIONS}" INTERFACE_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index b82e7df..84dd988 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -315,6 +315,7 @@ if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS ) set( IntelMKL_Fortran_COMPILE_FLAGS "-i8" ) endif() set( IntelMKL_LIBRARY ${IntelMKL_ILP64_LIBRARY} ) + set( IntelMKL_COMPILE_OPTIONS ${IntelMKL_C_COMPILE_FLAGS} ) if( IntelMKL_ILP64_BLACS_LIBRARY ) set( IntelMKL_BLACS_LIBRARY ${IntelMKL_ILP64_BLACS_LIBRARY} ) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 8e99bf7..84da177 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -44,7 +44,7 @@ if( NOT LAPACK_LIBRARIES ) # Check if BLAS contains a LAPACK linker message( STATUS "LAPACK_LIBRARIES Not Given: Checking for LAPACK in BLAS" ) set( LAPACK_LIBRARIES ${BLAS_LIBRARIES} ) - set( LAPACK_INCLUDE_DIR ${BLAS_INCLUDE_DIRS} ) + set( LAPACK_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS} ) set( LAPACK_COMPILE_DEFINITIONS ${BLAS_COMPILE_DEFINITIONS} ) check_dpstrf_exists( LAPACK_LIBRARIES BLAS_HAS_LAPACK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE diff --git a/FindReferenceLAPACK.cmake b/FindReferenceLAPACK.cmake index 1421194..459e0cf 100644 --- a/FindReferenceLAPACK.cmake +++ b/FindReferenceLAPACK.cmake @@ -46,13 +46,6 @@ else() set( ReferenceLAPACK_LIBRARIES ${ReferenceLAPACK_LP64_LIBRARIES} ) endif() -find_package(StandardFortran REQUIRED) - -if( STANDARDFORTRAN_LIBRARIES ) - set( ReferenceLAPACK_LIBRARIES ${ReferenceLAPACK_LIBRARIES} ${STANDARDFORTRAN_LIBRARIES} ) -endif() - - include(FindPackageHandleStandardArgs) find_package_handle_standard_args( ReferenceLAPACK REQUIRED_VARS ReferenceLAPACK_LIBRARIES diff --git a/FindStandardFortran.cmake b/FindStandardFortran.cmake index 9b288bd..6baeeb9 100644 --- a/FindStandardFortran.cmake +++ b/FindStandardFortran.cmake @@ -23,7 +23,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang") set(STANDARDFORTRAN_LIBS flang flangrti pgmath) else() - message(FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} not supported yet.") + message(FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} is not yet supported by this module.") endif() foreach(STANDARDFORTRAN_LIB ${STANDARDFORTRAN_LIBS}) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index 5c42131..43b5fe7 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -1,14 +1,59 @@ set( LINALG_MACROS_DIR ${CMAKE_CURRENT_LIST_DIR} ) +macro( find_linalg_dependencies _libs ) + foreach( _lib ${${_libs}} ) + if (${_lib} MATCHES "OpenMP::OpenMP") + find_package(OpenMP) + elseif (${_lib} MATCHES "Threads::Threads") + find_package(Threads) + endif() + endforeach() +endmacro() + function( install_linalg_modules _dest_dir ) -install( DIRECTORY ${LINALG_MACROS_DIR} - DESTINATION ${${_dest_dir}} - FILES_MATCHING - REGEX "Find.*cmake" - REGEX "util/.*" - REGEX ".*git.*" EXCLUDE - REGEX ".*examples.*" EXCLUDE +set( LINALG_FIND_MODULES + FindBLAS.cmake + FindBLIS.cmake + FindIBMESSL.cmake + FindIntelMKL.cmake + FindLAPACK.cmake + FindOpenBLAS.cmake + FindReferenceBLAS.cmake + FindReferenceLAPACK.cmake + FindReferenceScaLAPACK.cmake + FindScaLAPACK.cmake + FindStandardFortran.cmake + LinAlgModulesMacros.cmake +) + +set( LINALG_UTIL_FILES + util/blis_int_size.c + util/func_check.c + util/get_mpi_vendor.c + util/ilp64_checker.c + util/lapack_ilp64_checker.c + util/openblas_int_size.c + util/BLASUtilities.cmake + util/CommonFunctions.cmake + util/IntrospectMPI.cmake + util/IntrospectOpenMP.cmake + util/LAPACKUtilities.cmake + util/ScaLAPACKUtilities.cmake ) + +list( TRANSFORM LINALG_FIND_MODULES + PREPEND ${LINALG_MACROS_DIR}/ ) +list( TRANSFORM LINALG_UTIL_FILES + PREPEND ${LINALG_MACROS_DIR}/ ) + +install( + FILES ${LINALG_FIND_MODULES} + DESTINATION ${${_dest_dir}}/linalg-cmake-modules +) + +install( + FILES ${LINALG_UTIL_FILES} + DESTINATION ${${_dest_dir}}/linalg-cmake-modules/util ) endfunction() diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 0bbf527..8ea5858 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,14 +39,11 @@ foreach( _uplo LOWER UPPER ) else() - # Check for GFORTRAN - if( _compile_output MATCHES "gfortran" ) - - message( STATUS " * Mising GFORTRAN - Adding TO BLAS LINKER" ) - - list( APPEND ${_libs} "gfortran" ) + # Check for Standard Fortran Libraries + if(NOT STANDARDFORTRAN_LIBRARIES) + find_dependency(StandardFortran REQUIRED) + list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() # Recheck Compiliation diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index 2a7162d..484a061 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -37,16 +37,11 @@ foreach( _uplo LOWER UPPER ) else() - #message( STATUS ${_compile_output} ) - - # Check for GFORTRAN - if( _compile_output MATCHES "_gfortran" ) - - message( STATUS " * Mising GFORTRAN - Adding TO LAPACK LINKER" ) - - list( APPEND ${_libs} "gfortran" ) + # Check for Standard Fortran Libraries + if(NOT STANDARDFORTRAN_LIBRARIES) + find_dependency(StandardFortran REQUIRED) + list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() if( _compile_output MATCHES "logf" ) diff --git a/util/ScaLAPACKUtilities.cmake b/util/ScaLAPACKUtilities.cmake index 12b2c7d..e4ddb75 100644 --- a/util/ScaLAPACKUtilities.cmake +++ b/util/ScaLAPACKUtilities.cmake @@ -37,16 +37,11 @@ foreach( _uplo LOWER UPPER ) else() - #message( STATUS ${_compile_output} ) - - # Check for GFORTRAN - if( _compile_output MATCHES "_gfortran" ) - - message( STATUS " * Mising GFORTRAN - Adding TO ScaLAPACK LINKER" ) - - list( APPEND ${_libs} "gfortran" ) + # Check for Standard Fortran Libraries + if(NOT STANDARDFORTRAN_LIBRARIES) + find_dependency(StandardFortran REQUIRED) + list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() if( _compile_output MATCHES "logf" ) From 19ddd21a06c28d7296a5cd5f3a9143fd1a05e466 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Wed, 6 Jan 2021 12:23:32 -0800 Subject: [PATCH 015/122] sycl discovery as a blas component --- FindBLAS.cmake | 1 + FindIntelMKL.cmake | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 565fcc6..19cd8f7 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -55,6 +55,7 @@ if( NOT BLAS_LIBRARIES ) # Generic Components #set( BLAS_headers_FOUND ${${blas_type}_headers_FOUND} ) + set( BLAS_sycl_FOUND ${${blas_type}_sycl_FOUND} ) set( BLAS_blacs_FOUND ${${blas_type}_blacs_FOUND} ) set( BLAS_scalapack_FOUND ${${blas_type}_scalapack_FOUND} ) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 84dd988..8033759 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -254,7 +254,7 @@ else() endif() # SYCL -if(ENABLE_DPCPP) +if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) find_library( IntelMKL_SYCL_LIBRARY NAMES ${IntelMKL_SYCL_LIBRARY_NAME} HINTS ${IntelMKL_PREFIX} @@ -341,7 +341,9 @@ else() endif() endif() - +if( IntelMKL_SYCL_LIBRARY ) + set( IntelMKL_sycl_FOUND TRUE ) +endif() @@ -360,8 +362,8 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) ${IntelMKL_THREAD_LIBRARY} ${IntelMKL_CORE_LIBRARY} ) - if(ENABLE_DPCPP) - list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_SYCL_LIBRARY} ) + if( "sycl" IN_LIST IntelMKL_FIND_COMPONENTS ) + list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${IntelMKL_SYCL_LIBRARY} ) endif() if( "blacs" IN_LIST IntelMKL_FIND_COMPONENTS ) From 3c7327170ca207712849ab35a5c83a1d629432fd Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Wed, 6 Jan 2021 17:23:45 -0800 Subject: [PATCH 016/122] fix --- FindLAPACK.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 84da177..8b40ef8 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -8,7 +8,8 @@ include( FindPackageHandleStandardArgs ) include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) -include( ${CMAKE_CURRENT_LIST_DIR}/util/LAPACKUtilities.cmake ) +include( ${CMAKE_CURRENT_LIST_DIR}/util/LAPACKUtilities.cmake ) +include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) # SANITY CHECK if( "ilp64" IN_LIST LAPACK_FIND_COMPONENTS AND "lp64" IN_LIST LAPACK_FIND_COMPONENTS ) @@ -101,7 +102,8 @@ if( NOT LAPACK_LIBRARIES ) endforeach() endif( BLAS_HAS_LAPACK ) - +else() + find_linalg_dependencies( LAPACK_LIBRARIES ) endif() # Handle implicit LAPACK linkage From 736474b9d76acae5e44138939ae1ef4915f8a862 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Fri, 8 Jan 2021 13:00:37 -0800 Subject: [PATCH 017/122] Find linalg dependencies during LAPACK, ScaLAPACK discovery --- FindScaLAPACK.cmake | 7 ++++++- LinAlgModulesMacros.cmake | 2 +- util/BLASUtilities.cmake | 1 + util/LAPACKUtilities.cmake | 1 + util/ScaLAPACKUtilities.cmake | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 52d6775..a72af4e 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -33,8 +33,10 @@ cmake_minimum_required( VERSION 3.17 ) # Require CMake 3.17+ include( CMakeFindDependencyMacro ) -include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) +include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) include( ${CMAKE_CURRENT_LIST_DIR}/util/ScaLAPACKUtilities.cmake ) +include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) + # SANITY CHECK if( "ilp64" IN_LIST ScaLAPACK_FIND_COMPONENTS AND "lp64" IN_LIST ScaLAPACK_FIND_COMPONENTS ) @@ -119,6 +121,9 @@ if( NOT ScaLAPACK_LIBRARIES ) endforeach() endif( LAPACK_HAS_ScaLAPACK ) + + else() + find_linalg_dependencies( ScaLAPACK_LIBRARIES ) endif() # Handle implicit LAPACK linkage diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index 43b5fe7..e570b55 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -47,7 +47,7 @@ list( TRANSFORM LINALG_UTIL_FILES PREPEND ${LINALG_MACROS_DIR}/ ) install( - FILES ${LINALG_FIND_MODULES} + FILES ${LINALG_FIND_MODULES} ${LINALG_MACROS_DIR}/LICENSE.txt DESTINATION ${${_dest_dir}}/linalg-cmake-modules ) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 8ea5858..235ff38 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -41,6 +41,7 @@ foreach( _uplo LOWER UPPER ) # Check for Standard Fortran Libraries if(NOT STANDARDFORTRAN_LIBRARIES) + include(CMakeFindDependencyMacro) find_dependency(StandardFortran REQUIRED) list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index 484a061..f48c5b9 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -39,6 +39,7 @@ foreach( _uplo LOWER UPPER ) # Check for Standard Fortran Libraries if(NOT STANDARDFORTRAN_LIBRARIES) + include(CMakeFindDependencyMacro) find_dependency(StandardFortran REQUIRED) list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) diff --git a/util/ScaLAPACKUtilities.cmake b/util/ScaLAPACKUtilities.cmake index e4ddb75..1467c7c 100644 --- a/util/ScaLAPACKUtilities.cmake +++ b/util/ScaLAPACKUtilities.cmake @@ -39,6 +39,7 @@ foreach( _uplo LOWER UPPER ) # Check for Standard Fortran Libraries if(NOT STANDARDFORTRAN_LIBRARIES) + include(CMakeFindDependencyMacro) find_dependency(StandardFortran REQUIRED) list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) From 74ccb99e966b8e8cdaea1f6a96342dfe93115440 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 13 Jan 2021 23:07:25 +0000 Subject: [PATCH 018/122] Propagate sycl component in FindLAPACK --- FindLAPACK.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 8b40ef8..03c9669 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -56,10 +56,11 @@ if( NOT LAPACK_LIBRARIES ) if( BLAS_HAS_LAPACK ) message( STATUS "BLAS Has A Full LAPACK Linker" ) - set( LAPACK_VENDOR ${BLAS_VENDOR} ) - set( LAPACK_IS_LP64 ${BLAS_IS_LP64} ) - set( LAPACK_blacs_FOUND ${BLAS_blacs_FOUND} ) + set( LAPACK_VENDOR ${BLAS_VENDOR} ) + set( LAPACK_IS_LP64 ${BLAS_IS_LP64} ) + set( LAPACK_blacs_FOUND ${BLAS_blacs_FOUND} ) set( LAPACK_scalapack_FOUND ${BLAS_scalapack_FOUND} ) + set( LAPACK_sycl_FOUND ${BLAS_sycl_FOUND} ) # Else find LAPACK installation consistent with BLAS else( BLAS_HAS_LAPACK ) @@ -94,6 +95,7 @@ if( NOT LAPACK_LIBRARIES ) #set( LAPACK_headers_FOUND ${${lapack_type}_headers_FOUND} ) set( LAPACK_blacs_FOUND ${${lapack_type}_blacs_FOUND} ) set( LAPACK_scalapack_FOUND ${${lapack_type}_scalapack_FOUND} ) + set( LAPACK_sycl_FOUND ${${lapack_type}_sycl_FOUND} ) break() # Break from search loop From 98d79c5212bba626baec97ca076d64f12145995a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:30:08 -0800 Subject: [PATCH 019/122] Starting CI --- .github/workflows/cmake.yml | 34 ++++++++ .github/workflows/linalg/Makefile | 134 ++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 .github/workflows/cmake.yml create mode 100644 .github/workflows/linalg/Makefile diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..e03bf64 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,34 @@ +name: CMake + +on: [pull_request] + +jobs: + linux-build: + runs-on: ubuntu-latest + strategy: + matrix: + thread: [serial,openmp,pthreads] + linalg_lib: [blis,openblas,netlib] + int_interface: [lp64,ilp64] + exclude: + - linalg_lib: netlib + - int_interface: ilp64 + exclude: + - linalg_lib: netlib + - thread: [openmp,pthreads] + + steps: + - uses: actions/checkout@v2 + + - name: Ubuntu Setup + run: | + apt-get -yq update && apt-get install make wget curl + make -C .github/workflows/linalg install/main + make -C .github/workflows/linalg install/cmake + + - name: Build Linalg + env: + BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} + run: | + make -C .github/workflows/linalg download/${{matrix.linalg_lib}} + make -C .github/workflows/linalg install/${BUILD_TARGET} diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile new file mode 100644 index 0000000..20c8653 --- /dev/null +++ b/.github/workflows/linalg/Makefile @@ -0,0 +1,134 @@ +ubuntu_codename ?= $(shell lsb_release -sc) +clang_version ?= 9 +software_prefix := /home/software + +export DEBIAN_FRONTEND=noninteractive + +ubuntu_release = $(shell lsb_release -sr) + + +intel_mkl_version ?= 2020.4-304 +intel_mkl := intel-mkl-\*-${intel_mkl_version} + +install/main: + apt-get update + apt-get -yq install \ + lsb-release coreutils sudo bash-completion \ + apt-transport-https software-properties-common ca-certificates gnupg \ + build-essential wget curl \ + git make ninja-build \ + gcc g++ gfortran gdb valgrind \ + libunwind-dev libomp-dev \ + vim + +install/g++-%: + apt-get -yq install gcc-$* g++-$* gfortran-$* + +# CMake +install/cmake: + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - + apt-add-repository "deb https://apt.kitware.com/ubuntu/ ${ubuntu_codename} main" + apt-get -yq update + apt-get -yq install cmake + + +# LLVM +install/clang-%: + wget https://apt.llvm.org/llvm-snapshot.gpg.key -O - | apt-key add - + add-apt-repository "deb http://apt.llvm.org/${ubuntu_codename}/ llvm-toolchain-${ubuntu_codename}-$* main" + apt-get -yq update + apt-get -yq install clang-$* + +install/clang: install/clang-${clang_version} + + +# Intel +apt-add-repository/intel-mkl: + wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB | apt-key add - + apt-add-repository "deb https://apt.repos.intel.com/mkl all main" + apt-get -yq update + +download/intel-mkl: + apt-get install -yq --download-only ${intel_mkl} + +install/intel-mkl: + apt-get -yq install ${intel_mkl} + rm -rf /opt/intel/mkl + ln -s /opt/intel/compilers_and_libraries_$(subst -,.,${intel_mkl_version})/linux/mkl /opt/intel/mkl + test -x /opt/intel/mkl/bin/mklvars.sh + + +# BLIS +download/blis: + mkdir -p ${software_prefix}/src/blis + cd ${software_prefix}/src/blis && wget --no-verbose https://github.com/flame/blis/archive/0.8.0.tar.gz + cd ${software_prefix}/src/blis && tar xzf 0.8.0.tar.gz + +install/blis/lp64-pthreads: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-pthreads -t pthreads -i 32 -b 32 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install +install/blis/lp64-openmp: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-openmp -t openmp -i 32 -b 32 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install +install/blis/lp64-serial: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-serial -t no -i 32 -b 32 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install + +install/blis/ilp64-pthreads: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-pthreads -t pthreads -i 64 -b 64 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install +install/blis/ilp64-openmp: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-openmp -t openmp -i 64 -b 64 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install +install/blis/ilp64-serial: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-serial -t no -i 64 -b 64 --enable-blas auto + make -C ${software_prefix}/src/blis/blis-0.8.0 install + +# OpenBLAS +download/openblas: + mkdir -p ${software_prefix}/src/openblas + cd ${software_prefix}/src/openblas && wget https://github.com/xianyi/OpenBLAS/releases/download/v0.3.13/OpenBLAS-0.3.13.tar.gz + cd ${software_prefix}/src/openblas && tar xzf OpenBLAS-0.3.13.tar.gz + +install/openblas/lp64-serial: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-serial install +install/openblas/lp64-pthreads: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-pthreads install +install/openblas/lp64-openmp: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-openmp install + +install/openblas/ilp64-serial: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 INTERFACE64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-serial install +install/openblas/ilp64-pthreads: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 INTERFACE64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-pthreads install +install/openblas/ilp64-openmp: + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean + BINARY64=1 INTERFACE64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-openmp install + +# NETLIB == NETLIB-LAPACK b/c it includes NETLIB-BLAS +download/netlib: + mkdir -p ${software_prefix}/src/netlib + cd ${software_prefix}/src/netlib && wget https://github.com/Reference-LAPACK/lapack/archive/v3.9.0.tar.gz + cd ${software_prefix}/src/netlib && tar xzf v3.9.0.tar.gz + +install/netlib/lp64-serial-static: + rm -fr ${software_prefix}/build/netlib-lp64-serial + cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-serial -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-serial + cmake --build ${software_prefix}/build/netlib-lp64-serial --target install +install/netlib/lp64-serial-shared: + rm -fr ${software_prefix}/build/netlib-lp64-serial + cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-serial -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-serial + cmake --build ${software_prefix}/build/netlib-lp64-serial --target install + +install/netlib/lp64-serial: install/netlib/lp64-serial-static install/netlib/lp64-serial-shared From c119e157fc1280fba9e0f1d0423e816c2859d2cf Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:32:06 -0800 Subject: [PATCH 020/122] Typo in CI script --- .github/workflows/cmake.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e03bf64..1360a44 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -12,10 +12,9 @@ jobs: int_interface: [lp64,ilp64] exclude: - linalg_lib: netlib - - int_interface: ilp64 - exclude: + int_interface: ilp64 - linalg_lib: netlib - - thread: [openmp,pthreads] + thread: [openmp,pthreads] steps: - uses: actions/checkout@v2 From 9c5750fd49fa8fc408b9971de641b6bf96e60fe2 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:33:49 -0800 Subject: [PATCH 021/122] Sudo... --- .github/workflows/cmake.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1360a44..45847d3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,13 +21,13 @@ jobs: - name: Ubuntu Setup run: | - apt-get -yq update && apt-get install make wget curl - make -C .github/workflows/linalg install/main - make -C .github/workflows/linalg install/cmake + sudo apt-get -yq update && sudo apt-get install make wget curl + sudo make -C .github/workflows/linalg install/main + sudo make -C .github/workflows/linalg install/cmake - name: Build Linalg env: BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} run: | - make -C .github/workflows/linalg download/${{matrix.linalg_lib}} - make -C .github/workflows/linalg install/${BUILD_TARGET} + sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} + sudo make -C .github/workflows/linalg install/${BUILD_TARGET} From 7fd4c05ea89a81eebf75b573b10579e95458a11e Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:35:31 -0800 Subject: [PATCH 022/122] Add OMP to build --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 45847d3..4810d5f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,7 +21,7 @@ jobs: - name: Ubuntu Setup run: | - sudo apt-get -yq update && sudo apt-get install make wget curl + sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake From 875fb200cddd427342931dd226b8a9423935c40c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:38:28 -0800 Subject: [PATCH 023/122] [CI] Explicitly disable NETLIB + Threads --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4810d5f..4b792dc 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,7 +14,9 @@ jobs: - linalg_lib: netlib int_interface: ilp64 - linalg_lib: netlib - thread: [openmp,pthreads] + thread: pthreads + - linalg_lib: netlib + thread: openmp steps: - uses: actions/checkout@v2 From 2388b67cada9b4802c0727bb5e6425a586663877 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:48:44 -0800 Subject: [PATCH 024/122] [CI] Added FindBLAS - Default Config to CI --- .github/workflows/cmake.yml | 16 +++++++++++++++- examples/blas/default/CMakeLists.txt | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4b792dc..7d42981 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,14 +2,17 @@ name: CMake on: [pull_request] +env: + MKLROOT: /opt/intel/mkl + jobs: linux-build: runs-on: ubuntu-latest strategy: matrix: - thread: [serial,openmp,pthreads] linalg_lib: [blis,openblas,netlib] int_interface: [lp64,ilp64] + thread: [serial,openmp,pthreads] exclude: - linalg_lib: netlib int_interface: ilp64 @@ -26,6 +29,8 @@ jobs: sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake + sudo apt-get clean + sudo make apt-add-repository/intel-mkl - name: Build Linalg env: @@ -33,3 +38,12 @@ jobs: run: | sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} + + - name: FindBLAS Default + env: + CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} + run: | + cmake -H${GITHUB_WORKSPACE}/examples/blas \ + -B${{runner.workspace}}/build-findblas \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} diff --git a/examples/blas/default/CMakeLists.txt b/examples/blas/default/CMakeLists.txt index 4dc547c..92f067e 100644 --- a/examples/blas/default/CMakeLists.txt +++ b/examples/blas/default/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) -find_package( BLAS COMPONENTS ) +find_package( BLAS REQUIRED ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) From 1aca00a19864128e089051d276de7e4e8d19f23a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:51:05 -0800 Subject: [PATCH 025/122] Typo --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7d42981..0fa2114 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -30,7 +30,7 @@ jobs: sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake sudo apt-get clean - sudo make apt-add-repository/intel-mkl + sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl - name: Build Linalg env: From 99c00adca73c1bf60a14085470ef134d8eb11eb4 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 10:56:28 -0800 Subject: [PATCH 026/122] [CI] Typo --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0fa2114..965a991 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -43,7 +43,7 @@ jobs: env: CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} run: | - cmake -H${GITHUB_WORKSPACE}/examples/blas \ + cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} From a821e53d9cbf285d34007809eb3586e14fe33034 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 11:05:23 -0800 Subject: [PATCH 027/122] [CI] Add integer specific check in FindBLAS CI --- .github/workflows/cmake.yml | 13 +++++++++++-- .github/workflows/linalg/Makefile | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 965a991..3944641 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,7 +6,7 @@ env: MKLROOT: /opt/intel/mkl jobs: - linux-build: + linux-check-all-libs: runs-on: ubuntu-latest strategy: matrix: @@ -44,6 +44,15 @@ jobs: CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ - -B${{runner.workspace}}/build-findblas \ + -B${{runner.workspace}}/build-findblas-default \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + + - name: FindBLAS Integer Specific + env: + CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} + run: | + cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index 20c8653..82420f1 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -57,6 +57,13 @@ install/intel-mkl: ln -s /opt/intel/compilers_and_libraries_$(subst -,.,${intel_mkl_version})/linux/mkl /opt/intel/mkl test -x /opt/intel/mkl/bin/mklvars.sh +install/intel-mkl-lp64-serial: install/intel-mkl +install/intel-mkl-lp64-openmp: install/intel-mkl +install/intel-mkl-lp64-tbb: install/intel-mkl +install/intel-mkl-ilp64-serial: install/intel-mkl +install/intel-mkl-ilp64-openmp: install/intel-mkl +install/intel-mkl-ilp64-tbb: install/intel-mkl + # BLIS download/blis: From b4b48fe196173a7f0012e92a81652b1cac74a0e9 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 11:25:06 -0800 Subject: [PATCH 028/122] [CI] Add FindLAPACK --- .github/workflows/cmake.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3944641..2384f0f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -56,3 +56,21 @@ jobs: -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + + - name: Add-On LAPACK + if: ${{ matrix.linalg_lib == "blis" && matrix.int_interface == "lp64" }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it + run: make -C .github/workflows/linalg install/netlib/lp64-serial + + + - name: FindLAPACK Default + if: ${{ matrix.linalg_lib != "blis" || matrix.int_interface != "ilp64" }} + env: + CMAKE_PREFIX_PATH: "/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial" + run: | + cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ + -B${{runner.workspace}}/build-findlapack-default \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + + + From 2f9abc4fa7ae6b2a86e41ba8314324815a76c26d Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 11:26:21 -0800 Subject: [PATCH 029/122] [CI] Typo --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2384f0f..950f180 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,14 +58,14 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - name: Add-On LAPACK - if: ${{ matrix.linalg_lib == "blis" && matrix.int_interface == "lp64" }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it + if: ${{ matrix.linalg_lib == 'blis' && matrix.int_interface == 'lp64' }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it run: make -C .github/workflows/linalg install/netlib/lp64-serial - name: FindLAPACK Default - if: ${{ matrix.linalg_lib != "blis" || matrix.int_interface != "ilp64" }} + if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} env: - CMAKE_PREFIX_PATH: "/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial" + CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial' run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ -B${{runner.workspace}}/build-findlapack-default \ From 32613d87da368934d3b940425902bd0e08971dc4 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 11:30:41 -0800 Subject: [PATCH 030/122] [CI] Minor --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 950f180..1b78246 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -59,7 +59,9 @@ jobs: - name: Add-On LAPACK if: ${{ matrix.linalg_lib == 'blis' && matrix.int_interface == 'lp64' }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it - run: make -C .github/workflows/linalg install/netlib/lp64-serial + run: | + make -C .github/workflows/linalg download/netlib + make -C .github/workflows/linalg install/netlib/lp64-serial - name: FindLAPACK Default From 9c9f9c53e99edadfb5b2093e3172cf967dad6be1 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 12:21:42 -0800 Subject: [PATCH 031/122] [CI] Added integer interface checks for FindLAPACK CI --- .github/workflows/cmake.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1b78246..7a57d29 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -74,5 +74,15 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + - name: FindLAPACK Integer Specific + if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} + env: + CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial' + run: | + cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + From a977b0f5e11a0b8a63f688323bfd024e6a70095c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 12:28:28 -0800 Subject: [PATCH 032/122] [CI] Enable IntelMKL in CI matrix --- .github/workflows/cmake.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7a57d29..6ee8c80 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - linalg_lib: [blis,openblas,netlib] + linalg_lib: [blis,openblas,netlib,intel-mkl] int_interface: [lp64,ilp64] thread: [serial,openmp,pthreads] exclude: @@ -20,6 +20,10 @@ jobs: thread: pthreads - linalg_lib: netlib thread: openmp + - linalg_lib: intel-mkl + thread: pthreads + - linalg_lib: intel-mkl + thread: serial # TODO Renable once naming conventions are worked out steps: - uses: actions/checkout@v2 From 0ed2df41aa52b44c7e1c648cae8ed9353419a36f Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 12:32:57 -0800 Subject: [PATCH 033/122] [CI] Fixup for MKL --- .github/workflows/cmake.yml | 22 ++++++++------- .github/workflows/linalg/Makefile | 46 +++++++++++++++---------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6ee8c80..e55b297 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -12,7 +12,7 @@ jobs: matrix: linalg_lib: [blis,openblas,netlib,intel-mkl] int_interface: [lp64,ilp64] - thread: [serial,openmp,pthreads] + thread: [sequential,openmp,pthreads] exclude: - linalg_lib: netlib int_interface: ilp64 @@ -22,8 +22,6 @@ jobs: thread: openmp - linalg_lib: intel-mkl thread: pthreads - - linalg_lib: intel-mkl - thread: serial # TODO Renable once naming conventions are worked out steps: - uses: actions/checkout@v2 @@ -50,7 +48,8 @@ jobs: cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - name: FindBLAS Integer Specific env: @@ -59,34 +58,37 @@ jobs: cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - name: Add-On LAPACK if: ${{ matrix.linalg_lib == 'blis' && matrix.int_interface == 'lp64' }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it run: | make -C .github/workflows/linalg download/netlib - make -C .github/workflows/linalg install/netlib/lp64-serial + make -C .github/workflows/linalg install/netlib/lp64-sequential - name: FindLAPACK Default if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} env: - CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial' + CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ -B${{runner.workspace}}/build-findlapack-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - name: FindLAPACK Integer Specific if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} env: - CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-serial' + CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index 82420f1..5f0bdd5 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -57,12 +57,12 @@ install/intel-mkl: ln -s /opt/intel/compilers_and_libraries_$(subst -,.,${intel_mkl_version})/linux/mkl /opt/intel/mkl test -x /opt/intel/mkl/bin/mklvars.sh -install/intel-mkl-lp64-serial: install/intel-mkl -install/intel-mkl-lp64-openmp: install/intel-mkl -install/intel-mkl-lp64-tbb: install/intel-mkl -install/intel-mkl-ilp64-serial: install/intel-mkl -install/intel-mkl-ilp64-openmp: install/intel-mkl -install/intel-mkl-ilp64-tbb: install/intel-mkl +install/intel-mkl/lp64-sequential: install/intel-mkl +install/intel-mkl/lp64-openmp: install/intel-mkl +install/intel-mkl/lp64-tbb: install/intel-mkl +install/intel-mkl/ilp64-sequential: install/intel-mkl +install/intel-mkl/ilp64-openmp: install/intel-mkl +install/intel-mkl/ilp64-tbb: install/intel-mkl # BLIS @@ -77,8 +77,8 @@ install/blis/lp64-pthreads: install/blis/lp64-openmp: cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-openmp -t openmp -i 32 -b 32 --enable-blas auto make -C ${software_prefix}/src/blis/blis-0.8.0 install -install/blis/lp64-serial: - cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-serial -t no -i 32 -b 32 --enable-blas auto +install/blis/lp64-sequential: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-lp64-sequential -t no -i 32 -b 32 --enable-blas auto make -C ${software_prefix}/src/blis/blis-0.8.0 install install/blis/ilp64-pthreads: @@ -87,8 +87,8 @@ install/blis/ilp64-pthreads: install/blis/ilp64-openmp: cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-openmp -t openmp -i 64 -b 64 --enable-blas auto make -C ${software_prefix}/src/blis/blis-0.8.0 install -install/blis/ilp64-serial: - cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-serial -t no -i 64 -b 64 --enable-blas auto +install/blis/ilp64-sequential: + cd ${software_prefix}/src/blis/blis-0.8.0 && CC=gcc ./configure -p ${software_prefix}/install/blis-ilp64-sequential -t no -i 64 -b 64 --enable-blas auto make -C ${software_prefix}/src/blis/blis-0.8.0 install # OpenBLAS @@ -97,10 +97,10 @@ download/openblas: cd ${software_prefix}/src/openblas && wget https://github.com/xianyi/OpenBLAS/releases/download/v0.3.13/OpenBLAS-0.3.13.tar.gz cd ${software_prefix}/src/openblas && tar xzf OpenBLAS-0.3.13.tar.gz -install/openblas/lp64-serial: +install/openblas/lp64-sequential: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean BINARY64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 - make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-serial install + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-sequential install install/openblas/lp64-pthreads: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean BINARY64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 @@ -110,10 +110,10 @@ install/openblas/lp64-openmp: BINARY64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-openmp install -install/openblas/ilp64-serial: +install/openblas/ilp64-sequential: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean BINARY64=1 INTERFACE64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 - make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-serial install + make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-sequential install install/openblas/ilp64-pthreads: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean BINARY64=1 INTERFACE64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 @@ -129,13 +129,13 @@ download/netlib: cd ${software_prefix}/src/netlib && wget https://github.com/Reference-LAPACK/lapack/archive/v3.9.0.tar.gz cd ${software_prefix}/src/netlib && tar xzf v3.9.0.tar.gz -install/netlib/lp64-serial-static: - rm -fr ${software_prefix}/build/netlib-lp64-serial - cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-serial -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-serial - cmake --build ${software_prefix}/build/netlib-lp64-serial --target install -install/netlib/lp64-serial-shared: - rm -fr ${software_prefix}/build/netlib-lp64-serial - cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-serial -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-serial - cmake --build ${software_prefix}/build/netlib-lp64-serial --target install +install/netlib/lp64-sequential-static: + rm -fr ${software_prefix}/build/netlib-lp64-sequential + cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-sequential -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential + cmake --build ${software_prefix}/build/netlib-lp64-sequential --target install +install/netlib/lp64-sequential-shared: + rm -fr ${software_prefix}/build/netlib-lp64-sequential + cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-sequential -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential + cmake --build ${software_prefix}/build/netlib-lp64-sequential --target install -install/netlib/lp64-serial: install/netlib/lp64-serial-static install/netlib/lp64-serial-shared +install/netlib/lp64-sequential: install/netlib/lp64-sequential-static install/netlib/lp64-sequential-shared From 995044c41e16b4d6dac6f58d87cefbe9a9b60602 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 13:20:06 -0800 Subject: [PATCH 034/122] [CI] Slight refactor of CI matrix --- .github/workflows/cmake.yml | 43 +++++++++++++++++++------------ .github/workflows/linalg/Makefile | 24 +++++++++++++++++ 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e55b297..3d7f9e6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,8 +2,6 @@ name: CMake on: [pull_request] -env: - MKLROOT: /opt/intel/mkl jobs: linux-check-all-libs: @@ -11,6 +9,7 @@ jobs: strategy: matrix: linalg_lib: [blis,openblas,netlib,intel-mkl] + #mpi_dist: [mpich] int_interface: [lp64,ilp64] thread: [sequential,openmp,pthreads] exclude: @@ -22,6 +21,12 @@ jobs: thread: openmp - linalg_lib: intel-mkl thread: pthreads + env: + MKLROOT: /opt/intel/mkl + NETLIB_PREFIX: /home/software/install/netlib-lp64-sequential + LINALG_PREFIX: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} + #MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} + CMAKE_PREFIX_PATH: '${LINALG_PREFIX};${NETLIB_PREFIX};${MPI_PREFIX}' steps: - uses: actions/checkout@v2 @@ -41,9 +46,26 @@ jobs: sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} + #- name: Build MPI + # run: | + # make -C .github/workflows/linalg download/${{matrix.mpi_dist}} + # make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + + - name: Add-On NETLIB + if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.int_interface == 'lp64' }} + run: | + make -C .github/workflows/linalg download/netlib + make -C .github/workflows/linalg install/netlib/lp64-sequential + + + + + + + + + - name: FindBLAS Default - env: - CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ @@ -52,8 +74,6 @@ jobs: -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - name: FindBLAS Integer Specific - env: - CMAKE_PREFIX_PATH: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ @@ -61,17 +81,10 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - - name: Add-On LAPACK - if: ${{ matrix.linalg_lib == 'blis' && matrix.int_interface == 'lp64' }} # Only add NETLIB LAPACK for BLIS for now, OpenBLAS, etc already have it - run: | - make -C .github/workflows/linalg download/netlib - make -C .github/workflows/linalg install/netlib/lp64-sequential - name: FindLAPACK Default if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} - env: - CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ -B${{runner.workspace}}/build-findlapack-default \ @@ -81,8 +94,6 @@ jobs: - name: FindLAPACK Integer Specific if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} - env: - CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ @@ -90,5 +101,3 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - - diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index 5f0bdd5..f97b3a0 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -1,5 +1,7 @@ ubuntu_codename ?= $(shell lsb_release -sc) clang_version ?= 9 +mpich_version ?= 3.3 +openmpi_version ?= 4.1.0 software_prefix := /home/software export DEBIAN_FRONTEND=noninteractive @@ -42,6 +44,28 @@ install/clang-%: install/clang: install/clang-${clang_version} +# MPICH +download/mpich: + mkdir -p ${software_prefix}/src/mpich + cd ${software_prefix}/src/mpich && wget --no-check-certificate -q http://www.mpich.org/static/downloads/${mpich_version}/mpich-${mpich_version}.tar.gz + cd ${software_prefix}/src/mpich && tar xzf mpich-${mpich_version}.tar.gz + +install/mpich: + cd ${software_prefix}/src/mpich/mpich-${mpich_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/mpich + make -C ${software_prefix}/src/mpich/mpich-${mpich_version} install + +# OpenMPI +download/openmpi: + mkdir -p ${software_prefix}/src/openmpi + cd ${software_prefix}/src/openmpi && wget --no-check-certificate -qi https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz + cd ${software_prefix}/src/openmpi && tar xzf openmpi-${openmpi_version}.tar.gz + +install/openmpi: + cd ${software_prefix}/src/openmpi/openmpi-${openmpi_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/openmpi + make -C ${software_prefix}/src/openmpi/openmpi-${openmpi_version} install + + + # Intel apt-add-repository/intel-mkl: wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB | apt-key add - From 4359dd9ccc2a70cbbfa15f3b52c8c2b2f8bfbf2a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 13:32:36 -0800 Subject: [PATCH 035/122] [CI] Add MPI + Move NETLIB over to ScaLAPACK --- .github/workflows/cmake.yml | 10 +++++----- .github/workflows/linalg/Makefile | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3d7f9e6..2ef715b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -46,13 +46,13 @@ jobs: sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} - #- name: Build MPI - # run: | - # make -C .github/workflows/linalg download/${{matrix.mpi_dist}} - # make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + - name: Build MPI + run: | + make -C .github/workflows/linalg download/${{matrix.mpi_dist}} + make -C .github/workflows/linalg install/${{matrix.mpi_dist}} - name: Add-On NETLIB - if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.int_interface == 'lp64' }} + if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | make -C .github/workflows/linalg download/netlib make -C .github/workflows/linalg install/netlib/lp64-sequential diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index f97b3a0..fc2d42f 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -147,19 +147,27 @@ install/openblas/ilp64-openmp: BINARY64=1 INTERFACE64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-openmp install -# NETLIB == NETLIB-LAPACK b/c it includes NETLIB-BLAS +# NETLIB == NETLIB-ScaLAPACK b/c it includes NETLIB-BLAS/LAPACK download/netlib: mkdir -p ${software_prefix}/src/netlib - cd ${software_prefix}/src/netlib && wget https://github.com/Reference-LAPACK/lapack/archive/v3.9.0.tar.gz - cd ${software_prefix}/src/netlib && tar xzf v3.9.0.tar.gz + cd ${software_prefix}/src/netlib && wget https://github.com/Reference-ScaLAPACK/scalapack/archive/v2.1.0.tar.gz + cd ${software_prefix}/src/netlib && tar xzf v2.1.0.tar.gz install/netlib/lp64-sequential-static: rm -fr ${software_prefix}/build/netlib-lp64-sequential - cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-sequential -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential + cmake -H${software_prefix}/src/netlib/scalapack-2.1.0 \ + -B${software_prefix}/build/netlib-lp64-sequential \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential cmake --build ${software_prefix}/build/netlib-lp64-sequential --target install + install/netlib/lp64-sequential-shared: rm -fr ${software_prefix}/build/netlib-lp64-sequential - cmake -H${software_prefix}/src/netlib/lapack-3.9.0 -B${software_prefix}/build/netlib-lp64-sequential -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential + cmake -H${software_prefix}/src/netlib/scalapack-2.1.0 \ + -B${software_prefix}/build/netlib-lp64-sequential \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential cmake --build ${software_prefix}/build/netlib-lp64-sequential --target install install/netlib/lp64-sequential: install/netlib/lp64-sequential-static install/netlib/lp64-sequential-shared From 1a0460b48ce991011caa7252a5cdd4f9e29369b5 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 13:33:21 -0800 Subject: [PATCH 036/122] [CI] Minor --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2ef715b..6bf7a06 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -25,7 +25,7 @@ jobs: MKLROOT: /opt/intel/mkl NETLIB_PREFIX: /home/software/install/netlib-lp64-sequential LINALG_PREFIX: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} - #MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} + MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} CMAKE_PREFIX_PATH: '${LINALG_PREFIX};${NETLIB_PREFIX};${MPI_PREFIX}' steps: From aece06950e842ecd00363ccd906c7400324c43e3 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 13:49:51 -0800 Subject: [PATCH 037/122] [CI] MPI fixup --- .github/workflows/cmake.yml | 16 ++++++++-------- .github/workflows/linalg/Makefile | 32 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6bf7a06..f1b87e6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: linalg_lib: [blis,openblas,netlib,intel-mkl] - #mpi_dist: [mpich] + mpi_dist: [mpich] int_interface: [lp64,ilp64] thread: [sequential,openmp,pthreads] exclude: @@ -25,8 +25,8 @@ jobs: MKLROOT: /opt/intel/mkl NETLIB_PREFIX: /home/software/install/netlib-lp64-sequential LINALG_PREFIX: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} - MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} - CMAKE_PREFIX_PATH: '${LINALG_PREFIX};${NETLIB_PREFIX};${MPI_PREFIX}' + #MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} + CMAKE_PREFIX_PATH: '${LINALG_PREFIX};${NETLIB_PREFIX}' steps: - uses: actions/checkout@v2 @@ -39,6 +39,11 @@ jobs: sudo apt-get clean sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl + - name: Build MPI + run: | + make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + + - name: Build Linalg env: BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} @@ -46,11 +51,6 @@ jobs: sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} - - name: Build MPI - run: | - make -C .github/workflows/linalg download/${{matrix.mpi_dist}} - make -C .github/workflows/linalg install/${{matrix.mpi_dist}} - - name: Add-On NETLIB if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index fc2d42f..5d3c64d 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -45,24 +45,28 @@ install/clang: install/clang-${clang_version} # MPICH -download/mpich: - mkdir -p ${software_prefix}/src/mpich - cd ${software_prefix}/src/mpich && wget --no-check-certificate -q http://www.mpich.org/static/downloads/${mpich_version}/mpich-${mpich_version}.tar.gz - cd ${software_prefix}/src/mpich && tar xzf mpich-${mpich_version}.tar.gz - +#download/mpich: +# mkdir -p ${software_prefix}/src/mpich +# cd ${software_prefix}/src/mpich && wget --no-check-certificate -q http://www.mpich.org/static/downloads/${mpich_version}/mpich-${mpich_version}.tar.gz +# cd ${software_prefix}/src/mpich && tar xzf mpich-${mpich_version}.tar.gz +# +#install/mpich: +# cd ${software_prefix}/src/mpich/mpich-${mpich_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/mpich +# make -C ${software_prefix}/src/mpich/mpich-${mpich_version} install install/mpich: - cd ${software_prefix}/src/mpich/mpich-${mpich_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/mpich - make -C ${software_prefix}/src/mpich/mpich-${mpich_version} install + apt-get install -yq libmpich-dev # OpenMPI -download/openmpi: - mkdir -p ${software_prefix}/src/openmpi - cd ${software_prefix}/src/openmpi && wget --no-check-certificate -qi https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz - cd ${software_prefix}/src/openmpi && tar xzf openmpi-${openmpi_version}.tar.gz - +#download/openmpi: +# mkdir -p ${software_prefix}/src/openmpi +# cd ${software_prefix}/src/openmpi && wget --no-check-certificate -qi https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz +# cd ${software_prefix}/src/openmpi && tar xzf openmpi-${openmpi_version}.tar.gz +# +#install/openmpi: +# cd ${software_prefix}/src/openmpi/openmpi-${openmpi_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/openmpi +# make -C ${software_prefix}/src/openmpi/openmpi-${openmpi_version} install install/openmpi: - cd ${software_prefix}/src/openmpi/openmpi-${openmpi_version} && CC=gcc CXX=g++ FC=gfortran ./configure --prefix=${software_prefix}/install/openmpi - make -C ${software_prefix}/src/openmpi/openmpi-${openmpi_version} install + apt-get install -yq libopenmpi-dev openmpi-bin From 7e6eca889771908a3ada7c9355008aa83ced760a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 13:53:31 -0800 Subject: [PATCH 038/122] [CI] Sudo... --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f1b87e6..378a230 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -41,7 +41,7 @@ jobs: - name: Build MPI run: | - make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} - name: Build Linalg @@ -54,8 +54,8 @@ jobs: - name: Add-On NETLIB if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | - make -C .github/workflows/linalg download/netlib - make -C .github/workflows/linalg install/netlib/lp64-sequential + sudo make -C .github/workflows/linalg download/netlib + sudo make -C .github/workflows/linalg install/netlib/lp64-sequential From f98e916c270d5d68bf1b8401f131cfe90ea6fa32 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:04:30 -0800 Subject: [PATCH 039/122] [CI] Force failures on incorrect libraries for integer interface checks, print debug information in CI matrix --- .github/workflows/cmake.yml | 3 ++- examples/blas/ilp64/CMakeLists.txt | 2 +- examples/blas/lp64/CMakeLists.txt | 2 +- examples/lapack/ilp64/CMakeLists.txt | 2 +- examples/lapack/lp64/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 378a230..5f3f044 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -39,7 +39,7 @@ jobs: sudo apt-get clean sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl - - name: Build MPI + - name: Setup MPI run: | sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} @@ -67,6 +67,7 @@ jobs: - name: FindBLAS Default run: | + echo ${CMAKE_PREFIX_PATH} cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ diff --git a/examples/blas/ilp64/CMakeLists.txt b/examples/blas/ilp64/CMakeLists.txt index 26b18e8..8e17997 100644 --- a/examples/blas/ilp64/CMakeLists.txt +++ b/examples/blas/ilp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) -find_package( BLAS COMPONENTS ilp64 ) +find_package( BLAS REQUIRED COMPONENTS ilp64 ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) diff --git a/examples/blas/lp64/CMakeLists.txt b/examples/blas/lp64/CMakeLists.txt index 77ea85b..65ffd9c 100644 --- a/examples/blas/lp64/CMakeLists.txt +++ b/examples/blas/lp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) -find_package( BLAS COMPONENTS lp64 ) +find_package( BLAS REQUIRED COMPONENTS lp64 ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) diff --git a/examples/lapack/ilp64/CMakeLists.txt b/examples/lapack/ilp64/CMakeLists.txt index 262636e..61c08df 100644 --- a/examples/lapack/ilp64/CMakeLists.txt +++ b/examples/lapack/ilp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) -find_package( LAPACK COMPONENTS ilp64 ) +find_package( LAPACK REQUIRED COMPONENTS ilp64 ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) diff --git a/examples/lapack/lp64/CMakeLists.txt b/examples/lapack/lp64/CMakeLists.txt index 40c8bb5..3f05835 100644 --- a/examples/lapack/lp64/CMakeLists.txt +++ b/examples/lapack/lp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) -find_package( LAPACK COMPONENTS lp64 ) +find_package( LAPACK REQUIRED COMPONENTS lp64 ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) From 5bbbf5a0344fe55b1d71fa9546808fb41559c08b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:12:10 -0800 Subject: [PATCH 040/122] [CI] env fixup --- .github/workflows/cmake.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5f3f044..9012ca7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,10 +23,8 @@ jobs: thread: pthreads env: MKLROOT: /opt/intel/mkl - NETLIB_PREFIX: /home/software/install/netlib-lp64-sequential - LINALG_PREFIX: /home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}} #MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} - CMAKE_PREFIX_PATH: '${LINALG_PREFIX};${NETLIB_PREFIX}' + CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' steps: - uses: actions/checkout@v2 From ad47c383e3aede0e69ed4b2b0f1dbf24f82e7760 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:28:42 -0800 Subject: [PATCH 041/122] [CI] Print debug information --- .github/workflows/cmake.yml | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9012ca7..e5ad163 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,7 +23,6 @@ jobs: thread: pthreads env: MKLROOT: /opt/intel/mkl - #MPI_PREFIX: /home/software/install/${{matrix.mpi_dist}} CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' steps: @@ -31,29 +30,37 @@ jobs: - name: Ubuntu Setup run: | + ls /usr/lib/x86_64-linux-gnu/ sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake sudo apt-get clean sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl + ls /usr/lib/x86_64-linux-gnu/ - name: Setup MPI run: | + ls /usr/lib/x86_64-linux-gnu/ sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + ls /usr/lib/x86_64-linux-gnu/ - name: Build Linalg env: BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} run: | + ls /usr/lib/x86_64-linux-gnu/ sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} + ls /usr/lib/x86_64-linux-gnu/ - name: Add-On NETLIB if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | + ls /usr/lib/x86_64-linux-gnu/ sudo make -C .github/workflows/linalg download/netlib sudo make -C .github/workflows/linalg install/netlib/lp64-sequential + ls /usr/lib/x86_64-linux-gnu/ @@ -65,20 +72,23 @@ jobs: - name: FindBLAS Default run: | - echo ${CMAKE_PREFIX_PATH} - cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ - -B${{runner.workspace}}/build-findblas-default \ - -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + ls /usr/lib/x86_64-linux-gnu/ + cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ + -B${{runner.workspace}}/build-findblas-default \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + ls /usr/lib/x86_64-linux-gnu/ - name: FindBLAS Integer Specific run: | - cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ - -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ - -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + ls /usr/lib/x86_64-linux-gnu/ + cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + ls /usr/lib/x86_64-linux-gnu/ From ee46fc45ea1dbde91ddbcc4224ae580976c3ba7f Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:32:01 -0800 Subject: [PATCH 042/122] [CI] Fixup --- .github/workflows/cmake.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e5ad163..c234eab 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -30,37 +30,37 @@ jobs: - name: Ubuntu Setup run: | - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake sudo apt-get clean sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Setup MPI run: | - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Build Linalg env: BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} run: | - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Add-On NETLIB if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg download/netlib sudo make -C .github/workflows/linalg install/netlib/lp64-sequential - ls /usr/lib/x86_64-linux-gnu/ + ls /usr/lib/x86_64-linux-gnu/ | grep blas From 3acec42c34547e75dd6529e5f815a4eb6cfd5c8c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:37:38 -0800 Subject: [PATCH 043/122] [CI] Minor --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c234eab..3f6a83b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -30,7 +30,8 @@ jobs: - name: Ubuntu Setup run: | - ls /usr/lib/x86_64-linux-gnu/ | grep blas + apt list --installed | grep blas + apt list --installed | grep lapack sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake From 89a1e4b7a8f20cbd83ed5f2fe755ec88b464d0ef Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:42:31 -0800 Subject: [PATCH 044/122] [CI] Remove preinstalled BLAS/LAPACK --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3f6a83b..d38fb4b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -30,8 +30,8 @@ jobs: - name: Ubuntu Setup run: | - apt list --installed | grep blas - apt list --installed | grep lapack + sudo apt-get remove libblas-dev libblas3 libgslcblas0 + sudo apt-get remove liblapack-dev liblapack3 sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake From d6f6b520989995f271f44b474bf3b1a4f1d4113a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 14:58:42 -0800 Subject: [PATCH 045/122] [BLAS] Cache BLAS_LIBRARIES --- .github/workflows/cmake.yml | 12 +----------- FindBLAS.cmake | 2 ++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d38fb4b..8c53f2d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -37,31 +37,24 @@ jobs: sudo make -C .github/workflows/linalg install/cmake sudo apt-get clean sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl - ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Setup MPI run: | - ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} - ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Build Linalg env: BUILD_TARGET: ${{matrix.linalg_lib}}/${{matrix.int_interface}}-${{matrix.thread}} run: | - ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg download/${{matrix.linalg_lib}} sudo make -C .github/workflows/linalg install/${BUILD_TARGET} - ls /usr/lib/x86_64-linux-gnu/ | grep blas - name: Add-On NETLIB if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | - ls /usr/lib/x86_64-linux-gnu/ | grep blas sudo make -C .github/workflows/linalg download/netlib sudo make -C .github/workflows/linalg install/netlib/lp64-sequential - ls /usr/lib/x86_64-linux-gnu/ | grep blas @@ -73,23 +66,20 @@ jobs: - name: FindBLAS Default run: | - ls /usr/lib/x86_64-linux-gnu/ cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - ls /usr/lib/x86_64-linux-gnu/ + cmake -L ${{runner.workspace}}/build-findblas-default - name: FindBLAS Integer Specific run: | - ls /usr/lib/x86_64-linux-gnu/ cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - ls /usr/lib/x86_64-linux-gnu/ diff --git a/FindBLAS.cmake b/FindBLAS.cmake index a2ff8a0..41864ae 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -105,6 +105,8 @@ find_package_handle_standard_args( BLAS HANDLE_COMPONENTS ) +# Cache variables +set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE INTERNAL "BLAS Libraries" FORCE ) if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) From 4dda1d77795dcd21b2294b7345caafd91bc97596 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:04:13 -0800 Subject: [PATCH 046/122] [CI] Typo --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8c53f2d..7dd1628 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,7 +71,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -L ${{runner.workspace}}/build-findblas-default + cmake -N -L ${{runner.workspace}}/build-findblas-default - name: FindBLAS Integer Specific run: | From 2bde9a363af288bb40c9dd36021437e70664d60e Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:09:47 -0800 Subject: [PATCH 047/122] [CI] Print out advanced variables --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7dd1628..24f7882 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,7 +71,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -L ${{runner.workspace}}/build-findblas-default + cmake -N -LA ${{runner.workspace}}/build-findblas-default - name: FindBLAS Integer Specific run: | From 628c503251e1a263f548bb2e5250dead57ef9588 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:14:09 -0800 Subject: [PATCH 048/122] [BLAS] Cache fixup --- FindBLAS.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 41864ae..223978d 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -106,7 +106,7 @@ find_package_handle_standard_args( BLAS ) # Cache variables -set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE INTERNAL "BLAS Libraries" FORCE ) +set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE STRING "BLAS Libraries" FORCE ) if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) From 70004fdea7e058878aacf95bdd4d9489ac36e506 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:31:45 -0800 Subject: [PATCH 049/122] [CI[ Add check that BLAS libraries are correct --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 24f7882..0f9028f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,7 +71,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findblas-default + cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + grep "BLAS_LIBRARIES" | grep -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` - name: FindBLAS Integer Specific run: | From 771267cf39dfeef7f1aea1c9eded04f2725f3cc1 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:35:53 -0800 Subject: [PATCH 050/122] [CI] Added missing script --- .github/workflows/scripts/blas_libname.sh | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .github/workflows/scripts/blas_libname.sh diff --git a/.github/workflows/scripts/blas_libname.sh b/.github/workflows/scripts/blas_libname.sh new file mode 100755 index 0000000..c6c7c1f --- /dev/null +++ b/.github/workflows/scripts/blas_libname.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +export dist_name=$1 +export thread_name=$2 + +if [ "$dist_name" == "intel-mkl" ] +then + if [ "$thread_name" == "sequential" ] + then + echo ".*mkl_sequential.*" + elif [ "$thread_name" == "openmp" ] + then + echo ".*mkl_(gnu|intel|pgi)_thread.*" + elif [ "$thread_name" == "tbb" ] + then + echo ".*mkl_tbb_thread.*" + fi +elif [ "$dist_name" == "netlib" ] +then + echo "blas" +else + echo "$dist_name" +fi + From f2cbe332a4f189ba1b3f496ef3c40bf8bc109224 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:43:20 -0800 Subject: [PATCH 051/122] [CI] Debug --- .github/workflows/cmake.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0f9028f..1b8130d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,6 +71,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cat .github/workflows/scripts/blas_libname.sh + echo .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` From 53a3585f9c7e0ffe65c0f4f1e8686acb4617f3ec Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:44:42 -0800 Subject: [PATCH 052/122] [CI] Change Sh -> Bash --- .github/workflows/scripts/blas_libname.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/blas_libname.sh b/.github/workflows/scripts/blas_libname.sh index c6c7c1f..c36a956 100755 --- a/.github/workflows/scripts/blas_libname.sh +++ b/.github/workflows/scripts/blas_libname.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash export dist_name=$1 export thread_name=$2 From 09eaed268c87a1cd5742c29664140d27d43c582e Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 15:51:38 -0800 Subject: [PATCH 053/122] [CI] Try to force a failure --- .github/workflows/cmake.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1b8130d..1b68369 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,10 +71,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cat .github/workflows/scripts/blas_libname.sh - echo .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" | grep -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` + grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} sequential` - name: FindBLAS Integer Specific run: | From 24902655eb36bb6711cb3312d9e8129d872298aa Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:07:52 -0800 Subject: [PATCH 054/122] [LAPACK/CI] Cache LAPACK_LIBRARIES + add test in CI --- .github/workflows/cmake.yml | 14 ++++++++------ .github/workflows/scripts/lapack_libname.sh | 21 +++++++++++++++++++++ FindLAPACK.cmake | 2 ++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100755 .github/workflows/scripts/lapack_libname.sh diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1b68369..94b18d7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -72,7 +72,7 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} sequential` + grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` - name: FindBLAS Integer Specific run: | @@ -87,11 +87,13 @@ jobs: - name: FindLAPACK Default if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} run: | - cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ - -B${{runner.workspace}}/build-findlapack-default \ - -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ + -B${{runner.workspace}}/build-findlapack-default \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -N -LA ${{runner.workspace}}/build-findlapack-default | \ + grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` - name: FindLAPACK Integer Specific if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} diff --git a/.github/workflows/scripts/lapack_libname.sh b/.github/workflows/scripts/lapack_libname.sh new file mode 100755 index 0000000..cd7d5f4 --- /dev/null +++ b/.github/workflows/scripts/lapack_libname.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export dist_name=$1 +export thread_name=$2 + +my_realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +if [ "$dist_name" == "netlib" ] +then + echo "lapack" +elif [ "$dist_name" == "blis" ] +then + echo "lapack.*blis" +else + export local_path=$(my_realpath $0) + export script_dir=$(dirname $local_path) + $script_dir/blas_libname.sh "$dist_name" "$thread_name" +fi + diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index dbcfab2..ec1970f 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -148,6 +148,8 @@ else() endif() +# Cache variables +set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) find_package_handle_standard_args( LAPACK From 6c1b7ff3ab6c54caa4b2d67acb5b2a3c6f351085 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:18:42 -0800 Subject: [PATCH 055/122] [CI] Add ScaLAPACK checks --- .github/workflows/cmake.yml | 19 +++++++++++++------ examples/lapack/default/CMakeLists.txt | 2 +- examples/scalapack/default/CMakeLists.txt | 2 +- examples/scalapack/ilp64/CMakeLists.txt | 2 +- examples/scalapack/lp64/CMakeLists.txt | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 94b18d7..8b43538 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,12 +58,6 @@ jobs: - - - - - - - name: FindBLAS Default run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ @@ -103,4 +97,17 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + ls $MKLROOT + + - name: FindScaLAPACK Default + if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.int_interface == 'lp64' }} + run: | + cmake -H${GITHUB_WORKSPACE}/examples/scalapack/default \ + -B${{runner.workspace}}/build-findscalapack-default \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + #cmake -N -LA ${{runner.workspace}}/build-findscalapack-default | \ + #grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` + diff --git a/examples/lapack/default/CMakeLists.txt b/examples/lapack/default/CMakeLists.txt index 0c5df41..9264fb4 100644 --- a/examples/lapack/default/CMakeLists.txt +++ b/examples/lapack/default/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) -find_package( LAPACK COMPONENTS ) +find_package( LAPACK REQUIRED ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) diff --git a/examples/scalapack/default/CMakeLists.txt b/examples/scalapack/default/CMakeLists.txt index aa0743f..e4470b1 100644 --- a/examples/scalapack/default/CMakeLists.txt +++ b/examples/scalapack/default/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) -find_package( ScaLAPACK COMPONENTS ) +find_package( ScaLAPACK REQUIRED ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) diff --git a/examples/scalapack/ilp64/CMakeLists.txt b/examples/scalapack/ilp64/CMakeLists.txt index 0dd9bed..754d39e 100644 --- a/examples/scalapack/ilp64/CMakeLists.txt +++ b/examples/scalapack/ilp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) -find_package( ScaLAPACK COMPONENTS ilp64 ) +find_package( ScaLAPACK REQUIRED COMPONENTS ilp64 ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) diff --git a/examples/scalapack/lp64/CMakeLists.txt b/examples/scalapack/lp64/CMakeLists.txt index 323024f..1083341 100644 --- a/examples/scalapack/lp64/CMakeLists.txt +++ b/examples/scalapack/lp64/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) -find_package( ScaLAPACK COMPONENTS lp64 ) +find_package( ScaLAPACK REQUIRED COMPONENTS lp64 ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) From d644e0f58b89b39cb6dbdb1c404feaf1cf2d5397 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:25:22 -0800 Subject: [PATCH 056/122] [CI] Typo --- .github/workflows/cmake.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8b43538..7d2526f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -97,11 +97,10 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - ls $MKLROOT - name: FindScaLAPACK Default - if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.int_interface == 'lp64' }} + if: ${{ matrix.linalg_lib == 'intel-mkl' || matrix.int_interface == 'lp64' }} run: | cmake -H${GITHUB_WORKSPACE}/examples/scalapack/default \ -B${{runner.workspace}}/build-findscalapack-default \ From b85ab46952134d85932aceff579334b735a9adbf Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:35:24 -0800 Subject: [PATCH 057/122] [CI] Update BLAS/LAPACK checks with integer types for MKL --- .github/workflows/cmake.yml | 4 ++-- .github/workflows/scripts/blas_libname.sh | 7 ++++--- .github/workflows/scripts/lapack_libname.sh | 3 ++- FindLAPACK.cmake | 5 +++-- FindScaLAPACK.cmake | 3 +++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7d2526f..eb4f381 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -66,7 +66,7 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` + grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindBLAS Integer Specific run: | @@ -87,7 +87,7 @@ jobs: -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} cmake -N -LA ${{runner.workspace}}/build-findlapack-default | \ - grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` + grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindLAPACK Integer Specific if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} diff --git a/.github/workflows/scripts/blas_libname.sh b/.github/workflows/scripts/blas_libname.sh index c36a956..63dbf4a 100755 --- a/.github/workflows/scripts/blas_libname.sh +++ b/.github/workflows/scripts/blas_libname.sh @@ -2,18 +2,19 @@ export dist_name=$1 export thread_name=$2 +export int_type=$3 if [ "$dist_name" == "intel-mkl" ] then if [ "$thread_name" == "sequential" ] then - echo ".*mkl_sequential.*" + echo "mkl_intel_$3.*mkl_sequential.*" elif [ "$thread_name" == "openmp" ] then - echo ".*mkl_(gnu|intel|pgi)_thread.*" + echo "mkl_intel_$3.*mkl_(gnu|intel|pgi)_thread.*" elif [ "$thread_name" == "tbb" ] then - echo ".*mkl_tbb_thread.*" + echo "mkl_intel_$3.*mkl_tbb_thread.*" fi elif [ "$dist_name" == "netlib" ] then diff --git a/.github/workflows/scripts/lapack_libname.sh b/.github/workflows/scripts/lapack_libname.sh index cd7d5f4..c0aac33 100755 --- a/.github/workflows/scripts/lapack_libname.sh +++ b/.github/workflows/scripts/lapack_libname.sh @@ -2,6 +2,7 @@ export dist_name=$1 export thread_name=$2 +export int_type=$3 my_realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" @@ -16,6 +17,6 @@ then else export local_path=$(my_realpath $0) export script_dir=$(dirname $local_path) - $script_dir/blas_libname.sh "$dist_name" "$thread_name" + $script_dir/blas_libname.sh "$dist_name" "$thread_name" "$int_type" fi diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index ec1970f..bee553a 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -148,8 +148,6 @@ else() endif() -# Cache variables -set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) find_package_handle_standard_args( LAPACK @@ -157,6 +155,9 @@ find_package_handle_standard_args( LAPACK HANDLE_COMPONENTS ) +# Cache variables +set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) + if( LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK ) add_library( LAPACK::LAPACK INTERFACE IMPORTED ) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 79697cc..c9bf55b 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -228,6 +228,9 @@ find_package_handle_standard_args( ScaLAPACK HANDLE_COMPONENTS ) +# Cache variables +set( ScaLAPACK_LIBRARIES "${ScaLAPACK_LIBRARIES}" CACHE STRING "ScaLAPACK Libraries" FORCE ) + if( ScaLAPACK_FOUND AND NOT TARGET ScaLAPACK::ScaLAPACK ) add_library( ScaLAPACK::ScaLAPACK INTERFACE IMPORTED ) From a41606f095c235ab12e1fbd68b97598d753227fa Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:41:35 -0800 Subject: [PATCH 058/122] [CI] Disable ILP64 checks on default as LP64 is the default --- .github/workflows/cmake.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index eb4f381..d690ba0 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -59,6 +59,7 @@ jobs: - name: FindBLAS Default + if: ${{ matrix.int_interface != 'ilp64' }} # Default is LP64 run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ @@ -75,6 +76,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` @@ -92,11 +95,13 @@ jobs: - name: FindLAPACK Integer Specific if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} run: | - cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ - -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ - -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -N -LA ${{runner.workspace}}/build-findlapack-default | \ + grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindScaLAPACK Default From c074a918f152fc9b7fdda4e76820922103cb3d71 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:46:16 -0800 Subject: [PATCH 059/122] [CI] Debug... --- .github/workflows/cmake.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d690ba0..2847c78 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -66,6 +66,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` @@ -76,6 +77,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` From 400fe60c98c4329780350fe5eaaf6f27eea1900b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:51:30 -0800 Subject: [PATCH 060/122] [CI] Debug... --- .github/workflows/cmake.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2847c78..28b0027 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -69,6 +69,8 @@ jobs: .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + grep "BLAS_LIBRARIES" - name: FindBLAS Integer Specific run: | @@ -80,6 +82,8 @@ jobs: .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + grep "BLAS_LIBRARIES" From 8bfc5f289880dc47cb49669bc30dd3b501d2a499 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Feb 2021 16:58:34 -0800 Subject: [PATCH 061/122] [CI] typo --- .github/workflows/cmake.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 28b0027..00d2a11 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -66,11 +66,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" - name: FindBLAS Integer Specific run: | @@ -79,11 +76,8 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - .github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} - cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + cmake -N -LA ${{runner.workspace}}/build-findblas-${{matrix.int_interface}} | \ grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" @@ -106,7 +100,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findlapack-default | \ + cmake -N -LA ${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} | \ grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` From 07fd91b1e0d78b835e61fec3ade7c44c4f8d592d Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 11:43:45 -0800 Subject: [PATCH 062/122] [CI] Fixup on disabled paths in CI matrix --- .github/workflows/cmake.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 00d2a11..6e8341b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -51,6 +51,10 @@ jobs: sudo make -C .github/workflows/linalg install/${BUILD_TARGET} - name: Add-On NETLIB + # Disable for + # - MKL b/c MKL already has a LAPACK/ScaLAPACK linker + # - NETLIB b/c the NETLIB is already the used linear algebra lib (no need to add on) + # - ILP64 b/c NETLIB isn't reliable for ILP64 yet if: ${{ matrix.linalg_lib != 'intel-mkl' && matrix.linalg_lib != 'netlib' && matrix.int_interface == 'lp64' }} run: | sudo make -C .github/workflows/linalg download/netlib @@ -59,7 +63,8 @@ jobs: - name: FindBLAS Default - if: ${{ matrix.int_interface != 'ilp64' }} # Default is LP64 + # Disable for MKL-ILP64 b/c the default is LP64 unless otherwise specified + if: ${{ matrix.linalg_lib != 'intel-mkl' || matrix.int_interface != 'ilp64' }} run: | cmake -H${GITHUB_WORKSPACE}/examples/blas/default \ -B${{runner.workspace}}/build-findblas-default \ @@ -82,7 +87,10 @@ jobs: - name: FindLAPACK Default - if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} + # Disable for + # - BLIS-ILP64 b/c BLIS doesn't have a LAPACK linker and NETLIB is not tested for ILP64 + # - MKL-ILP64 b/c the default is LP64 unless otherwise specified + if: ${{ (matrix.linalg_lib != 'blis' && matrix.linalg_lib != 'intel-mkl') || matrix.int_interface != 'ilp64' }} run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/default \ -B${{runner.workspace}}/build-findlapack-default \ @@ -93,6 +101,7 @@ jobs: grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindLAPACK Integer Specific + # Disable for BLIS-ILP64 b/c BLIS doesn't have a LAPACK linker and NETLIB is not tested for ILP64 if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} run: | cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ From fc6b6e1c363c9087db072132e5fd973f5fd16adf Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:04:58 -0800 Subject: [PATCH 063/122] [CI] Improve MKL correctness checking + Add check for correct ScaLAPACK linkage --- .github/workflows/cmake.yml | 4 ++-- .github/workflows/scripts/blas_libname.sh | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6e8341b..f3622a2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -121,6 +121,6 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - #cmake -N -LA ${{runner.workspace}}/build-findscalapack-default | \ - #grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}}` + cmake -N -LA ${{runner.workspace}}/build-findscalapack-default | \ + grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}}` diff --git a/.github/workflows/scripts/blas_libname.sh b/.github/workflows/scripts/blas_libname.sh index 63dbf4a..7dc82c3 100755 --- a/.github/workflows/scripts/blas_libname.sh +++ b/.github/workflows/scripts/blas_libname.sh @@ -6,16 +6,18 @@ export int_type=$3 if [ "$dist_name" == "intel-mkl" ] then + export mkl_base_name="mkl_intel_$3" if [ "$thread_name" == "sequential" ] then - echo "mkl_intel_$3.*mkl_sequential.*" + export mkl_thread_name="mkl_sequential" elif [ "$thread_name" == "openmp" ] then - echo "mkl_intel_$3.*mkl_(gnu|intel|pgi)_thread.*" + export mkl_thread_name="mkl_(gnu|intel|pgi)_thread" elif [ "$thread_name" == "tbb" ] then - echo "mkl_intel_$3.*mkl_tbb_thread.*" + export mkl_thread_name="mkl_tbb_thread" fi + echo "$mkl_base_name.*$mkl_thread_name" elif [ "$dist_name" == "netlib" ] then echo "blas" From 61a249af57dc0608d22476be23577abe90795ee5 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:08:30 -0800 Subject: [PATCH 064/122] [CI] Added missing script --- .../workflows/scripts/scalapack_libname.sh | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 .github/workflows/scripts/scalapack_libname.sh diff --git a/.github/workflows/scripts/scalapack_libname.sh b/.github/workflows/scripts/scalapack_libname.sh new file mode 100755 index 0000000..4bed393 --- /dev/null +++ b/.github/workflows/scripts/scalapack_libname.sh @@ -0,0 +1,39 @@ + +#!/bin/bash + +export dist_name=$1 +export thread_name=$2 +export int_type=$3 +export mpi_type=$4 + +if [ "$dist_name" == "intel-mkl" ] +then + export mkl_scalapack_name="mkl_scalapack_$3" + + if [ "$mpi_type" == "mpich" ] || [ "$mpi_type" == "intelmpi" ] + then + export mkl_blacs_name="mkl_blacs_intelmpi_$3" + elif [ "$mpi_type" == "openmpi" ] + then + export mkl_blacs_name="mkl_blacs_openmpi_$3" + else + export mkl_blacs_name="mkl_blacs_sgimpt_$3" + fi + + + export mkl_base_name="mkl_intel_$3" + if [ "$thread_name" == "sequential" ] + then + export mkl_thread_name="mkl_sequential" + elif [ "$thread_name" == "openmp" ] + then + export mkl_thread_name="mkl_(gnu|intel|pgi)_thread" + elif [ "$thread_name" == "tbb" ] + then + export mkl_thread_name="mkl_tbb_thread" + fi + echo "$mkl_scalapack_name.*$mkl_base_name.*$mkl_thread_name.*$mkl_blacs_name" +else + echo "scalapack" +fi + From 282b7bef6677e94683e6e39cc181b8d82250aeec Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:17:15 -0800 Subject: [PATCH 065/122] [CI] Added integer specific ScaLAPACK tests + fixup in CI matrix for Default ScaLAPACK + MKL-ILP64 --- .github/workflows/cmake.yml | 17 ++++++++++++++++- .github/workflows/linalg/Makefile | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f3622a2..84ea985 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -114,7 +114,10 @@ jobs: - name: FindScaLAPACK Default - if: ${{ matrix.linalg_lib == 'intel-mkl' || matrix.int_interface == 'lp64' }} + # Disable for + # - Non-MKL-ILP64 b/c NETLIB can't handle ILP64 consist + # - MKL-ILP64 b/c the default is LP64 unless otherwise specified + if: ${{ (matrix.linalg_lib == 'intel-mkl' && matrix.int_interface == 'lp64') || matrix.int_interface == 'lp64' }} run: | cmake -H${GITHUB_WORKSPACE}/examples/scalapack/default \ -B${{runner.workspace}}/build-findscalapack-default \ @@ -124,3 +127,15 @@ jobs: cmake -N -LA ${{runner.workspace}}/build-findscalapack-default | \ grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}}` + - name: FindScaLAPACK Integer Specific + # Disable for + # - Non-MKL-ILP64 b/c NETLIB can't handle ILP64 consist + if: ${{ matrix.linalg_lib == 'intel-mkl' || matrix.int_interface == 'lp64' }} + run: | + cmake -H${GITHUB_WORKSPACE}/examples/scalapack/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + cmake -N -LA ${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} | \ + grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}}` diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index 5d3c64d..9ccb65d 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -161,6 +161,7 @@ install/netlib/lp64-sequential-static: rm -fr ${software_prefix}/build/netlib-lp64-sequential cmake -H${software_prefix}/src/netlib/scalapack-2.1.0 \ -B${software_prefix}/build/netlib-lp64-sequential \ + -DSCALAPACK_BUILD_TESTS=OFF \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential cmake --build ${software_prefix}/build/netlib-lp64-sequential --target install @@ -169,6 +170,7 @@ install/netlib/lp64-sequential-shared: rm -fr ${software_prefix}/build/netlib-lp64-sequential cmake -H${software_prefix}/src/netlib/scalapack-2.1.0 \ -B${software_prefix}/build/netlib-lp64-sequential \ + -DSCALAPACK_BUILD_TESTS=OFF \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_INSTALL_PREFIX=${software_prefix}/install/netlib-lp64-sequential From 35969e5673d10f8916e58b91a98dd8e905d7079c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:23:10 -0800 Subject: [PATCH 066/122] [CI] Add OpenMPI to CI matrix --- .github/workflows/cmake.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 84ea985..b16faa5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: linalg_lib: [blis,openblas,netlib,intel-mkl] - mpi_dist: [mpich] + mpi_dist: [mpich,openmpi] int_interface: [lp64,ilp64] thread: [sequential,openmp,pthreads] exclude: @@ -30,8 +30,6 @@ jobs: - name: Ubuntu Setup run: | - sudo apt-get remove libblas-dev libblas3 libgslcblas0 - sudo apt-get remove liblapack-dev liblapack3 sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 sudo make -C .github/workflows/linalg install/main sudo make -C .github/workflows/linalg install/cmake @@ -41,6 +39,7 @@ jobs: - name: Setup MPI run: | sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} + which mpicc - name: Build Linalg From 62648ed5f4113b977bb1832f8e38093e8c51e7cc Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:33:19 -0800 Subject: [PATCH 067/122] [CI] Minor --- .github/workflows/scripts/lapack_libname.sh | 10 ++++---- .../workflows/scripts/scalapack_libname.sh | 23 ++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/scripts/lapack_libname.sh b/.github/workflows/scripts/lapack_libname.sh index c0aac33..9088b96 100755 --- a/.github/workflows/scripts/lapack_libname.sh +++ b/.github/workflows/scripts/lapack_libname.sh @@ -8,15 +8,17 @@ my_realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } +export local_path=$(my_realpath $0) +export script_dir=$(dirname $local_path) +export blas_name=`$script_dir/blas_libname.sh "$dist_name" "$thread_name" "$int_type"` + if [ "$dist_name" == "netlib" ] then echo "lapack" elif [ "$dist_name" == "blis" ] then - echo "lapack.*blis" + echo "lapack.*$blas_name" else - export local_path=$(my_realpath $0) - export script_dir=$(dirname $local_path) - $script_dir/blas_libname.sh "$dist_name" "$thread_name" "$int_type" + echo "$blas_name" fi diff --git a/.github/workflows/scripts/scalapack_libname.sh b/.github/workflows/scripts/scalapack_libname.sh index 4bed393..3ebe419 100755 --- a/.github/workflows/scripts/scalapack_libname.sh +++ b/.github/workflows/scripts/scalapack_libname.sh @@ -6,6 +6,15 @@ export thread_name=$2 export int_type=$3 export mpi_type=$4 +my_realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + + +export local_path=$(my_realpath $0) +export script_dir=$(dirname $local_path) +export lapack_name=`$script_dir/lapack_libname.sh "$dist_name" "$thread_name" "$int_type"` + if [ "$dist_name" == "intel-mkl" ] then export mkl_scalapack_name="mkl_scalapack_$3" @@ -20,19 +29,7 @@ then export mkl_blacs_name="mkl_blacs_sgimpt_$3" fi - - export mkl_base_name="mkl_intel_$3" - if [ "$thread_name" == "sequential" ] - then - export mkl_thread_name="mkl_sequential" - elif [ "$thread_name" == "openmp" ] - then - export mkl_thread_name="mkl_(gnu|intel|pgi)_thread" - elif [ "$thread_name" == "tbb" ] - then - export mkl_thread_name="mkl_tbb_thread" - fi - echo "$mkl_scalapack_name.*$mkl_base_name.*$mkl_thread_name.*$mkl_blacs_name" + echo "$mkl_scalapack_name.*$lapack_name.*$mkl_blacs_name" else echo "scalapack" fi From 603882c6a544140c3bca9adea60ea8d2e2ec9a88 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:47:15 -0800 Subject: [PATCH 068/122] [CI] Only test OpenMPI for MKL - trivial for others --- .github/workflows/cmake.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b16faa5..d999d75 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,6 +21,10 @@ jobs: thread: openmp - linalg_lib: intel-mkl thread: pthreads + - mpi_dist: openmpi + include: + - mpi_dist: openmpi + linalg_lib: intel-mkl env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' From 5bb4f8d3090f6feaf80e87393602baab25f8ebef Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:49:18 -0800 Subject: [PATCH 069/122] [CI] Try to convince CI matrix to run all MKL paths with OpenMPI --- .github/workflows/cmake.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d999d75..13871e5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -25,6 +25,8 @@ jobs: include: - mpi_dist: openmpi linalg_lib: intel-mkl + int_interface: [lp64,ilp64] + thread: [sequential,openmp,pthreads] env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' From 529bf2b017406f587afc8e736b5a07743bd3931a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sat, 6 Feb 2021 12:54:12 -0800 Subject: [PATCH 070/122] [CI] Manual OpenMPI restriction --- .github/workflows/cmake.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 13871e5..401b61f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,12 +21,12 @@ jobs: thread: openmp - linalg_lib: intel-mkl thread: pthreads + - linalg_lib: netlib + - mpi_dist: openmpi + - linalg_lib: blis - mpi_dist: openmpi - include: + - linalg_lib: openblas - mpi_dist: openmpi - linalg_lib: intel-mkl - int_interface: [lp64,ilp64] - thread: [sequential,openmp,pthreads] env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' From bad919cda5865d0f0ff1d37ae332f7c62114888a Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 11:21:15 -0800 Subject: [PATCH 071/122] [MACROS] Minor --- LinAlgModulesMacros.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index e570b55..f47abbb 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -2,10 +2,10 @@ set( LINALG_MACROS_DIR ${CMAKE_CURRENT_LIST_DIR} ) macro( find_linalg_dependencies _libs ) foreach( _lib ${${_libs}} ) - if (${_lib} MATCHES "OpenMP::OpenMP") - find_package(OpenMP) - elseif (${_lib} MATCHES "Threads::Threads") - find_package(Threads) + if (${_lib} MATCHES "OpenMP") + find_dependency(OpenMP) + elseif (${_lib} MATCHES "Threads") + find_dependency(Threads) endif() endforeach() endmacro() From 81fa1754dc592a0b6bde98abd650a8270d74fa1b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 11:22:03 -0800 Subject: [PATCH 072/122] [CI] Typo in CI Matrix --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 401b61f..ec25e84 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -22,11 +22,11 @@ jobs: - linalg_lib: intel-mkl thread: pthreads - linalg_lib: netlib - - mpi_dist: openmpi + mpi_dist: openmpi - linalg_lib: blis - - mpi_dist: openmpi + mpi_dist: openmpi - linalg_lib: openblas - - mpi_dist: openmpi + mpi_dist: openmpi env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' From c59d699da4126526ab8b7f6f98d594dcae84eaf8 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 12:30:34 -0800 Subject: [PATCH 073/122] [BLAS/LAPACK] Cache more variables + add INCLUDE_DIRECTORIES/COMPILE_OPTIONS to LAPACK::LAPACK --- FindBLAS.cmake | 8 +++++++- FindLAPACK.cmake | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 835334f..692b2ee 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -110,7 +110,13 @@ find_package_handle_standard_args( BLAS ) # Cache variables -set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE STRING "BLAS Libraries" FORCE ) +if( BLAS_FOUND ) + set( BLAS_VENDOR "${BLAS_VENDOR}" CACHE STRING "BLAS Vendor" FORCE ) + set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE STRING "BLAS Libraries" FORCE ) + set( BLAS_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" CACHE STRING "BLAS Compile Definitions" FORCE ) + set( BLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}" CACHE STRING "BLAS Include Directories" FORCE ) + set( BLAS_COMPILE_OPTIONS "${BLAS_COMPILE_OPTIONS}" CACHE STRING "BLAS Compile Options" FORCE ) +endif() if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 2c8eed4..be8080f 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -160,12 +160,20 @@ find_package_handle_standard_args( LAPACK ) # Cache variables -set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) +if( LAPACK_FOUND ) + set( LAPACK_VENDOR "${LAPACK_VENDOR}" CACHE STRING "LAPACK Vendor" FORCE ) + set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) + set( LAPACK_COMPILE_DEFINITIONS "${LAPACK_COMPILE_DEFINITIONS}" CACHE STRING "LAPACK Compile Definitions" FORCE ) + set( LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}" CACHE STRING "LAPACK Include Directories" FORCE ) + set( LAPACK_COMPILE_OPTIONS "${LAPACK_COMPILE_OPTIONS}" CACHE STRING "LAPACK Compile Options" FORCE ) +endif() if( LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK ) add_library( LAPACK::LAPACK INTERFACE IMPORTED ) set_target_properties( LAPACK::LAPACK PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIRS}" + INTERFACE_COMPILE_OPTIONS "${LAPACK_COMPILE_OPTIONS}" INTERFACE_COMPILE_DEFINITIONS "${LAPACK_COMPILE_DEFINITIONS}" INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}" ) From d1e40301844b46da658da881841b96c0299634d3 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 13:06:48 -0800 Subject: [PATCH 074/122] [ILP64] Added ILP64 check module --- FindILP64.cmake | 21 +++++++++++++++++++++ examples/ilp64/CMakeLists.txt | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 FindILP64.cmake create mode 100644 examples/ilp64/CMakeLists.txt diff --git a/FindILP64.cmake b/FindILP64.cmake new file mode 100644 index 0000000..52a380b --- /dev/null +++ b/FindILP64.cmake @@ -0,0 +1,21 @@ +set( ILP64_COMPILE_OPTIONS + # Ensure 64-bit executables for GNU C,CXX,Fortran + $<$,$>:"-m64"> + # Make default integers 64-bit for Fortran + $<$,$>:"-i8"> + $<$,$>:"-fdefault-integer-8"> +) + +get_property( _enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES ) +set( ILP64_FLAGS_WORK ) +foreach(_lang ${_enabled_langauges}) + if( NOT _lang MATCHES "RC" ) + include( Check${_lang}CompilerFlag ) + check_${_lang}_compiler_flag( ${ILP64_COMPILE_OPTIONS} ${_lang}_ILP64_FLAGS_WORK ) + list(APPEND ILP64_FLAGS_WORK ${_lang}_ILP64_FLAGS_WORK ) + endif() +endif() +unset( _enabled_languages ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( ILP64 REQUIRED_VARS ${ILP64_FLAGS_WORK} ) diff --git a/examples/ilp64/CMakeLists.txt b/examples/ilp64/CMakeLists.txt new file mode 100644 index 0000000..98c1073 --- /dev/null +++ b/examples/ilp64/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required( VERSION 3.17 FATAL_ERROR ) +project( check_ilp64 LANGUAGES C CXX Fortran ) + +find_package( ILP64 REQUIRED ) From 6602ea06facab40a402d436143e445280574d0a5 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 21:54:01 +0000 Subject: [PATCH 075/122] [ILP64/IntelMKL] Move ILP64 flags from Intel MKL to FindBLAS/LAPACK/ScaLAPACK --- FindBLAS.cmake | 2 ++ FindILP64.cmake | 21 +++++--------------- FindIntelMKL.cmake | 24 +++++++++++------------ FindLAPACK.cmake | 2 ++ FindScaLAPACK.cmake | 2 ++ examples/blas/default/CMakeLists.txt | 1 + examples/blas/ilp64/CMakeLists.txt | 1 + examples/blas/lp64/CMakeLists.txt | 1 + examples/ilp64/CMakeLists.txt | 7 +++++++ examples/ilp64/test.c | 3 +++ examples/ilp64/test.cxx | 3 +++ examples/ilp64/test.f90 | 3 +++ examples/lapack/default/CMakeLists.txt | 1 + examples/lapack/ilp64/CMakeLists.txt | 1 + examples/lapack/lp64/CMakeLists.txt | 1 + examples/scalapack/default/CMakeLists.txt | 1 + examples/scalapack/ilp64/CMakeLists.txt | 1 + examples/scalapack/lp64/CMakeLists.txt | 1 + 18 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 examples/ilp64/test.c create mode 100644 examples/ilp64/test.cxx create mode 100644 examples/ilp64/test.f90 diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 692b2ee..1e4291b 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -99,6 +99,8 @@ if( BLAS_LINK_OK ) else() set( BLAS_lp64_FOUND FALSE ) set( BLAS_ilp64_FOUND TRUE ) + find_dependency( ILP64 ) + list( APPEND BLAS_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) endif() endif() diff --git a/FindILP64.cmake b/FindILP64.cmake index 52a380b..cc2a464 100644 --- a/FindILP64.cmake +++ b/FindILP64.cmake @@ -1,21 +1,10 @@ set( ILP64_COMPILE_OPTIONS # Ensure 64-bit executables for GNU C,CXX,Fortran - $<$,$>:"-m64"> + $<$,$>:-m64> # Make default integers 64-bit for Fortran - $<$,$>:"-i8"> - $<$,$>:"-fdefault-integer-8"> + $<$,$>:-i8> + $<$,$>:-fdefault-integer-8> ) -get_property( _enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES ) -set( ILP64_FLAGS_WORK ) -foreach(_lang ${_enabled_langauges}) - if( NOT _lang MATCHES "RC" ) - include( Check${_lang}CompilerFlag ) - check_${_lang}_compiler_flag( ${ILP64_COMPILE_OPTIONS} ${_lang}_ILP64_FLAGS_WORK ) - list(APPEND ILP64_FLAGS_WORK ${_lang}_ILP64_FLAGS_WORK ) - endif() -endif() -unset( _enabled_languages ) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( ILP64 REQUIRED_VARS ${ILP64_FLAGS_WORK} ) +set( ILP64_FOUND TRUE CACHE BOOL "ILP64 Flags Found" FORCE ) +set( ILP64_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" CACHE STRING "ILP64 Flags" FORCE ) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 8033759..f3d378a 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -303,19 +303,19 @@ find_library( IntelMKL_LP64_ScaLAPACK_LIBRARY # Default to LP64 if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS ) - set( IntelMKL_COMPILE_DEFINITIONS "MKL_ILP64" ) - if( CMAKE_C_COMPILER_ID MATCHES "GNU" ) - set( IntelMKL_C_COMPILE_FLAGS "-m64" ) - endif() - if( CMAKE_Fortran_COMPILER_ID MATCHES "GNU" ) - set( IntelMKL_Fortran_COMPILE_FLAGS "-m64" "-fdefault-integer-8" ) - elseif( CMAKE_Fortran_COMPILER_ID MATCHES "Flang" ) - set( IntelMKL_Fortran_COMPILE_FLAGS "-fdefault-integer-8" ) - elseif( CMAKE_C_COMPILER_ID MATCHES "PGI" ) - set( IntelMKL_Fortran_COMPILE_FLAGS "-i8" ) - endif() + # set( IntelMKL_COMPILE_DEFINITIONS "MKL_ILP64" ) + # if( CMAKE_C_COMPILER_ID MATCHES "GNU" ) + # set( IntelMKL_C_COMPILE_FLAGS "-m64" ) + # endif() + # if( CMAKE_Fortran_COMPILER_ID MATCHES "GNU" ) + # set( IntelMKL_Fortran_COMPILE_FLAGS "-m64" "-fdefault-integer-8" ) + # elseif( CMAKE_Fortran_COMPILER_ID MATCHES "Flang" ) + # set( IntelMKL_Fortran_COMPILE_FLAGS "-fdefault-integer-8" ) + # elseif( CMAKE_C_COMPILER_ID MATCHES "PGI" ) + # set( IntelMKL_Fortran_COMPILE_FLAGS "-i8" ) + # endif() set( IntelMKL_LIBRARY ${IntelMKL_ILP64_LIBRARY} ) - set( IntelMKL_COMPILE_OPTIONS ${IntelMKL_C_COMPILE_FLAGS} ) + # set( IntelMKL_COMPILE_OPTIONS ${IntelMKL_C_COMPILE_FLAGS} ) if( IntelMKL_ILP64_BLACS_LIBRARY ) set( IntelMKL_BLACS_LIBRARY ${IntelMKL_ILP64_BLACS_LIBRARY} ) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index be8080f..11eea78 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -141,6 +141,8 @@ if( LAPACK_LINK_OK ) else() set( LAPACK_lp64_FOUND FALSE ) set( LAPACK_ilp64_FOUND TRUE ) + find_dependency( ILP64 ) + list( APPEND LAPACK_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) endif() else() diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 0c0a2f2..571beab 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -166,6 +166,8 @@ if( ScaLAPACK_LINK_OK ) else() set( ScaLAPACK_lp64_FOUND FALSE ) set( ScaLAPACK_ilp64_FOUND TRUE ) + find_dependency( ILP64 ) + list( APPEND ScaLAPACK_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) endif() else() diff --git a/examples/blas/default/CMakeLists.txt b/examples/blas/default/CMakeLists.txt index 92f067e..6f4d506 100644 --- a/examples/blas/default/CMakeLists.txt +++ b/examples/blas/default/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( BLAS REQUIRED ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) +message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) diff --git a/examples/blas/ilp64/CMakeLists.txt b/examples/blas/ilp64/CMakeLists.txt index 8e17997..0682eab 100644 --- a/examples/blas/ilp64/CMakeLists.txt +++ b/examples/blas/ilp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( BLAS REQUIRED COMPONENTS ilp64 ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) +message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) diff --git a/examples/blas/lp64/CMakeLists.txt b/examples/blas/lp64/CMakeLists.txt index 65ffd9c..b1e1040 100644 --- a/examples/blas/lp64/CMakeLists.txt +++ b/examples/blas/lp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( BLAS REQUIRED COMPONENTS lp64 ) message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) +message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) diff --git a/examples/ilp64/CMakeLists.txt b/examples/ilp64/CMakeLists.txt index 98c1073..945e1aa 100644 --- a/examples/ilp64/CMakeLists.txt +++ b/examples/ilp64/CMakeLists.txt @@ -2,3 +2,10 @@ cmake_minimum_required( VERSION 3.17 FATAL_ERROR ) project( check_ilp64 LANGUAGES C CXX Fortran ) find_package( ILP64 REQUIRED ) +add_executable( my_test_c test.c ) +add_executable( my_test_cxx test.cxx ) +add_executable( my_test_fortran test.f90 ) + +target_compile_options( my_test_c PUBLIC ${ILP64_COMPILE_OPTIONS} ) +target_compile_options( my_test_cxx PUBLIC ${ILP64_COMPILE_OPTIONS} ) +target_compile_options( my_test_fortran PUBLIC ${ILP64_COMPILE_OPTIONS} ) diff --git a/examples/ilp64/test.c b/examples/ilp64/test.c new file mode 100644 index 0000000..cd357bf --- /dev/null +++ b/examples/ilp64/test.c @@ -0,0 +1,3 @@ +int main(int argc, char** argv) { + return 0; +} diff --git a/examples/ilp64/test.cxx b/examples/ilp64/test.cxx new file mode 100644 index 0000000..cd357bf --- /dev/null +++ b/examples/ilp64/test.cxx @@ -0,0 +1,3 @@ +int main(int argc, char** argv) { + return 0; +} diff --git a/examples/ilp64/test.f90 b/examples/ilp64/test.f90 new file mode 100644 index 0000000..fb16805 --- /dev/null +++ b/examples/ilp64/test.f90 @@ -0,0 +1,3 @@ + program my_program + implicit none + end program my_program diff --git a/examples/lapack/default/CMakeLists.txt b/examples/lapack/default/CMakeLists.txt index 9264fb4..0172aed 100644 --- a/examples/lapack/default/CMakeLists.txt +++ b/examples/lapack/default/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( LAPACK REQUIRED ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) diff --git a/examples/lapack/ilp64/CMakeLists.txt b/examples/lapack/ilp64/CMakeLists.txt index 61c08df..05dcc0d 100644 --- a/examples/lapack/ilp64/CMakeLists.txt +++ b/examples/lapack/ilp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( LAPACK REQUIRED COMPONENTS ilp64 ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) diff --git a/examples/lapack/lp64/CMakeLists.txt b/examples/lapack/lp64/CMakeLists.txt index 3f05835..f4cef88 100644 --- a/examples/lapack/lp64/CMakeLists.txt +++ b/examples/lapack/lp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( LAPACK REQUIRED COMPONENTS lp64 ) message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) diff --git a/examples/scalapack/default/CMakeLists.txt b/examples/scalapack/default/CMakeLists.txt index e4470b1..3c944ce 100644 --- a/examples/scalapack/default/CMakeLists.txt +++ b/examples/scalapack/default/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( ScaLAPACK REQUIRED ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) diff --git a/examples/scalapack/ilp64/CMakeLists.txt b/examples/scalapack/ilp64/CMakeLists.txt index 754d39e..c1c6769 100644 --- a/examples/scalapack/ilp64/CMakeLists.txt +++ b/examples/scalapack/ilp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( ScaLAPACK REQUIRED COMPONENTS ilp64 ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) diff --git a/examples/scalapack/lp64/CMakeLists.txt b/examples/scalapack/lp64/CMakeLists.txt index 1083341..34e68d5 100644 --- a/examples/scalapack/lp64/CMakeLists.txt +++ b/examples/scalapack/lp64/CMakeLists.txt @@ -5,6 +5,7 @@ find_package( ScaLAPACK REQUIRED COMPONENTS lp64 ) message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) From 48a184c6655848342b17ec50db2cbd9cd3e453d1 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Sun, 7 Feb 2021 22:06:08 +0000 Subject: [PATCH 076/122] [IntelMKL] Cleanup of commented out ILP64 flags --- FindIntelMKL.cmake | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index f3d378a..356f08e 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -303,19 +303,8 @@ find_library( IntelMKL_LP64_ScaLAPACK_LIBRARY # Default to LP64 if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS ) - # set( IntelMKL_COMPILE_DEFINITIONS "MKL_ILP64" ) - # if( CMAKE_C_COMPILER_ID MATCHES "GNU" ) - # set( IntelMKL_C_COMPILE_FLAGS "-m64" ) - # endif() - # if( CMAKE_Fortran_COMPILER_ID MATCHES "GNU" ) - # set( IntelMKL_Fortran_COMPILE_FLAGS "-m64" "-fdefault-integer-8" ) - # elseif( CMAKE_Fortran_COMPILER_ID MATCHES "Flang" ) - # set( IntelMKL_Fortran_COMPILE_FLAGS "-fdefault-integer-8" ) - # elseif( CMAKE_C_COMPILER_ID MATCHES "PGI" ) - # set( IntelMKL_Fortran_COMPILE_FLAGS "-i8" ) - # endif() + set( IntelMKL_LIBRARY ${IntelMKL_ILP64_LIBRARY} ) - # set( IntelMKL_COMPILE_OPTIONS ${IntelMKL_C_COMPILE_FLAGS} ) if( IntelMKL_ILP64_BLACS_LIBRARY ) set( IntelMKL_BLACS_LIBRARY ${IntelMKL_ILP64_BLACS_LIBRARY} ) From c1b4ea459910187670b697dd58107a31a6138bb6 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 08:55:00 -0800 Subject: [PATCH 077/122] [MISC] Propagate XXX_PREFERS_STATIC and add script to check cmake cache in CI --- .github/workflows/cmake.yml | 7 +++++-- .../scripts/check_blas_cmake_cache.sh | 18 ++++++++++++++++++ LinAlgModulesMacros.cmake | 1 + util/CommonFunctions.cmake | 4 ++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/scripts/check_blas_cmake_cache.sh diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ec25e84..e6cf594 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -76,8 +76,11 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + ./github/workflows/scripts/check_blas_cmake_cache.sh \ + ${{runner.workspace}}/build-findblas-default \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} + #cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ + #grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindBLAS Integer Specific run: | diff --git a/.github/workflows/scripts/check_blas_cmake_cache.sh b/.github/workflows/scripts/check_blas_cmake_cache.sh new file mode 100644 index 0000000..06dc850 --- /dev/null +++ b/.github/workflows/scripts/check_blas_cmake_cache.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +export cmake_dir=$1 +export linalg_dist=$2 +export linalg_thread=$3 +export linalg_int=$4 + + +my_realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +export local_path=$(my_realpath $0) +export script_dir=$(dirname $local_path) + +cmake -N -LA $cmake_dir | \ + grep "BLAS_LIBRARIES" | \ + grep -q -E `$script_dir/blas_libname.sh $linalg_dist $linalg_thread $linalg_int` diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index f47abbb..7cb867e 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -23,6 +23,7 @@ set( LINALG_FIND_MODULES FindReferenceLAPACK.cmake FindReferenceScaLAPACK.cmake FindScaLAPACK.cmake + FindILP64.cmake FindStandardFortran.cmake LinAlgModulesMacros.cmake ) diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 75065b5..e6f652c 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -77,6 +77,10 @@ function( copy_meta_data _src _dest ) set( ${_dest}_LIBRARY_DIR ${${_src}_LIBRARY_DIR} PARENT_SCOPE ) endif() + if( ${_src}_PREFERS_STATIC AND NOT ${_dest}_PREFERS_STATIC ) + set( ${_dest}_PREFERS_STATIC ${${_src}_PREFERS_STATIC} PARENT_SCOPE ) + endif() + endfunction() From 57bf00cac0022395d8c2b9657e866dd4c3081253 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:00:37 -0800 Subject: [PATCH 078/122] [CI] Typo --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e6cf594..d3aa358 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -76,7 +76,7 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - ./github/workflows/scripts/check_blas_cmake_cache.sh \ + .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/build-findblas-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} #cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ From 213823412638e46419cf707fa5a972f96e21c6e1 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:05:27 -0800 Subject: [PATCH 079/122] [CI] Change script to be executable --- .github/workflows/scripts/check_blas_cmake_cache.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/workflows/scripts/check_blas_cmake_cache.sh diff --git a/.github/workflows/scripts/check_blas_cmake_cache.sh b/.github/workflows/scripts/check_blas_cmake_cache.sh old mode 100644 new mode 100755 From 1dbc957ad61fdfc6b50930b657a1fb0429a591d2 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:12:06 -0800 Subject: [PATCH 080/122] [CI] Add output to cmake check script --- .github/workflows/scripts/check_blas_cmake_cache.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/scripts/check_blas_cmake_cache.sh b/.github/workflows/scripts/check_blas_cmake_cache.sh index 06dc850..a6ebf93 100755 --- a/.github/workflows/scripts/check_blas_cmake_cache.sh +++ b/.github/workflows/scripts/check_blas_cmake_cache.sh @@ -13,6 +13,10 @@ my_realpath() { export local_path=$(my_realpath $0) export script_dir=$(dirname $local_path) + +echo "CHECKING BLAS_LIBRARIES=`cmake -N -LA $cmake_dir | grep BLAS_LIBRARIES`" +echo "REFERENCE REGEX=`$script_dir/blas_libname.sh $linalg_dist $linalg_thread $linalg_int`" + cmake -N -LA $cmake_dir | \ grep "BLAS_LIBRARIES" | \ grep -q -E `$script_dir/blas_libname.sh $linalg_dist $linalg_thread $linalg_int` From 6c51394df405c3f824bdff638f4d52b042f90c2e Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:20:40 -0800 Subject: [PATCH 081/122] [CI] Added scripts to check LAPACK/ScaLAPACK CMake caches --- .github/workflows/cmake.yml | 27 ++++++++++--------- .../scripts/check_lapack_cmake_cache.sh | 22 +++++++++++++++ .../scripts/check_scalapack_cmake_cache.sh | 23 ++++++++++++++++ 3 files changed, 60 insertions(+), 12 deletions(-) create mode 100755 .github/workflows/scripts/check_lapack_cmake_cache.sh create mode 100755 .github/workflows/scripts/check_scalapack_cmake_cache.sh diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d3aa358..506f6b3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -79,8 +79,6 @@ jobs: .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/build-findblas-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} - #cmake -N -LA ${{runner.workspace}}/build-findblas-default | \ - #grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` - name: FindBLAS Integer Specific run: | @@ -89,8 +87,9 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findblas-${{matrix.int_interface}} | \ - grep "BLAS_LIBRARIES" | grep -q -E `.github/workflows/scripts/blas_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + .github/workflows/scripts/check_blas_cmake_cache.sh \ + ${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -105,8 +104,9 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findlapack-default | \ - grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + .github/workflows/scripts/check_lapack_cmake_cache.sh \ + ${{runner.workspace}}/build-findlapack-default \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} - name: FindLAPACK Integer Specific # Disable for BLIS-ILP64 b/c BLIS doesn't have a LAPACK linker and NETLIB is not tested for ILP64 @@ -117,8 +117,9 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} | \ - grep "LAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/lapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}}` + .github/workflows/scripts/check_lapack_cmake_cache.sh \ + ${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} - name: FindScaLAPACK Default @@ -132,8 +133,9 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findscalapack-default | \ - grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}}` + .github/workflows/scripts/check_scalapack_cmake_cache.sh \ + ${{runner.workspace}}/build-findscalapack-default \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} - name: FindScaLAPACK Integer Specific # Disable for @@ -145,5 +147,6 @@ jobs: -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ -DIntelMKL_THREAD_LAYER=${{matrix.thread}} - cmake -N -LA ${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} | \ - grep "ScaLAPACK_LIBRARIES" | grep -q -E `.github/workflows/scripts/scalapack_libname.sh ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}}` + .github/workflows/scripts/check_scalapack_cmake_cache.sh \ + ${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} diff --git a/.github/workflows/scripts/check_lapack_cmake_cache.sh b/.github/workflows/scripts/check_lapack_cmake_cache.sh new file mode 100755 index 0000000..da45532 --- /dev/null +++ b/.github/workflows/scripts/check_lapack_cmake_cache.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +export cmake_dir=$1 +export linalg_dist=$2 +export linalg_thread=$3 +export linalg_int=$4 + + +my_realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +export local_path=$(my_realpath $0) +export script_dir=$(dirname $local_path) + + +echo "CHECKING LAPACK_LIBRARIES=`cmake -N -LA $cmake_dir | grep LAPACK_LIBRARIES`" +echo "REFERENCE REGEX=`$script_dir/lapack_libname.sh $linalg_dist $linalg_thread $linalg_int`" + +cmake -N -LA $cmake_dir | \ + grep "LAPACK_LIBRARIES" | \ + grep -q -E `$script_dir/lapack_libname.sh $linalg_dist $linalg_thread $linalg_int` diff --git a/.github/workflows/scripts/check_scalapack_cmake_cache.sh b/.github/workflows/scripts/check_scalapack_cmake_cache.sh new file mode 100755 index 0000000..66a129b --- /dev/null +++ b/.github/workflows/scripts/check_scalapack_cmake_cache.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +export cmake_dir=$1 +export linalg_dist=$2 +export linalg_thread=$3 +export linalg_int=$4 +export mpi_dist=$5 + + +my_realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +export local_path=$(my_realpath $0) +export script_dir=$(dirname $local_path) + + +echo "CHECKING ScaLAPACK_LIBRARIES=`cmake -N -LA $cmake_dir | grep ScaLAPACK_LIBRARIES`" +echo "REFERENCE REGEX=`$script_dir/scalapack_libname.sh $linalg_dist $linalg_thread $linalg_int $mpi_dist`" + +cmake -N -LA $cmake_dir | \ + grep "ScaLAPACK_LIBRARIES" | \ + grep -q -E `$script_dir/scalapack_libname.sh $linalg_dist $linalg_thread $linalg_int $mpi_dist` From 9886356c1376d53b0184c61e5eb638e4cde7cd0c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:24:10 -0800 Subject: [PATCH 082/122] [CI] Add test for static linkage --- .github/workflows/cmake.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 506f6b3..3fbc44b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -91,6 +91,17 @@ jobs: ${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} + - name: FindBLAS Static Linkage + run: | + cmake -H${GITHUB_WORKSPACE}/examples/blas/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findblas-static \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DIntelMKL_THREAD_LAYER=${{matrix.thread}} \ + -DBLAS_PREFERS_STATIC=ON + .github/workflows/scripts/check_blas_cmake_cache.sh \ + ${{runner.workspace}}/build-findblas-static \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} - name: FindLAPACK Default From 23aebf566797eb1bc92dcc101d55ffde596d8e01 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 09:42:52 -0800 Subject: [PATCH 083/122] [CI] Added error output in CI matrix --- .github/workflows/cmake.yml | 20 +++++++++++++------- util/CommonFunctions.cmake | 4 ++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3fbc44b..a661524 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -75,7 +75,7 @@ jobs: -B${{runner.workspace}}/build-findblas-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/build-findblas-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -86,7 +86,7 @@ jobs: -B${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/build-findblas-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -97,12 +97,18 @@ jobs: -B${{runner.workspace}}/build-findblas-static \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} \ + -DBLAS_THREAD_LAYER=${{matrix.thread}} \ -DBLAS_PREFERS_STATIC=ON .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/build-findblas-static \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} + - name: FindBLAS Static Linkage (Error Output) + if: ${{ failure() }} + run: | + echo "CMAKE OUTPUT" && cat ${{runner.workspace}}/build-findblas-static/CMakeFiles/CMakeOutput.log + echo "CMAKE ERROR" && cat ${{runner.workspace}}/build-findblas-static/CMakeFiles/CMakeError.log + - name: FindLAPACK Default # Disable for @@ -114,7 +120,7 @@ jobs: -B${{runner.workspace}}/build-findlapack-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_lapack_cmake_cache.sh \ ${{runner.workspace}}/build-findlapack-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -127,7 +133,7 @@ jobs: -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_lapack_cmake_cache.sh \ ${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -143,7 +149,7 @@ jobs: -B${{runner.workspace}}/build-findscalapack-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_scalapack_cmake_cache.sh \ ${{runner.workspace}}/build-findscalapack-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} @@ -157,7 +163,7 @@ jobs: -B${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DIntelMKL_THREAD_LAYER=${{matrix.thread}} + -DBLAS_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_scalapack_cmake_cache.sh \ ${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index e6f652c..eb329be 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -81,6 +81,10 @@ function( copy_meta_data _src _dest ) set( ${_dest}_PREFERS_STATIC ${${_src}_PREFERS_STATIC} PARENT_SCOPE ) endif() + if( ${_src}_THREAD_LAYER AND NOT ${_dest}_THREAD_LAYER ) + set( ${_dest}_THREAD_LAYER ${${_src}_THREAD_LAYER} PARENT_SCOPE ) + endif() + endfunction() From 971b2d4ccbf85989ea1b04edab8143931be562e3 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 18:06:21 +0000 Subject: [PATCH 084/122] [BLIS/MACROS] Improve library appendage on missing symbols --- FindBLIS.cmake | 5 +++-- util/BLASUtilities.cmake | 26 ++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index 9bee08c..ae2e03f 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -26,8 +26,9 @@ find_path( BLIS_INCLUDE_DIR ) if( BLIS_LIBRARIES ) - find_package( Threads QUIET ) - set( BLIS_LIBRARIES ${BLIS_LIBRARIES} Threads::Threads "m") + if( NOT "m" IN_LIST BLIS_LIBRARIES ) + list( APPEND BLIS_LIBRARIES "m") + endif() endif() # check ILP64 diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 235ff38..a31780c 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,14 +39,32 @@ foreach( _uplo LOWER UPPER ) else() - # Check for Standard Fortran Libraries - if(NOT STANDARDFORTRAN_LIBRARIES) - include(CMakeFindDependencyMacro) - find_dependency(StandardFortran REQUIRED) + if( _compile_output MATCHES "fortran" ) + # Check for Standard Fortran Libraries + if(NOT STANDARDFORTRAN_LIBRARIES) + include(CMakeFindDependencyMacro) + find_dependency( StandardFortran ) + endif() list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) endif() + if( _compile_output MATCHES "omp" ) + if( NOT TARGET OpenMP::OpenMP_C ) + find_dependency( OpenMP ) + endif() + list( APPEND ${_libs} OpenMP::OpenMP_C ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) + endif() + + if( _compile_output MATCHES "pthread" ) + if( NOT TARGET Threads::Threads ) + find_dependency( Threads ) + endif() + list( APPEND ${_libs} Threads::Threads ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) + endif() + # Recheck Compiliation check_function_exists_w_results( "${${_libs}}" ${_dgemm_name} _compile_output _compile_result From 46856a79a48e07c3d77922754fcd5116e7f6bb9b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 18:58:01 +0000 Subject: [PATCH 085/122] [MACROS] Factored out library appendange to separate function --- util/BLASUtilities.cmake | 55 ++++++++++++++++++++------------------ util/CommonFunctions.cmake | 45 +++++++++++++++++++++++++++++++ util/LAPACKUtilities.cmake | 30 ++++++++++++--------- 3 files changed, 92 insertions(+), 38 deletions(-) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index a31780c..277f9fc 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,31 +39,35 @@ foreach( _uplo LOWER UPPER ) else() - if( _compile_output MATCHES "fortran" ) - # Check for Standard Fortran Libraries - if(NOT STANDARDFORTRAN_LIBRARIES) - include(CMakeFindDependencyMacro) - find_dependency( StandardFortran ) - endif() - list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() - - if( _compile_output MATCHES "omp" ) - if( NOT TARGET OpenMP::OpenMP_C ) - find_dependency( OpenMP ) - endif() - list( APPEND ${_libs} OpenMP::OpenMP_C ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() - - if( _compile_output MATCHES "pthread" ) - if( NOT TARGET Threads::Threads ) - find_dependency( Threads ) - endif() - list( APPEND ${_libs} Threads::Threads ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() + #if( _compile_output MATCHES "fortran" ) + # # Check for Standard Fortran Libraries + # if(NOT STANDARDFORTRAN_LIBRARIES) + # include(CMakeFindDependencyMacro) + # find_dependency( StandardFortran ) + # endif() + # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + #endif() + + #if( _compile_output MATCHES "omp" ) + # if( NOT TARGET OpenMP::OpenMP_C ) + # find_dependency( OpenMP ) + # endif() + # list( APPEND ${_libs} OpenMP::OpenMP_C ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + #endif() + + #if( _compile_output MATCHES "pthread" ) + # if( NOT TARGET Threads::Threads ) + # find_dependency( Threads ) + # endif() + # list( APPEND ${_libs} Threads::Threads ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + #endif() + + append_possibly_missing_libs( BLAS _compile_output ${_libs} _new_libs ) + list( APPEND ${_libs} ${_new_libs} ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) # Recheck Compiliation check_function_exists_w_results( @@ -116,7 +120,6 @@ try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} RUN_OUTPUT_VARIABLE _run_output ) - if( ${_run_result} EQUAL 0 ) set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index eb329be..156edfa 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -141,3 +141,48 @@ function( check_function_exists_w_results _libs _func _output _result ) set( ${_result} "${${_result}}" PARENT_SCOPE ) endfunction() + +function( append_possibly_missing_libs _linker_test __compile_output _orig_libs __new_libs ) + + + set( _tmp_libs ) + # Check for missing Fortran symbols + if( ${__compile_output} MATCHES "fortran" ) + message( STATUS + " * Missing Standard Fortran Libs - Adding to ${_linker_test} linker" ) + # Check for Standard Fortran Libraries + if(NOT STANDARDFORTRAN_LIBRARIES) + include(CMakeFindDependencyMacro) + find_dependency( StandardFortran ) + endif() + list( APPEND _tmp_libs "${STANDARDFORTRAN_LIBRARIES}" ) + endif() + + + if( ${__compile_output} MATCHES "omp_" ) + message( STATUS + " * Missing OpenMP - Adding to ${_linker_test} linker" ) + if( NOT TARGET OpenMP::OpenMP_C ) + find_dependency( OpenMP ) + endif() + list( APPEND _tmp_libs OpenMP::OpenMP_C ) + endif() + + if( ${__compile_output} MATCHES "pthread_" ) + message( STATUS + " * Missing PThreads - Adding to ${_linker_test} linker" ) + if( NOT TARGET Threads::Threads ) + find_dependency( Threads ) + endif() + list( APPEND _tmp_libs Threads::Threads ) + endif() + + if( ${__compile_output} MATCHES "logf" ) + message( STATUS + " * Missing LIBM - Adding to ${_linker_test} linker" ) + list( APPEND _tmp_libs "m" ) + endif() + + set( ${__new_libs} "${_tmp_libs}" PARENT_SCOPE ) + +endfunction() diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index f48c5b9..231de36 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -37,22 +37,28 @@ foreach( _uplo LOWER UPPER ) else() - # Check for Standard Fortran Libraries - if(NOT STANDARDFORTRAN_LIBRARIES) - include(CMakeFindDependencyMacro) - find_dependency(StandardFortran REQUIRED) - list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() + ## Check for Standard Fortran Libraries + #if(NOT STANDARDFORTRAN_LIBRARIES) + # include(CMakeFindDependencyMacro) + # find_dependency(StandardFortran REQUIRED) + # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + #endif() - if( _compile_output MATCHES "logf" ) + #if( _compile_output MATCHES "logf" ) - message( STATUS " * Mising LIBM - Adding TO LAPACK LINKER" ) + # message( STATUS " * Mising LIBM - Adding TO LAPACK LINKER" ) - list( APPEND ${_libs} "m" ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) + # list( APPEND ${_libs} "m" ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + + #endif() + + + append_possibly_missing_libs( LAPACK _compile_output ${_libs} _new_libs ) + list( APPEND ${_libs} ${_new_libs} ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() # Recheck Compiliation check_function_exists_w_results( From 01efaa5c2d64ef5622d0c02c93e0d62a5591a73c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 18:59:09 +0000 Subject: [PATCH 086/122] [MACROS] Factored library appendange into FindScaLAPACK --- util/ScaLAPACKUtilities.cmake | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/util/ScaLAPACKUtilities.cmake b/util/ScaLAPACKUtilities.cmake index 1467c7c..5798d13 100644 --- a/util/ScaLAPACKUtilities.cmake +++ b/util/ScaLAPACKUtilities.cmake @@ -37,22 +37,26 @@ foreach( _uplo LOWER UPPER ) else() - # Check for Standard Fortran Libraries - if(NOT STANDARDFORTRAN_LIBRARIES) - include(CMakeFindDependencyMacro) - find_dependency(StandardFortran REQUIRED) - list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() + ## Check for Standard Fortran Libraries + #if(NOT STANDARDFORTRAN_LIBRARIES) + # include(CMakeFindDependencyMacro) + # find_dependency(StandardFortran REQUIRED) + # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) + #endif() - if( _compile_output MATCHES "logf" ) + #if( _compile_output MATCHES "logf" ) - message( STATUS " * Mising LIBM - Adding TO ScaLAPACK LINKER" ) + # message( STATUS " * Mising LIBM - Adding TO ScaLAPACK LINKER" ) - list( APPEND ${_libs} "m" ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) + # list( APPEND ${_libs} "m" ) + # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - endif() + #endif() + + append_possibly_missing_libs( ScaLAPACK _compile_output ${_libs} _new_libs ) + list( APPEND ${_libs} ${_new_libs} ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) # Recheck Compiliation check_function_exists_w_results( From ff63f061dca1bcc86c3a85ca5081a66400dd4d6b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 19:01:02 +0000 Subject: [PATCH 087/122] [CI] Added static tests for FindLAPACK --- .github/workflows/cmake.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a661524..e047cc8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -120,7 +120,7 @@ jobs: -B${{runner.workspace}}/build-findlapack-default \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DBLAS_THREAD_LAYER=${{matrix.thread}} + -DLAPACK_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_lapack_cmake_cache.sh \ ${{runner.workspace}}/build-findlapack-default \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} @@ -133,11 +133,24 @@ jobs: -B${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ - -DBLAS_THREAD_LAYER=${{matrix.thread}} + -DLAPACK_THREAD_LAYER=${{matrix.thread}} .github/workflows/scripts/check_lapack_cmake_cache.sh \ ${{runner.workspace}}/build-findlapack-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} + - name: FindLAPACK Static Linkage + if: ${{ matrix.linalg_lib != 'blis' || matrix.int_interface != 'ilp64' }} + run: | + cmake -H${GITHUB_WORKSPACE}/examples/lapack/${{matrix.int_interface}} \ + -B${{runner.workspace}}/build-findlapack-static \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DLAPACK_THREAD_LAYER=${{matrix.thread}} \ + -DLAPACK_PREFERS_STATIC=ON + .github/workflows/scripts/check_lapack_cmake_cache.sh \ + ${{runner.workspace}}/build-findlapack-static \ + ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} + - name: FindScaLAPACK Default # Disable for From a85f368c1a645dc8a177bbeeb5184f32ae62b37c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 19:23:17 +0000 Subject: [PATCH 088/122] [LAPACK/ScaLAPACK] Copy metadeta in LAPACK/ScaLAPACK --- FindLAPACK.cmake | 1 + FindScaLAPACK.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 11eea78..e1ed64d 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -36,6 +36,7 @@ if( NOT LAPACK_LIBRARIES ) # Find BLAS if( NOT TARGET BLAS::BLAS ) + copy_meta_data( LAPACK BLAS ) find_dependency( BLAS COMPONENTS ${LAPACK_REQUIRED_COMPONENTS} OPTIONAL_COMPONENTS ${LAPACK_OPTIONAL_COMPONENTS} diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 571beab..37754d4 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -64,6 +64,7 @@ if( NOT ScaLAPACK_LIBRARIES ) # Find LAPACK if( NOT TARGET LAPACK::LAPACK ) + copy_meta_data( ScaLAPACK LAPACK ) find_dependency( LAPACK COMPONENTS ${ScaLAPACK_REQUIRED_COMPONENTS} OPTIONAL_COMPONENTS ${ScaLAPACK_OPTIONAL_COMPONENTS} scalapack blacs From e392519686ef7cbf0bff0d0e0a967d799ba7edc9 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 19:39:42 +0000 Subject: [PATCH 089/122] [MACROS] Cleanup --- util/BLASUtilities.cmake | 26 -------------------------- util/LAPACKUtilities.cmake | 18 ------------------ util/ScaLAPACKUtilities.cmake | 17 ----------------- 3 files changed, 61 deletions(-) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 277f9fc..88e814d 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,32 +39,6 @@ foreach( _uplo LOWER UPPER ) else() - #if( _compile_output MATCHES "fortran" ) - # # Check for Standard Fortran Libraries - # if(NOT STANDARDFORTRAN_LIBRARIES) - # include(CMakeFindDependencyMacro) - # find_dependency( StandardFortran ) - # endif() - # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - #endif() - - #if( _compile_output MATCHES "omp" ) - # if( NOT TARGET OpenMP::OpenMP_C ) - # find_dependency( OpenMP ) - # endif() - # list( APPEND ${_libs} OpenMP::OpenMP_C ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - #endif() - - #if( _compile_output MATCHES "pthread" ) - # if( NOT TARGET Threads::Threads ) - # find_dependency( Threads ) - # endif() - # list( APPEND ${_libs} Threads::Threads ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - #endif() - append_possibly_missing_libs( BLAS _compile_output ${_libs} _new_libs ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index 231de36..f6c741c 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -37,24 +37,6 @@ foreach( _uplo LOWER UPPER ) else() - ## Check for Standard Fortran Libraries - #if(NOT STANDARDFORTRAN_LIBRARIES) - # include(CMakeFindDependencyMacro) - # find_dependency(StandardFortran REQUIRED) - # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - #endif() - - #if( _compile_output MATCHES "logf" ) - - # message( STATUS " * Mising LIBM - Adding TO LAPACK LINKER" ) - - # list( APPEND ${_libs} "m" ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - - #endif() - - append_possibly_missing_libs( LAPACK _compile_output ${_libs} _new_libs ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) diff --git a/util/ScaLAPACKUtilities.cmake b/util/ScaLAPACKUtilities.cmake index 5798d13..90f8057 100644 --- a/util/ScaLAPACKUtilities.cmake +++ b/util/ScaLAPACKUtilities.cmake @@ -37,23 +37,6 @@ foreach( _uplo LOWER UPPER ) else() - ## Check for Standard Fortran Libraries - #if(NOT STANDARDFORTRAN_LIBRARIES) - # include(CMakeFindDependencyMacro) - # find_dependency(StandardFortran REQUIRED) - # list( APPEND ${_libs} ${STANDARDFORTRAN_LIBRARIES} ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - #endif() - - #if( _compile_output MATCHES "logf" ) - - # message( STATUS " * Mising LIBM - Adding TO ScaLAPACK LINKER" ) - - # list( APPEND ${_libs} "m" ) - # set( ${_libs} ${${_libs}} PARENT_SCOPE ) - - #endif() - append_possibly_missing_libs( ScaLAPACK _compile_output ${_libs} _new_libs ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) From 687b7bbb7e547ff1e4166b7c190d82d293d7bcbc Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:00:42 +0000 Subject: [PATCH 090/122] [MISC] Added FindTBB from https://github.com/justusc/FindTBB, enabled TBB path in FindIntelMKL --- FindIntelMKL.cmake | 14 +- FindTBB.cmake | 303 +++++++++++++++++++++++++++++++++++++++ util/BLASUtilities.cmake | 2 + 3 files changed, 315 insertions(+), 4 deletions(-) create mode 100644 FindTBB.cmake diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 356f08e..28bb58c 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -413,20 +413,26 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) elseif( IntelMKL_THREAD_LAYER MATCHES "tbb" ) if( NOT TARGET tbb ) - message( FATAL_ERROR "TBB Bindings Not Currently Accessible Through FindIntelMKL" ) + #message( FATAL_ERROR "TBB Bindings Not Currently Accessible Through FindIntelMKL" ) find_dependency( TBB ) endif() - list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES tbb ) + set( _mkl_tbb_extra_libs tbb ) + if( IntelMKL_PREFERS_STATIC ) + list( APPEND _mkl_tbb_extra_libs "stdc++" ) + endif() + list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${_mkl_tbb_extra_libs} ) if( IntelMKL_BLACS_LIBRARIES ) - list( APPEND IntelMKL_BLACS_LIBRARIES tbb ) + list( APPEND IntelMKL_BLACS_LIBRARIES ${_mkl_tbb_extra_libs} ) endif() if( IntelMKL_ScaLAPACK_LIBRARIES ) - list( APPEND IntelMKL_ScaLAPACK_LIBRARIES tbb ) + list( APPEND IntelMKL_ScaLAPACK_LIBRARIES ${_mkl_tbb_extra_libs} ) endif() + unset( _mkl_tbb_extra_libs ) + endif() diff --git a/FindTBB.cmake b/FindTBB.cmake new file mode 100644 index 0000000..0a1a5bb --- /dev/null +++ b/FindTBB.cmake @@ -0,0 +1,303 @@ +# The MIT License (MIT) +# +# Copyright (c) 2015 Justus Calvin +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# +# FindTBB +# ------- +# +# Find TBB include directories and libraries. +# +# Usage: +# +# find_package(TBB [major[.minor]] [EXACT] +# [QUIET] [REQUIRED] +# [[COMPONENTS] [components...]] +# [OPTIONAL_COMPONENTS components...]) +# +# where the allowed components are tbbmalloc and tbb_preview. Users may modify +# the behavior of this module with the following variables: +# +# * TBB_ROOT_DIR - The base directory the of TBB installation. +# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files. +# * TBB_LIBRARY - The directory that contains the TBB library files. +# * TBB__LIBRARY - The path of the TBB the corresponding TBB library. +# These libraries, if specified, override the +# corresponding library search results, where +# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug, +# tbb_preview, or tbb_preview_debug. +# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will +# be used instead of the release version. +# +# Users may modify the behavior of this module with the following environment +# variables: +# +# * TBB_INSTALL_DIR +# * TBBROOT +# * LIBRARY_PATH +# +# This module will set the following variables: +# +# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or +# don’t want to use TBB. +# * TBB__FOUND - If False, optional part of TBB sytem is +# not available. +# * TBB_VERSION - The full version string +# * TBB_VERSION_MAJOR - The major version +# * TBB_VERSION_MINOR - The minor version +# * TBB_INTERFACE_VERSION - The interface version number defined in +# tbb/tbb_stddef.h. +# * TBB__LIBRARY_RELEASE - The path of the TBB release version of +# , where may be tbb, tbb_debug, +# tbbmalloc, tbbmalloc_debug, tbb_preview, or +# tbb_preview_debug. +# * TBB__LIBRARY_DEGUG - The path of the TBB release version of +# , where may be tbb, tbb_debug, +# tbbmalloc, tbbmalloc_debug, tbb_preview, or +# tbb_preview_debug. +# +# The following varibles should be used to build and link with TBB: +# +# * TBB_INCLUDE_DIRS - The include directory for TBB. +# * TBB_LIBRARIES - The libraries to link against to use TBB. +# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB. +# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB. +# * TBB_DEFINITIONS - Definitions to use when compiling code that uses +# TBB. +# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that +# uses TBB. +# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that +# uses TBB. +# +# This module will also create the "tbb" target that may be used when building +# executables and libraries. + +include(FindPackageHandleStandardArgs) + +if(NOT TBB_FOUND) + + ################################## + # Check the build type + ################################## + + if(NOT DEFINED TBB_USE_DEBUG_BUILD) + if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)") + set(TBB_BUILD_TYPE DEBUG) + else() + set(TBB_BUILD_TYPE RELEASE) + endif() + elseif(TBB_USE_DEBUG_BUILD) + set(TBB_BUILD_TYPE DEBUG) + else() + set(TBB_BUILD_TYPE RELEASE) + endif() + + ################################## + # Set the TBB search directories + ################################## + + # Define search paths based on user input and environment variables + set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT}) + + # Define the search directories based on the current platform + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB" + "C:/Program Files (x86)/Intel/TBB") + + # Set the target architecture + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(TBB_ARCHITECTURE "intel64") + else() + set(TBB_ARCHITECTURE "ia32") + endif() + + # Set the TBB search library path search suffix based on the version of VC + if(WINDOWS_STORE) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui") + elseif(MSVC14) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14") + elseif(MSVC12) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12") + elseif(MSVC11) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11") + elseif(MSVC10) + set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10") + endif() + + # Add the library path search suffix for the VC independent version of TBB + list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt") + + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # OS X + set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") + + # TODO: Check to see which C++ library is being used by the compiler. + if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0) + # The default C++ library on OS X 10.9 and later is libc++ + set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib") + else() + set(TBB_LIB_PATH_SUFFIX "lib") + endif() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Linux + set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") + + # TODO: Check compiler version to see the suffix should be /gcc4.1 or + # /gcc4.1. For now, assume that the compiler is more recent than + # gcc 4.4.x or later. + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4") + endif() + endif() + + ################################## + # Find the TBB include dir + ################################## + + find_path(TBB_INCLUDE_DIRS tbb/tbb.h + HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR} + PATHS ${TBB_DEFAULT_SEARCH_DIR} + PATH_SUFFIXES include) + + ################################## + # Set version strings + ################################## + + if(TBB_INCLUDE_DIRS) + file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) + string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" + TBB_VERSION_MAJOR "${_tbb_version_file}") + string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" + TBB_VERSION_MINOR "${_tbb_version_file}") + string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" + TBB_INTERFACE_VERSION "${_tbb_version_file}") + set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") + endif() + + ################################## + # Find TBB components + ################################## + + if(TBB_VERSION VERSION_LESS 4.3) + set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb) + else() + set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb) + endif() + + # Find each component + foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) + if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") + + # Search for the libraries + find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp} + HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} + PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) + + find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug + HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} + PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH + PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) + + if(TBB_${_comp}_LIBRARY_DEBUG) + list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}") + endif() + if(TBB_${_comp}_LIBRARY_RELEASE) + list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}") + endif() + if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY) + set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}") + endif() + + if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}") + set(TBB_${_comp}_FOUND TRUE) + else() + set(TBB_${_comp}_FOUND FALSE) + endif() + + # Mark internal variables as advanced + mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE) + mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG) + mark_as_advanced(TBB_${_comp}_LIBRARY) + + endif() + endforeach() + + ################################## + # Set compile flags and libraries + ################################## + + set(TBB_DEFINITIONS_RELEASE "") + set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1") + + if(TBB_LIBRARIES_${TBB_BUILD_TYPE}) + set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}") + set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}") + elseif(TBB_LIBRARIES_RELEASE) + set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}") + set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}") + elseif(TBB_LIBRARIES_DEBUG) + set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}") + set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}") + endif() + + find_package_handle_standard_args(TBB + REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES + HANDLE_COMPONENTS + VERSION_VAR TBB_VERSION) + + ################################## + # Create targets + ################################## + + if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND) + add_library(tbb SHARED IMPORTED) + set_target_properties(tbb PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS} + IMPORTED_LOCATION ${TBB_LIBRARIES}) + if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG) + set_target_properties(tbb PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "$<$,$>:TBB_USE_DEBUG=1>" + IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG} + IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG} + IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE} + IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE} + ) + elseif(TBB_LIBRARIES_RELEASE) + set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE}) + else() + set_target_properties(tbb PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}" + IMPORTED_LOCATION ${TBB_LIBRARIES_DEBUG} + ) + endif() + endif() + + mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) + + unset(TBB_ARCHITECTURE) + unset(TBB_BUILD_TYPE) + unset(TBB_LIB_PATH_SUFFIX) + unset(TBB_DEFAULT_SEARCH_DIR) + +endif() diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 88e814d..e46418b 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,6 +39,8 @@ foreach( _uplo LOWER UPPER ) else() + message( STATUS ${_compile_output} ) + append_possibly_missing_libs( BLAS _compile_output ${_libs} _new_libs ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) From cef2e40d69e16dac305a80c7dd819a8ce8e23266 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:01:59 +0000 Subject: [PATCH 091/122] [CI] Enable TBB MKL paths in CI --- .github/workflows/cmake.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e047cc8..8ba951e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,7 +11,7 @@ jobs: linalg_lib: [blis,openblas,netlib,intel-mkl] mpi_dist: [mpich,openmpi] int_interface: [lp64,ilp64] - thread: [sequential,openmp,pthreads] + thread: [sequential,openmp,pthreads,tbb] exclude: - linalg_lib: netlib int_interface: ilp64 @@ -27,6 +27,12 @@ jobs: mpi_dist: openmpi - linalg_lib: openblas mpi_dist: openmpi + - linald_lib: blis + thread: tbb + - linald_lib: openblas + thread: tbb + - linald_lib: netlib + thread: tbb env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/${{matrix.linalg_lib}}-${{matrix.int_interface}}-${{matrix.thread}};/home/software/install/netlib-lp64-sequential' From ad2bd8251977a909a1e399036432b90625f12fbd Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:02:39 +0000 Subject: [PATCH 092/122] [CI] Typo --- .github/workflows/cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8ba951e..d77707d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -27,11 +27,11 @@ jobs: mpi_dist: openmpi - linalg_lib: openblas mpi_dist: openmpi - - linald_lib: blis + - linalg_lib: blis thread: tbb - - linald_lib: openblas + - linalg_lib: openblas thread: tbb - - linald_lib: netlib + - linalg_lib: netlib thread: tbb env: MKLROOT: /opt/intel/mkl From 382f21da0f444aa4599856d51b7eef4cfafe5e81 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:07:33 +0000 Subject: [PATCH 093/122] [CI] Add TBB to build system in CI --- .github/workflows/cmake.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d77707d..f15581f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -53,6 +53,11 @@ jobs: sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} which mpicc + - name: Setup TBB + if: ${{matrix.thread == 'tbb'}} + run: | + sudo apt-get install libtbb-dev + - name: Build Linalg env: From ad68440e3b3954c1f168c7767789fc281b05a4b7 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:08:43 +0000 Subject: [PATCH 094/122] [CI] Typo --- .github/workflows/cmake.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index f15581f..00aa887 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -53,10 +53,10 @@ jobs: sudo make -C .github/workflows/linalg install/${{matrix.mpi_dist}} which mpicc - - name: Setup TBB - if: ${{matrix.thread == 'tbb'}} - run: | - sudo apt-get install libtbb-dev + - name: Setup TBB + if: ${{matrix.thread == 'tbb'}} + run: | + sudo apt-get install libtbb-dev - name: Build Linalg From 41ec9f2927ed46082993e093db676a570d363f35 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 20:15:22 +0000 Subject: [PATCH 095/122] [MACROS] Add TBB as a registered dependency --- LinAlgModulesMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index 7cb867e..a747e1d 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -6,6 +6,8 @@ macro( find_linalg_dependencies _libs ) find_dependency(OpenMP) elseif (${_lib} MATCHES "Threads") find_dependency(Threads) + elseif (${_lib} MATCHES "tbb") + find_dependency(TBB) endif() endforeach() endmacro() @@ -24,6 +26,7 @@ set( LINALG_FIND_MODULES FindReferenceScaLAPACK.cmake FindScaLAPACK.cmake FindILP64.cmake + FindTBB.cmake FindStandardFortran.cmake LinAlgModulesMacros.cmake ) From 8962f080a80b584cad78cbb9f6970e24ed8222c9 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 21:41:22 +0000 Subject: [PATCH 096/122] [MISC] Cleanup debug print + add inclusion of dependency macro in LinAlgModules --- LinAlgModulesMacros.cmake | 1 + util/BLASUtilities.cmake | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index a747e1d..77bdb14 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -1,6 +1,7 @@ set( LINALG_MACROS_DIR ${CMAKE_CURRENT_LIST_DIR} ) macro( find_linalg_dependencies _libs ) + include( CMakeFindDependencyMacro ) foreach( _lib ${${_libs}} ) if (${_lib} MATCHES "OpenMP") find_dependency(OpenMP) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index e46418b..88e814d 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -39,8 +39,6 @@ foreach( _uplo LOWER UPPER ) else() - message( STATUS ${_compile_output} ) - append_possibly_missing_libs( BLAS _compile_output ${_libs} _new_libs ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) From 90ee9c0b1f756e5e93c7e184c1403b23f65363b1 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 13:59:11 -0800 Subject: [PATCH 097/122] [BLAS] Added FindAccelerate and modified FindBLAS to look for it on Darwin systems --- FindAccelerate.cmake | 13 +++++++++++++ FindBLAS.cmake | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 FindAccelerate.cmake diff --git a/FindAccelerate.cmake b/FindAccelerate.cmake new file mode 100644 index 0000000..945e2f3 --- /dev/null +++ b/FindAccelerate.cmake @@ -0,0 +1,13 @@ +include( CheckCCompilerFlag ) +check_c_compiler_flag( "-framework Accelerate" COMPILER_RECOGNIZES_ACCELERATE ) +if( COMPILER_RECOGNIZES_ACCELERATE ) + set( Accelerate_LIBRARIES "-framework Accelerate" CACHE STRING "Accelerate Libraries" FORCE) + set( Accelerate_lp64_FOUND TRUE ) + set( Accelerate_ilp64_FOUND FALSE ) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( Accelerate + REQUIRED_VARS Accelerate_LIBRARIES + HANDLE_COMPONENTS +) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 1e4291b..44c69ca 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -29,6 +29,9 @@ fill_out_prefix( BLAS ) if( NOT BLAS_PREFERENCE_LIST ) set( BLAS_PREFERENCE_LIST "IntelMKL" "IBMESSL" "BLIS" "OpenBLAS" "ReferenceBLAS" ) + if( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + list( PREPEND BLAS_PREFERENCE_LIST "Accelerate" ) + endif() endif() if( NOT BLAS_LIBRARIES ) From 3999cc979d466c912e238a3983795df700373b7b Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 8 Feb 2021 23:03:12 +0000 Subject: [PATCH 098/122] [MKL] Added missing MKL_ILP64 compiler definition for MKL ILP64 --- FindIntelMKL.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 28bb58c..ce98212 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -304,6 +304,7 @@ find_library( IntelMKL_LP64_ScaLAPACK_LIBRARY # Default to LP64 if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS ) + set( IntelMKL_COMPILE_DEFINITIONS "MKL_ILP64" ) set( IntelMKL_LIBRARY ${IntelMKL_ILP64_LIBRARY} ) if( IntelMKL_ILP64_BLACS_LIBRARY ) From fdfec2e469e0fda730d8636612600f9a90f52b2c Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 9 Feb 2021 18:53:56 -0800 Subject: [PATCH 099/122] Cache LAPACK_IS_LP64 --- FindLAPACK.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index e1ed64d..ea81243 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -165,6 +165,7 @@ find_package_handle_standard_args( LAPACK # Cache variables if( LAPACK_FOUND ) set( LAPACK_VENDOR "${LAPACK_VENDOR}" CACHE STRING "LAPACK Vendor" FORCE ) + set( LAPACK_IS_LP64 "${LAPACK_IS_LP64}" CACHE STRING "LAPACK LP64" FORCE ) set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) set( LAPACK_COMPILE_DEFINITIONS "${LAPACK_COMPILE_DEFINITIONS}" CACHE STRING "LAPACK Compile Definitions" FORCE ) set( LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}" CACHE STRING "LAPACK Include Directories" FORCE ) From 63ccdca62711741dc3ad304feb2a19b63dab7144 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 9 Feb 2021 19:13:27 -0800 Subject: [PATCH 100/122] Cache LP64 flags --- FindBLAS.cmake | 1 + FindLAPACK.cmake | 2 +- FindScaLAPACK.cmake | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 44c69ca..c636ed2 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -117,6 +117,7 @@ find_package_handle_standard_args( BLAS # Cache variables if( BLAS_FOUND ) set( BLAS_VENDOR "${BLAS_VENDOR}" CACHE STRING "BLAS Vendor" FORCE ) + set( BLAS_IS_LP64 "${BLAS_IS_LP64}" CACHE STRING "BLAS LP64 Flag" FORCE ) set( BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE STRING "BLAS Libraries" FORCE ) set( BLAS_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" CACHE STRING "BLAS Compile Definitions" FORCE ) set( BLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}" CACHE STRING "BLAS Include Directories" FORCE ) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index ea81243..9c1cab6 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -165,7 +165,7 @@ find_package_handle_standard_args( LAPACK # Cache variables if( LAPACK_FOUND ) set( LAPACK_VENDOR "${LAPACK_VENDOR}" CACHE STRING "LAPACK Vendor" FORCE ) - set( LAPACK_IS_LP64 "${LAPACK_IS_LP64}" CACHE STRING "LAPACK LP64" FORCE ) + set( LAPACK_IS_LP64 "${LAPACK_IS_LP64}" CACHE STRING "LAPACK LP64 Flag" FORCE ) set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}" CACHE STRING "LAPACK Libraries" FORCE ) set( LAPACK_COMPILE_DEFINITIONS "${LAPACK_COMPILE_DEFINITIONS}" CACHE STRING "LAPACK Compile Definitions" FORCE ) set( LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}" CACHE STRING "LAPACK Include Directories" FORCE ) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 37754d4..53e6a16 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -185,6 +185,7 @@ find_package_handle_standard_args( ScaLAPACK ) # Cache variables +set( ScaLAPACK_IS_LP64 "${ScaLAPACK_IS_LP64}" CACHE STRING "ScaLAPACK LP64 Flag" FORCE ) set( ScaLAPACK_LIBRARIES "${ScaLAPACK_LIBRARIES}" CACHE STRING "ScaLAPACK Libraries" FORCE ) if( ScaLAPACK_FOUND AND NOT TARGET ScaLAPACK::ScaLAPACK ) From 9cd2f8f7ac71ecefaf6b449ee17e84fdbee8fcd6 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 9 Feb 2021 21:34:24 -0800 Subject: [PATCH 101/122] add MPI to find_linalg_dependencies --- LinAlgModulesMacros.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index 77bdb14..a30bd0c 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -9,6 +9,8 @@ macro( find_linalg_dependencies _libs ) find_dependency(Threads) elseif (${_lib} MATCHES "tbb") find_dependency(TBB) + elseif (${_lib} MATCHES "MPI") + find_dependency(MPI) endif() endforeach() endmacro() From 10e32e46b5d453a704f6b814364f99a5b56e6b3c Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Mar 2021 23:07:58 +0000 Subject: [PATCH 102/122] [BLAS] Change BLAS LP64 check to analyze output rather than return code to solve problems with F* STOP return code --- util/BLASUtilities.cmake | 7 ++++++- util/ilp64_checker.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 88e814d..06ba53f 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -94,7 +94,12 @@ try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} RUN_OUTPUT_VARIABLE _run_output ) -if( ${_run_result} EQUAL 0 ) +#if( ${_run_result} EQUAL 0 ) +# set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) +#else() +# set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) +#endif() +if( _run_output MATCHES "BLAS IS LP64" ) set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) diff --git a/util/ilp64_checker.c b/util/ilp64_checker.c index 253deb4..58c5925 100644 --- a/util/ilp64_checker.c +++ b/util/ilp64_checker.c @@ -35,10 +35,15 @@ int main() { double sum = 0.; int i; for( i = 0; i < 4; ++i ) sum += C[i]; - //printf("BLAS LP64 CHECK = %.1f\n", sum); + +#if 0 if( ((int)sum) == 8 ) return 0; else return 1; +#else + if( ((int)sum) == 8 ) printf("XXXX BLAS IS LP64 XXXX\n" ); + else printf("XXXX BLAS IS ILP64 XXXX\n"); +#endif return 0; }; From 9fd08265385e310c2b808d42f67be70a46629194 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Mar 2021 23:15:34 +0000 Subject: [PATCH 103/122] [LAPACK] Change LAPACK LP64 check to analyze output rather than return code to solve problems with F* STOP return code --- util/BLASUtilities.cmake | 5 ----- util/LAPACKUtilities.cmake | 4 +--- util/lapack_ilp64_checker.c | 5 +++++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 06ba53f..29b7613 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -94,11 +94,6 @@ try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} RUN_OUTPUT_VARIABLE _run_output ) -#if( ${_run_result} EQUAL 0 ) -# set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) -#else() -# set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) -#endif() if( _run_output MATCHES "BLAS IS LP64" ) set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index f6c741c..9fddcce 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -91,9 +91,7 @@ try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} RUN_OUTPUT_VARIABLE _run_output ) -#message( STATUS ${_run_result} ) - -if( ${_run_result} EQUAL 0 ) +if( _run_output MATCHES "LAPACK IS LP64" ) set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) diff --git a/util/lapack_ilp64_checker.c b/util/lapack_ilp64_checker.c index 2ea9187..7593bee 100644 --- a/util/lapack_ilp64_checker.c +++ b/util/lapack_ilp64_checker.c @@ -29,7 +29,12 @@ int main() { // Valid for MKL, OpenBLAS, NETLIB (Reference) LAPACK, and ESSL DSYEV_NAME( "N","L", fake_two_ptr, A, true_two_ptr, W, &WORK, LWORK, INFO ); +#if 0 if( INFO[0] == 0 ) return 0; else return -1; +#else + if( INFO[0] == 0 ) printf("XXXX LAPACK IS LP64 XXXX\n" ); + else printf("XXXX LAPACK IS ILP64 XXXX\n"); +#endif }; From 47ebfbbfce0e09da19feda0377dc5954f4449c23 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 5 Mar 2021 23:26:37 +0000 Subject: [PATCH 104/122] [BLAS] Add CMakeFindDependencyMacro to FindBLAS for ILP64 check --- FindBLAS.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index c636ed2..03473f5 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -4,6 +4,7 @@ include( CMakePushCheckState ) include( CheckLibraryExists ) include( CheckSymbolExists ) include( FindPackageHandleStandardArgs ) +include( CMakeFindDependencyMacro ) include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) From 1ae1e0a4b075973b470d6c8660b139a8357abbf5 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Thu, 11 Mar 2021 19:06:48 +0000 Subject: [PATCH 105/122] Add support of AOCL (AMD-BLIS/FLAME) --- FindBLIS.cmake | 4 ++-- FindFLAME.cmake | 47 ++++++++++++++++++++++++++++++++++++++ FindLAPACK.cmake | 2 +- util/CommonFunctions.cmake | 6 ++--- util/blis_int_size.c | 4 ++-- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 FindFLAME.cmake diff --git a/FindBLIS.cmake b/FindBLIS.cmake index ae2e03f..e534591 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -4,9 +4,9 @@ if( "ilp64" IN_LIST BLIS_FIND_COMPONENTS AND "lp64" IN_LIST BLIS_FIND_COMPONENTS endif() if( BLIS_PREFERS_STATIC ) - set( BLIS_LIBRARY_NAME "libblis.a" ) + set( BLIS_LIBRARY_NAME "libblis.a" "libblis-mt.a" ) else() - set( BLIS_LIBRARY_NAME "blis" ) + set( BLIS_LIBRARY_NAME "blis" "blis-mt") endif() find_library( BLIS_LIBRARIES diff --git a/FindFLAME.cmake b/FindFLAME.cmake new file mode 100644 index 0000000..b7c0540 --- /dev/null +++ b/FindFLAME.cmake @@ -0,0 +1,47 @@ +# SANITY CHECK +if( "ilp64" IN_LIST FLAME_FIND_COMPONENTS AND "lp64" IN_LIST FLAME_FIND_COMPONENTS ) + message( FATAL_ERROR "FLAME cannot link to both ILP64 and LP64 iterfaces" ) +endif() + +if( FLAME_PREFERS_STATIC ) + set( FLAME_LIBRARY_NAME "libflame.a" ) +else() + set( FLAME_LIBRARY_NAME "flame" ) +endif() + +find_library( FLAME_LIBRARIES + NAMES ${FLAME_LIBRARY_NAME} + HINTS ${FLAME_PREFIX} + PATHS ${FLAME_LIBRARY_DIR} ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES} + PATH_SUFFIXES lib lib64 lib32 + DOC "FLAME Library" +) + +find_path( FLAME_INCLUDE_DIR + NAMES FLAME.h + HINTS ${FLAME_PREFIX} + PATHS ${FLAME_INCLUDE_DIR} + PATH_SUFFIXES include + DOC "FLAME header" +) + +#XXX Seems that FLAME is only LP64 +set( FLAME_lp64_FOUND TRUE ) +set( FLAME_ilp64_FOUND FALSE ) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( FLAME + REQUIRED_VARS FLAME_LIBRARIES FLAME_INCLUDE_DIR + HANDLE_COMPONENTS +) + +#if( FLAME_FOUND AND NOT TARGET FLAME::FLAME ) +# +# add_library( FLAME::FLAME INTERFACE IMPORTED ) +# set_target_properties( FLAME::FLAME PROPERTIES +# INTERFACE_INCLUDE_DIRECTORIES "${FLAME_INCLUDE_DIR}" +# INTERFACE_LINK_LIBRARIES "${FLAME_LIBRARIES}" +# ) +# +#endif() diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 9c1cab6..7e88c1a 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -29,7 +29,7 @@ endforeach() fill_out_prefix( LAPACK ) if( NOT LAPACK_PREFERENCE_LIST ) - set( LAPACK_PREFERENCE_LIST "ReferenceLAPACK" ) + set( LAPACK_PREFERENCE_LIST "ReferenceLAPACK" "FLAME" ) endif() if( NOT LAPACK_LIBRARIES ) diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 156edfa..7339a41 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -61,9 +61,9 @@ endfunction() function( copy_meta_data _src _dest ) - if( ${_src}_LIBRARIES AND NOT ${_dest}_LIBRARIES ) - set( ${_dest}_LIBRARIES ${${_src}_LIBRARIES} PARENT_SCOPE ) - endif() + #if( ${_src}_LIBRARIES AND NOT ${_dest}_LIBRARIES ) + # set( ${_dest}_LIBRARIES ${${_src}_LIBRARIES} PARENT_SCOPE ) + #endif() if( ${_src}_PREFIX AND NOT ${_dest}_PREFIX ) set( ${_dest}_PREFIX ${${_src}_PREFIX} PARENT_SCOPE ) diff --git a/util/blis_int_size.c b/util/blis_int_size.c index 9b1a368..6e9a6bd 100644 --- a/util/blis_int_size.c +++ b/util/blis_int_size.c @@ -30,7 +30,7 @@ void bli_thread_range_sub thrinfo_t* thread, dim_t n, dim_t bf, - bool handle_edge_low, + bool_t handle_edge_low, dim_t* start, dim_t* end ){ } @@ -67,7 +67,7 @@ void bli_obj_scalar_detach obj_t* a, obj_t* alpha ){ } -bool bli_obj_imag_is_zero( obj_t* a ){ } +bool_t bli_obj_imag_is_zero( obj_t* a ){ } double round( double x) {} int main() { From 00b0cdd82663346ae5e400ab921e43468f307678 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Tue, 16 Mar 2021 17:03:49 +0000 Subject: [PATCH 106/122] [BLIS] Fix FindBLIS for AOCL --- FindBLIS.cmake | 3 ++- util/blis_int_size.c | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index e534591..b2ae145 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -39,10 +39,11 @@ if( BLIS_INCLUDE_DIR ) ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_LIST_DIR}/util/blis_int_size.c CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${BLIS_INCLUDE_DIR} + LINK_LIBRARIES ${BLIS_LIBRARIES} COMPILE_OUTPUT_VARIABLE _blis_idx_compile_output RUN_OUTPUT_VARIABLE _blis_idx_run_output ) - + #message( STATUS "${_blis_idx_compile_output}" ) if( ${BLIS_USES_LP64} EQUAL 0 ) set( BLIS_USES_LP64 TRUE ) else() diff --git a/util/blis_int_size.c b/util/blis_int_size.c index 6e9a6bd..96d5733 100644 --- a/util/blis_int_size.c +++ b/util/blis_int_size.c @@ -1,3 +1,4 @@ +#if 0 //#define BLIS_PARAM_MACRO_DEFS_H //#define BLIS_OBJ_MACRO_DEFS_H //#define BLIS_MISC_MACRO_DEFS_H @@ -75,3 +76,11 @@ int main() { if( blis_int_size == 32 ) return 0; else return 1; } +#else +#include +int main() { + int blis_int_size = BLIS_BLAS_INT_TYPE_SIZE; + if( blis_int_size == 32 ) return 0; + else return 1; +} +#endif From aad580e5e86cff78a2b9c232f6131890bd9eb88f Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Tue, 16 Mar 2021 17:22:02 +0000 Subject: [PATCH 107/122] [BLIS] Fix static BLIS discovery --- FindBLIS.cmake | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index b2ae145..92756d2 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -35,7 +35,7 @@ endif() if( BLIS_INCLUDE_DIR ) try_run( BLIS_USES_LP64 - _blis_idx_test_compile_result + BLIS_TEST_COMPILES ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_LIST_DIR}/util/blis_int_size.c CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${BLIS_INCLUDE_DIR} @@ -43,7 +43,29 @@ if( BLIS_INCLUDE_DIR ) COMPILE_OUTPUT_VARIABLE _blis_idx_compile_output RUN_OUTPUT_VARIABLE _blis_idx_run_output ) - #message( STATUS "${_blis_idx_compile_output}" ) + + if( NOT BLIS_TEST_COMPILES ) + if( ${_blis_idx_compile_output} MATCHES "pthread_" ) + find_dependency( Threads ) + list( APPEND BLIS_LIBRARIES Threads::Threads ) + endif() + if( ${_blis_idx_compile_output} MATCHES "omp_" ) + find_dependency( OpenMP ) + list( APPEND BLIS_LIBRARIES OpenMP::OpenMP_C ) + endif() + endif() + + try_run( BLIS_USES_LP64 + BLIS_TEST_COMPILES + ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_LIST_DIR}/util/blis_int_size.c + CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${BLIS_INCLUDE_DIR} + LINK_LIBRARIES ${BLIS_LIBRARIES} + COMPILE_OUTPUT_VARIABLE _blis_idx_compile_output + RUN_OUTPUT_VARIABLE _blis_idx_run_output + ) + + if( ${BLIS_USES_LP64} EQUAL 0 ) set( BLIS_USES_LP64 TRUE ) else() From 206ae02ea5e9e53065f76231fd2a758079433dba Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Tue, 16 Mar 2021 13:13:23 -0700 Subject: [PATCH 108/122] Additional check for missing Fortran symbols --- util/CommonFunctions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 7339a41..d56305f 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -147,7 +147,7 @@ function( append_possibly_missing_libs _linker_test __compile_output _orig_libs set( _tmp_libs ) # Check for missing Fortran symbols - if( ${__compile_output} MATCHES "fortran" ) + if( ${__compile_output} MATCHES "fortran" OR ${__compile_output} MATCHES "f90_" ) message( STATUS " * Missing Standard Fortran Libs - Adding to ${_linker_test} linker" ) # Check for Standard Fortran Libraries From f6629057033a9dd31416b259f83233340106fa78 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Sat, 27 Mar 2021 00:53:06 -0400 Subject: [PATCH 109/122] check compile output for sqrt when detecting missing libs --- util/CommonFunctions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index d56305f..4cefdf6 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -177,7 +177,7 @@ function( append_possibly_missing_libs _linker_test __compile_output _orig_libs list( APPEND _tmp_libs Threads::Threads ) endif() - if( ${__compile_output} MATCHES "logf" ) + if( ${__compile_output} MATCHES "logf" OR ${__compile_output} MATCHES "sqrt" ) message( STATUS " * Missing LIBM - Adding to ${_linker_test} linker" ) list( APPEND _tmp_libs "m" ) From 4f7bc30697f0351012356ddc2505924940482f98 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 19 May 2021 21:53:03 +0000 Subject: [PATCH 110/122] Add functions to emulate Kitware variables BLA_STATIC and BLA_VENDOR --- .github/workflows/cmake.yml | 35 +++++++++++++++++++++++++++++++++++ FindBLAS.cmake | 1 + FindLAPACK.cmake | 1 + FindScaLAPACK.cmake | 1 + util/CommonFunctions.cmake | 22 ++++++++++++++++++++++ 5 files changed, 60 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 00aa887..1d193bb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -191,3 +191,38 @@ jobs: .github/workflows/scripts/check_scalapack_cmake_cache.sh \ ${{runner.workspace}}/build-findscalapack-${{matrix.int_interface}} \ ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} + + check-kitware-compatability: + runs-on: ubuntu-latest + env: + MKLROOT: /opt/intel/mkl + CMAKE_PREFIX_PATH: '/home/software/install/blis-lp64-sequential;/home/software/install/netlib-lp64-sequential' + steps: + - uses: actions/checkout@v2 + + - name: Ubuntu Setup + run: | + sudo apt-get -yq update && sudo apt-get install make wget curl libomp5 + sudo make -C .github/workflows/linalg install/main + sudo make -C .github/workflows/linalg install/cmake + sudo apt-get clean + sudo make -C .github/workflows/linalg apt-add-repository/intel-mkl + + - name: Build Linalg + run: | + sudo make -C .github/workflows/linalg download/intel-mkl + sudo make -C .github/workflows/linalg install/intel-mkl + sudo make -C .github/workflows/linalg download/blis-lp64-sequential + sudo make -C .github/workflows/linalg install/blis-lp64-sequential + + - name: Check BLA_STATIC + run: | + cmake -H${GITHUB_WORKSPACE}/examples/blas/lp64 \ + -B${{runner.workspace}}/check-bla-static \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DBLAS_THREAD_LAYER=sequential \ + -DBLA_STATIC=ON + .github/workflows/scripts/check_blas_cmake_cache.sh \ + ${{runner.workspace}}/check-bla-static \ + intel-mkl sequential lp64 diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 03473f5..b5a3531 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -26,6 +26,7 @@ foreach( _comp ${BLAS_FIND_COMPONENTS} ) endif() endforeach() +emulate_kitware_linalg_modules( BLAS ) fill_out_prefix( BLAS ) if( NOT BLAS_PREFERENCE_LIST ) diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 7e88c1a..71024ac 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -26,6 +26,7 @@ foreach( _comp ${LAPACK_FIND_COMPONENTS} ) endif() endforeach() +emulate_kitware_linalg_modules( LAPACK ) fill_out_prefix( LAPACK ) if( NOT LAPACK_PREFERENCE_LIST ) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 53e6a16..3f4c308 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -53,6 +53,7 @@ foreach( _comp ${ScaLAPACK_FIND_COMPONENTS} ) endif() endforeach() +emulate_kitware_linalg_modules( ScaLAPACK ) fill_out_prefix( ScaLAPACK ) if( NOT ScaLAPACK_PREFERENCE_LIST ) diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 4cefdf6..89e548a 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -44,6 +44,28 @@ set( COMMON_UTILITY_CMAKE_FILE_DIR ${CMAKE_CURRENT_LIST_DIR} ) +function( emulate_kitware_linalg_modules name ) + + if( DEFINED BLA_STATIC AND NOT DEFINED ${name}_PREFERS_STATIC ) + if( DEFINED CACHE{BLA_STATIC} ) + set( ${name}_PREFERS_STATIC ${BLA_STATIC} CACHE BOOL + "Use Static ${name} LIBRARIES" ) + else() + set( ${name}_PREFERS_STATIC ${BLA_STATIC} PARENT_SCOPE ) + endif() + endif() + + if( DEFINED BLA_VENDOR AND NOT DEFINED ${name}_PREFERENCE_LIST ) + if( DEFINED CACHE{BLA_VENDOR} ) + set( ${name}_PREFERENCE_LIST ${BLA_VENDOR} CACHE BOOL + "Use Static ${name} LIBRARIES" ) + else() + set( ${name}_PREFERENCE_LIST ${BLA_VENDOR} PARENT_SCOPE ) + endif() + endif() + +endfunction() + function( fill_out_prefix name ) #if( ${name}_PREFIX AND NOT ${name}_INCLUDE_DIR ) From 7702652f9f880f250a0ec097102614d837e6ba57 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 19 May 2021 21:56:48 +0000 Subject: [PATCH 111/122] Pin CI to Ubuntu-18.04 --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1d193bb..b166b6a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -5,7 +5,7 @@ on: [pull_request] jobs: linux-check-all-libs: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: linalg_lib: [blis,openblas,netlib,intel-mkl] @@ -193,7 +193,7 @@ jobs: ${{matrix.linalg_lib}} ${{matrix.thread}} ${{matrix.int_interface}} ${{matrix.mpi_dist}} check-kitware-compatability: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 env: MKLROOT: /opt/intel/mkl CMAKE_PREFIX_PATH: '/home/software/install/blis-lp64-sequential;/home/software/install/netlib-lp64-sequential' From 574f71ff188e771b068615ab097ebbd185711085 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 19 May 2021 22:01:19 +0000 Subject: [PATCH 112/122] Typo in CI --- .github/workflows/cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b166b6a..e2cd90e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -212,8 +212,8 @@ jobs: run: | sudo make -C .github/workflows/linalg download/intel-mkl sudo make -C .github/workflows/linalg install/intel-mkl - sudo make -C .github/workflows/linalg download/blis-lp64-sequential - sudo make -C .github/workflows/linalg install/blis-lp64-sequential + sudo make -C .github/workflows/linalg download/blis/lp64-sequential + sudo make -C .github/workflows/linalg install/blis/lp64-sequential - name: Check BLA_STATIC run: | From 4d26aca5587ab3aa8e09bf9cc5ca3356abb7d269 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 19 May 2021 22:04:33 +0000 Subject: [PATCH 113/122] More typos in CI --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e2cd90e..8cc824d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -212,7 +212,7 @@ jobs: run: | sudo make -C .github/workflows/linalg download/intel-mkl sudo make -C .github/workflows/linalg install/intel-mkl - sudo make -C .github/workflows/linalg download/blis/lp64-sequential + sudo make -C .github/workflows/linalg download/blis sudo make -C .github/workflows/linalg install/blis/lp64-sequential - name: Check BLA_STATIC From 510b9282faa795925f942e8d7d0060b2d8ea9668 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 19 May 2021 22:18:02 +0000 Subject: [PATCH 114/122] Add BLA_VENDOR CI test --- .github/workflows/cmake.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8cc824d..108f8b6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -226,3 +226,15 @@ jobs: .github/workflows/scripts/check_blas_cmake_cache.sh \ ${{runner.workspace}}/check-bla-static \ intel-mkl sequential lp64 + + - name: Check BLA_VENDOR + run: | + cmake -H${GITHUB_WORKSPACE}/examples/blas/lp64 \ + -B${{runner.workspace}}/check-bla-vendor \ + -DCMAKE_MODULE_PATH=${GITHUB_WORKSPACE} \ + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} \ + -DBLAS_THREAD_LAYER=sequential \ + -DBLA_VENDOR="BLIS" + .github/workflows/scripts/check_blas_cmake_cache.sh \ + ${{runner.workspace}}/check-bla-vendor \ + blis sequential lp64 From 580bf8bbd90a4c031c7508ef7fb148239a3789d3 Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Fri, 28 May 2021 11:16:39 -0700 Subject: [PATCH 115/122] Include missing standard macros in FindScaLAPACK --- FindScaLAPACK.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 3f4c308..12030e3 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -31,6 +31,10 @@ cmake_minimum_required( VERSION 3.17 ) # Require CMake 3.17+ +include( CMakePushCheckState ) +include( CheckLibraryExists ) +include( CheckSymbolExists ) +include( FindPackageHandleStandardArgs ) include( CMakeFindDependencyMacro ) include( ${CMAKE_CURRENT_LIST_DIR}/util/CommonFunctions.cmake ) From 0c2effde6fa0c87eaeb961eeb412d8cca27bf4cb Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Mon, 28 Jun 2021 14:57:47 -0700 Subject: [PATCH 116/122] Added IntelMKL TARGETs --- FindIntelMKL.cmake | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index ce98212..afc6359 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -471,22 +471,30 @@ find_package_handle_standard_args( IntelMKL HANDLE_COMPONENTS ) -#if( IntelMKL_FOUND AND NOT TARGET IntelMKL::mkl ) -# -# add_library( IntelMKL::mkl INTERFACE IMPORTED ) -# set_target_properties( IntelMKL::mkl PROPERTIES -# INTERFACE_INCLUDE_DIRECTORIES "${IntelMKL_INCLUDE_DIR}" -# INTERFACE_LINK_LIBRARIES "${IntelMKL_LIBRARIES}" -# INTERFACE_COMPILE_OPTIONS "${IntelMKL_C_COMPILE_FLAGS}" -# INTERFACE_COMPILE_DEFINITIONS "${IntelMKL_COMPILE_DEFINITIONS}" -# ) -# -# if( "scalapack" IN_LIST IntelMKL_FIND_COMPONENTS AND NOT scalapack_LIBRARIES ) -# set( scalapack_LIBRARIES IntelMKL::mkl ) -# endif() -# -# if( "blacs" IN_LIST IntelMKL_FIND_COMPONENTS AND NOT blacs_LIBRARIES ) -# set( blacs_LIBRARIES IntelMKL::mkl ) -# endif() -# -#endif() +if( IntelMKL_FOUND ) + + if( IntelMKL_BLAS_LAPACK_LIBRARIES AND NOT TARGET IntelMKL::IntelMKL ) + add_library( IntelMKL::IntelMKL INTERFACE IMPORTED ) + set_target_properties( IntelMKL::IntelMKL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IntelMKL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${IntelMKL_BLAS_LAPACK_LIBRARIES}" + ) + endif() + + if( IntelMKL_BLACS_LIBRARIES AND NOT TARGET IntelMKL::BLACS ) + add_library( IntelMKL::BLACS INTERFACE IMPORTED ) + set_target_properties( IntelMKL::BLACS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IntelMKL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${IntelMKL_BLACS_LIBRARIES}" + ) + endif() + + if( IntelMKL_ScaLAPACK_LIBRARIES AND NOT TARGET IntelMKL::ScaLAPACK ) + add_library( IntelMKL::ScaLAPACK INTERFACE IMPORTED ) + set_target_properties( IntelMKL::ScaLAPACK PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IntelMKL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${IntelMKL_ScaLAPACK_LIBRARIES}" + ) + endif() + +endif() From 2c542c1c12a6542eb7b9c8708806b7c29627e278 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 23 Dec 2021 13:40:48 -0500 Subject: [PATCH 117/122] Import Threads as global target (#1) --- FindBLIS.cmake | 7 ++++++- FindIntelMKL.cmake | 3 +++ LinAlgModulesMacros.cmake | 7 ++++++- util/CommonFunctions.cmake | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index 92756d2..41b4df0 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -46,7 +46,12 @@ if( BLIS_INCLUDE_DIR ) if( NOT BLIS_TEST_COMPILES ) if( ${_blis_idx_compile_output} MATCHES "pthread_" ) - find_dependency( Threads ) + if (NOT TARGET Threads::Threads) + find_dependency(Threads) + # Threads::Threads by default is not GLOBAL, so to allow users of LINALG_LIBRARIES to safely use it we need to make it global + # more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256 + set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE) + endif(NOT TARGET Threads::Threads) list( APPEND BLIS_LIBRARIES Threads::Threads ) endif() if( ${_blis_idx_compile_output} MATCHES "omp_" ) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index afc6359..9852463 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -439,6 +439,9 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) if( NOT TARGET Threads::Threads ) find_dependency( Threads ) + # Threads::Threads by default is not GLOBAL, so to allow users of LINALG_LIBRARIES to safely use it we need to make it global + # more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256 + set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE) endif() list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES "m" "dl" Threads::Threads ) diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index a30bd0c..f339ca7 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -6,7 +6,12 @@ macro( find_linalg_dependencies _libs ) if (${_lib} MATCHES "OpenMP") find_dependency(OpenMP) elseif (${_lib} MATCHES "Threads") - find_dependency(Threads) + if (NOT TARGET Threads::Threads) + find_dependency(Threads) + # Threads::Threads by default is not GLOBAL, so to allow users of LINALG_LIBRARIES to safely use it we need to make it global + # more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256 + set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE) + endif(NOT TARGET Threads::Threads) elseif (${_lib} MATCHES "tbb") find_dependency(TBB) elseif (${_lib} MATCHES "MPI") diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 89e548a..2e158c7 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -195,6 +195,9 @@ function( append_possibly_missing_libs _linker_test __compile_output _orig_libs " * Missing PThreads - Adding to ${_linker_test} linker" ) if( NOT TARGET Threads::Threads ) find_dependency( Threads ) + # Threads::Threads by default is not GLOBAL, so to allow users of LINALG_LIBRARIES to safely use it we need to make it global + # more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256 + set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE) endif() list( APPEND _tmp_libs Threads::Threads ) endif() From f999753e53be916623d2c323f75f4cb603a3d619 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 6 Jan 2022 17:41:55 -0500 Subject: [PATCH 118/122] update findtbb (#2) * typo * replace FindTBB with the kitware version to be able to use with OneAPI MKL this also supports using the targets installed via a cmake-configured install of TBB (and prefers such targets) * explicitly link against C++ lib when using not only static but also pre-OneAPI _dynamic_ lib with TBB backend * move dependence on c++ stdlib into TBB::tbb target --- FindIntelMKL.cmake | 24 +- FindTBB.cmake | 717 ++++++++++++++++++++++++++++----------------- 2 files changed, 453 insertions(+), 288 deletions(-) diff --git a/FindIntelMKL.cmake b/FindIntelMKL.cmake index 9852463..1eb00d8 100644 --- a/FindIntelMKL.cmake +++ b/FindIntelMKL.cmake @@ -19,7 +19,7 @@ include( CMakeFindDependencyMacro ) # SANITY CHECK if( "ilp64" IN_LIST IntelMKL_FIND_COMPONENTS AND "lp64" IN_LIST IntelMKL_FIND_COMPONENTS ) - message( FATAL_ERROR "IntelMKL cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "IntelMKL cannot link to both ILP64 and LP64 interfaces" ) endif() if( "scalapack" IN_LIST IntelMKL_FIND_COMPONENTS AND NOT ("blacs" IN_LIST IntelMKL_FIND_COMPONENTS) ) @@ -413,27 +413,21 @@ if( IntelMKL_LIBRARY AND IntelMKL_THREAD_LIBRARY AND IntelMKL_CORE_LIBRARY ) elseif( IntelMKL_THREAD_LAYER MATCHES "tbb" ) - if( NOT TARGET tbb ) - #message( FATAL_ERROR "TBB Bindings Not Currently Accessible Through FindIntelMKL" ) - find_dependency( TBB ) + if( NOT TARGET TBB::tbb ) + find_dependency( TBB REQUIRED ) + # TBB::tbb by default is not GLOBAL, so to allow users of LINALG_LIBRARIES to safely use it we need to make it global + # more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256 + set_target_properties(TBB::tbb PROPERTIES IMPORTED_GLOBAL TRUE) endif() - set( _mkl_tbb_extra_libs tbb ) - if( IntelMKL_PREFERS_STATIC ) - list( APPEND _mkl_tbb_extra_libs "stdc++" ) - endif() - list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES ${_mkl_tbb_extra_libs} ) - + list( APPEND IntelMKL_BLAS_LAPACK_LIBRARIES TBB::tbb ) if( IntelMKL_BLACS_LIBRARIES ) - list( APPEND IntelMKL_BLACS_LIBRARIES ${_mkl_tbb_extra_libs} ) + list( APPEND IntelMKL_BLACS_LIBRARIES TBB::tbb ) endif() - if( IntelMKL_ScaLAPACK_LIBRARIES ) - list( APPEND IntelMKL_ScaLAPACK_LIBRARIES ${_mkl_tbb_extra_libs} ) + list( APPEND IntelMKL_ScaLAPACK_LIBRARIES TBB::tbb ) endif() - unset( _mkl_tbb_extra_libs ) - endif() diff --git a/FindTBB.cmake b/FindTBB.cmake index 0a1a5bb..f9ea7ab 100644 --- a/FindTBB.cmake +++ b/FindTBB.cmake @@ -1,303 +1,474 @@ -# The MIT License (MIT) +# based https://github.com/Kitware/VTK/blob/master/CMake/FindTBB.cmake # -# Copyright (c) 2015 Justus Calvin -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# CHANGES: +# - TBB_ROOT -> TBBROOT (tbb shell scripts set envvar TBBROOT) +# - Find ThreadingBuildingBlocks include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(TBB +# [REQUIRED] # Fail with error if TBB is not found +# ) # +# Once done, this will define # -# FindTBB -# ------- +# TBB_FOUND - system has TBB +# TBB_INCLUDE_DIRS - the TBB include directories +# TBB_LIBRARIES - TBB libraries to be linked, doesn't include malloc or +# malloc proxy +# TBB::tbb - imported target for the TBB library # -# Find TBB include directories and libraries. +# TBB_VERSION_MAJOR - Major Product Version Number +# TBB_VERSION_MINOR - Minor Product Version Number +# TBB_INTERFACE_VERSION - Engineering Focused Version Number +# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version +# still supported. This uses the engineering +# focused interface version numbers. # -# Usage: +# TBB_MALLOC_FOUND - system has TBB malloc library +# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories +# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined +# TBB::malloc - imported target for the TBB malloc library # -# find_package(TBB [major[.minor]] [EXACT] -# [QUIET] [REQUIRED] -# [[COMPONENTS] [components...]] -# [OPTIONAL_COMPONENTS components...]) +# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library +# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories +# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined +# TBB::malloc_proxy - imported target for the TBB malloc proxy library # -# where the allowed components are tbbmalloc and tbb_preview. Users may modify -# the behavior of this module with the following variables: # -# * TBB_ROOT_DIR - The base directory the of TBB installation. -# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files. -# * TBB_LIBRARY - The directory that contains the TBB library files. -# * TBB__LIBRARY - The path of the TBB the corresponding TBB library. -# These libraries, if specified, override the -# corresponding library search results, where -# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug, -# tbb_preview, or tbb_preview_debug. -# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will -# be used instead of the release version. +# This module reads hints about search locations from variables: +# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds +# ENV TBBROOT or just TBBROOT - root directory of tbb installation +# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb +# libraries. Should be specified with ENV TBBROOT +# and optionally... +# ENV TBB_BUILD_DIR - if build directory is different than ${TBBROOT}/build # -# Users may modify the behavior of this module with the following environment -# variables: # -# * TBB_INSTALL_DIR -# * TBBROOT -# * LIBRARY_PATH +# Modified by Robert Maynard from the original OGRE source # -# This module will set the following variables: +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ # -# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or -# don’t want to use TBB. -# * TBB__FOUND - If False, optional part of TBB sytem is -# not available. -# * TBB_VERSION - The full version string -# * TBB_VERSION_MAJOR - The major version -# * TBB_VERSION_MINOR - The minor version -# * TBB_INTERFACE_VERSION - The interface version number defined in -# tbb/tbb_stddef.h. -# * TBB__LIBRARY_RELEASE - The path of the TBB release version of -# , where may be tbb, tbb_debug, -# tbbmalloc, tbbmalloc_debug, tbb_preview, or -# tbb_preview_debug. -# * TBB__LIBRARY_DEGUG - The path of the TBB release version of -# , where may be tbb, tbb_debug, -# tbbmalloc, tbbmalloc_debug, tbb_preview, or -# tbb_preview_debug. +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- # -# The following varibles should be used to build and link with TBB: +#============================================================================= +# Copyright 2010-2012 Kitware, Inc. +# Copyright 2012 Rolf Eike Beer # -# * TBB_INCLUDE_DIRS - The include directory for TBB. -# * TBB_LIBRARIES - The libraries to link against to use TBB. -# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB. -# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB. -# * TBB_DEFINITIONS - Definitions to use when compiling code that uses -# TBB. -# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that -# uses TBB. -# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that -# uses TBB. +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. # -# This module will also create the "tbb" target that may be used when building -# executables and libraries. - -include(FindPackageHandleStandardArgs) - -if(NOT TBB_FOUND) - - ################################## - # Check the build type - ################################## - - if(NOT DEFINED TBB_USE_DEBUG_BUILD) - if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)") - set(TBB_BUILD_TYPE DEBUG) - else() - set(TBB_BUILD_TYPE RELEASE) - endif() - elseif(TBB_USE_DEBUG_BUILD) - set(TBB_BUILD_TYPE DEBUG) - else() - set(TBB_BUILD_TYPE RELEASE) - endif() - - ################################## - # Set the TBB search directories - ################################## - - # Define search paths based on user input and environment variables - set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT}) - - # Define the search directories based on the current platform - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB" - "C:/Program Files (x86)/Intel/TBB") - - # Set the target architecture - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(TBB_ARCHITECTURE "intel64") - else() - set(TBB_ARCHITECTURE "ia32") - endif() - - # Set the TBB search library path search suffix based on the version of VC - if(WINDOWS_STORE) - set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui") - elseif(MSVC14) - set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14") - elseif(MSVC12) - set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12") - elseif(MSVC11) - set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11") - elseif(MSVC10) - set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10") - endif() - - # Add the library path search suffix for the VC independent version of TBB - list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt") - - elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # OS X - set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") - - # TODO: Check to see which C++ library is being used by the compiler. - if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0) - # The default C++ library on OS X 10.9 and later is libc++ - set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib") - else() - set(TBB_LIB_PATH_SUFFIX "lib") - endif() - elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Linux - set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") - - # TODO: Check compiler version to see the suffix should be /gcc4.1 or - # /gcc4.1. For now, assume that the compiler is more recent than - # gcc 4.4.x or later. - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") - set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4") - endif() +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +#============================================================================= +# FindTBB helper functions and macros +# + +# Use TBBConfig.cmake if possible. + +set(_tbb_find_quiet) +if (TBB_FIND_QUIETLY) + set(_tbb_find_quiet QUIET) +endif () +set(_tbb_find_components) +set(_tbb_find_optional_components) +foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS) + if (TBB_FIND_REQUIRED_${_tbb_find_component}) + list(APPEND _tbb_find_components "${_tbb_find_component}") + else () + list(APPEND _tbb_find_optional_components "${_tbb_find_component}") + endif () +endforeach () +unset(_tbb_find_component) +find_package(TBB CONFIG ${_tbb_find_quiet} + COMPONENTS ${_tbb_find_components} + OPTIONAL_COMPONENTS ${_tbb_find_optional_components}) +unset(_tbb_find_quiet) +unset(_tbb_find_components) +unset(_tbb_find_optional_components) +if (TBB_FOUND) + return () +endif () + +#==================================================== +# Fix the library path in case it is a linker script +#==================================================== +function(tbb_extract_real_library library real_library) + if(NOT UNIX OR NOT EXISTS ${library}) + set(${real_library} "${library}" PARENT_SCOPE) + return() endif() - - ################################## - # Find the TBB include dir - ################################## - - find_path(TBB_INCLUDE_DIRS tbb/tbb.h - HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR} - PATHS ${TBB_DEFAULT_SEARCH_DIR} - PATH_SUFFIXES include) - - ################################## - # Set version strings - ################################## - - if(TBB_INCLUDE_DIRS) - file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) - string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" - TBB_VERSION_MAJOR "${_tbb_version_file}") - string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" - TBB_VERSION_MINOR "${_tbb_version_file}") - string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" - TBB_INTERFACE_VERSION "${_tbb_version_file}") - set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") + + #Read in the first 4 bytes and see if they are the ELF magic number + set(_elf_magic "7f454c46") + file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX) + if(_hex_data STREQUAL _elf_magic) + #we have opened a elf binary so this is what + #we should link to + set(${real_library} "${library}" PARENT_SCOPE) + return() endif() - ################################## - # Find TBB components - ################################## + file(READ ${library} _data OFFSET 0 LIMIT 1024) + if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") + #extract out the .so name from REGEX MATCH command + set(_proper_so_name "${CMAKE_MATCH_1}") - if(TBB_VERSION VERSION_LESS 4.3) - set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb) + #construct path to the real .so which is presumed to be in the same directory + #as the input file + get_filename_component(_so_dir "${library}" DIRECTORY) + set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE) else() - set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb) + #unable to determine what this library is so just hope everything works + #and pass it unmodified. + set(${real_library} "${library}" PARENT_SCOPE) endif() +endfunction() + +#=============================================== +# Do the final processing for the package find. +#=============================================== +macro(findpkg_finish PREFIX TARGET_NAME) + if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + else () + if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) + message(FATAL_ERROR "Required library ${PREFIX} not found.") + endif () + endif () + + if (NOT TARGET "TBB::${TARGET_NAME}") + if (${PREFIX}_LIBRARY_RELEASE) + tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) + endif () + if (${PREFIX}_LIBRARY_DEBUG) + tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) + endif () + add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") + if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}" + IMPORTED_LOCATION_DEBUG "${real_debug}" + IMPORTED_LOCATION_RELEASE "${real_release}") + elseif (${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}") + elseif (${PREFIX}_LIBRARY_DEBUG) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_debug}") + endif () + # on non-Windows platforms need C++ library + # tried IMPORTED_LINK_DEPENDENT_LIBRARIES + # and IMPORTED_LINK_INTERFACE_LANGUAGES (and changing UNKNOWN -> SHARED/STATIC in add_library) + # to pass this info, to no avail + if (NOT (WIN32 AND MSVC)) + if (USE_LIBCXX) + set(std_cxx_lib_name c++) + else (USE_LIBCXX) + set(std_cxx_lib_name stdc++) + endif (USE_LIBCXX) + target_link_libraries(TBB::${TARGET_NAME} INTERFACE ${std_cxx_lib_name}) + unset(std_cxx_lib_name) + endif () + endif () - # Find each component - foreach(_comp ${TBB_SEARCH_COMPOMPONENTS}) - if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};") - - # Search for the libraries - find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp} - HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} - PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH - PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) - - find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug - HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} - PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH - PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}) - - if(TBB_${_comp}_LIBRARY_DEBUG) - list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}") - endif() - if(TBB_${_comp}_LIBRARY_RELEASE) - list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}") - endif() - if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY) - set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}") - endif() - - if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}") - set(TBB_${_comp}_FOUND TRUE) - else() - set(TBB_${_comp}_FOUND FALSE) - endif() - - # Mark internal variables as advanced - mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE) - mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG) - mark_as_advanced(TBB_${_comp}_LIBRARY) - - endif() + #mark the following variables as internal variables + mark_as_advanced(${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE) +endmacro() + +#=============================================== +# Generate debug names from given release names +#=============================================== +macro(get_debug_names PREFIX) + foreach(i ${${PREFIX}}) + set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) endforeach() +endmacro() + +#=============================================== +# See if we have env vars to help us find tbb +#=============================================== +macro(getenv_path VAR) + set(ENV_${VAR} $ENV{${VAR}}) + # replace won't work if var is blank + if (ENV_${VAR}) + string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) + endif () +endmacro() + +#=============================================== +# Couple a set of release AND debug libraries +#=============================================== +macro(make_library_set PREFIX) + if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) + set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG}) + elseif (${PREFIX}_RELEASE) + set(${PREFIX} ${${PREFIX}_RELEASE}) + elseif (${PREFIX}_DEBUG) + set(${PREFIX} ${${PREFIX}_DEBUG}) + endif () +endmacro() + + +#============================================================================= +# Now to actually find TBB +# + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(TBBROOT) + +# initialize search paths +set(TBB_PREFIX_PATH ${TBBROOT} ${ENV_TBBROOT}) +set(TBB_INC_SEARCH_PATH "") +set(TBB_LIB_SEARCH_PATH "") + + +# If user built from sources +set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX}) +if (TBB_BUILD_PREFIX AND ENV_TBBROOT) + getenv_path(TBB_BUILD_DIR) + if (NOT ENV_TBB_BUILD_DIR) + set(ENV_TBB_BUILD_DIR ${ENV_TBBROOT}/build) + endif () + + # include directory under ${ENV_TBBROOT}/include + list(APPEND TBB_LIB_SEARCH_PATH + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release + ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug) +endif () + + +# For Windows, let's assume that the user might be using the precompiled +# TBB packages from the main website. These use a rather awkward directory +# structure (at least for automatically finding the right files) depending +# on platform and compiler, but we'll do our best to accommodate it. +# Not adding the same effort for the precompiled linux builds, though. Those +# have different versions for CC compiler versions and linux kernels which +# will never adequately match the user's setup, so there is no feasible way +# to detect the "best" version to use. The user will have to manually +# select the right files. (Chances are the distributions are shipping their +# custom version of tbb, anyway, so the problem is probably nonexistent.) +if (WIN32 AND MSVC) + set(COMPILER_PREFIX "vc7.1") + if (MSVC_VERSION EQUAL 1400) + set(COMPILER_PREFIX "vc8") + elseif(MSVC_VERSION EQUAL 1500) + set(COMPILER_PREFIX "vc9") + elseif(MSVC_VERSION EQUAL 1600) + set(COMPILER_PREFIX "vc10") + elseif(MSVC_VERSION EQUAL 1700) + set(COMPILER_PREFIX "vc11") + elseif(MSVC_VERSION EQUAL 1800) + set(COMPILER_PREFIX "vc12") + elseif(MSVC_VERSION GREATER_EQUAL 1900) + set(COMPILER_PREFIX "vc14") + endif () + + # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path + foreach (dir IN LISTS TBB_PREFIX_PATH) + if (CMAKE_CL_64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX}) + else () + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX}) + endif () + endforeach () +endif () + +# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9) +# and above and AppleClang +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND + NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0) + set (USE_LIBCXX OFF) + cmake_policy(GET CMP0025 POLICY_VAR) + + if (POLICY_VAR STREQUAL "NEW") + if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set (USE_LIBCXX ON) + endif () + else () + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set (USE_LIBCXX ON) + endif () + endif () - ################################## - # Set compile flags and libraries - ################################## - - set(TBB_DEFINITIONS_RELEASE "") - set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1") - - if(TBB_LIBRARIES_${TBB_BUILD_TYPE}) - set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}") - set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}") - elseif(TBB_LIBRARIES_RELEASE) - set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}") - set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}") - elseif(TBB_LIBRARIES_DEBUG) - set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}") - set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}") + if (USE_LIBCXX) + foreach (dir IN LISTS TBB_PREFIX_PATH) + list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib) + endforeach () + endif () +endif () + +# check compiler ABI +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(COMPILER_PREFIX) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + list(APPEND COMPILER_PREFIX "gcc4.8") + endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + list(APPEND COMPILER_PREFIX "gcc4.4") + endif() + list(APPEND COMPILER_PREFIX "gcc4.1") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(COMPILER_PREFIX) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess + list(APPEND COMPILER_PREFIX "gcc4.8") endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) + list(APPEND COMPILER_PREFIX "gcc4.7") + endif() + list(APPEND COMPILER_PREFIX "gcc4.4") +else() # Assume compatibility with 4.4 for other compilers + list(APPEND COMPILER_PREFIX "gcc4.4") +endif () + +# if platform architecture is explicitly specified +set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) +if (TBB_ARCH_PLATFORM) + foreach (dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM}) + endforeach () +endif () + +foreach (dir IN LISTS TBB_PREFIX_PATH) + foreach (prefix IN LISTS COMPILER_PREFIX) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib) + else () + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix}) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib) + endif () + endforeach() +endforeach () + +# add general search paths +foreach (dir IN LISTS TBB_PREFIX_PATH) + list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb + ${dir}/Libs) + list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include + ${dir}/include/tbb) +endforeach () + +set(TBB_LIBRARY_NAMES tbb) +get_debug_names(TBB_LIBRARY_NAMES) + + +find_path(TBB_INCLUDE_DIR + NAMES tbb/tbb.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_LIBRARY_RELEASE + NAMES ${TBB_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_LIBRARY_DEBUG + NAMES ${TBB_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_LIBRARY) + +findpkg_finish(TBB tbb) - find_package_handle_standard_args(TBB - REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES - HANDLE_COMPONENTS - VERSION_VAR TBB_VERSION) - - ################################## - # Create targets - ################################## - - if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND) - add_library(tbb SHARED IMPORTED) - set_target_properties(tbb PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS} - IMPORTED_LOCATION ${TBB_LIBRARIES}) - if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG) - set_target_properties(tbb PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "$<$,$>:TBB_USE_DEBUG=1>" - IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG} - IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG} - IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE} - IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE} - ) - elseif(TBB_LIBRARIES_RELEASE) - set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE}) - else() - set_target_properties(tbb PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}" - IMPORTED_LOCATION ${TBB_LIBRARIES_DEBUG} - ) - endif() +#if we haven't found TBB no point on going any further +if (NOT TBB_FOUND) + return() +endif () + +#============================================================================= +# Look for TBB's malloc package +set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc) +get_debug_names(TBB_MALLOC_LIBRARY_NAMES) + +find_path(TBB_MALLOC_INCLUDE_DIR + NAMES tbb/tbb.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_MALLOC_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_MALLOC_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_MALLOC_LIBRARY) + +findpkg_finish(TBB_MALLOC tbbmalloc) + +#============================================================================= +# Look for TBB's malloc proxy package +set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy) +get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES) + +find_path(TBB_MALLOC_PROXY_INCLUDE_DIR + NAMES tbb/tbbmalloc_proxy.h + PATHS ${TBB_INC_SEARCH_PATH}) + +find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} + PATHS ${TBB_LIB_SEARCH_PATH}) +find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG + NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG} + PATHS ${TBB_LIB_SEARCH_PATH}) +make_library_set(TBB_MALLOC_PROXY_LIBRARY) + +findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) + + +#============================================================================= +#parse all the version numbers from tbb +if(NOT TBB_VERSION) + if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h") + file(STRINGS + "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h" + TBB_VERSION_CONTENTS + REGEX "VERSION") + else() + #only read the start of the file + file(STRINGS + "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" + TBB_VERSION_CONTENTS + REGEX "VERSION") endif() - mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) + string(REGEX REPLACE + ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" + TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}") + + string(REGEX REPLACE + ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" + TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}") + + string(REGEX REPLACE + ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" + TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") - unset(TBB_ARCHITECTURE) - unset(TBB_BUILD_TYPE) - unset(TBB_LIB_PATH_SUFFIX) - unset(TBB_DEFAULT_SEARCH_DIR) + string(REGEX REPLACE + ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" + TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") -endif() +endif() \ No newline at end of file From d7ef03b6f82b9c6e586c9b7e22e908bc93868ca2 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Mon, 31 Jan 2022 13:02:54 -0800 Subject: [PATCH 119/122] fortran libs fix for ArmFlang --- FindStandardFortran.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FindStandardFortran.cmake b/FindStandardFortran.cmake index 6baeeb9..af87a4a 100644 --- a/FindStandardFortran.cmake +++ b/FindStandardFortran.cmake @@ -22,6 +22,10 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") set(STANDARDFORTRAN_LIBS ifcore) elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang") set(STANDARDFORTRAN_LIBS flang flangrti pgmath) + #CMAKE_Fortran_COMPILER_ID does not give "ArmFlang" + if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + set(STANDARDFORTRAN_LIBS armflang amath_a64fx) + endif() else() message(FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} is not yet supported by this module.") endif() From 7933044b7b1578b29f3fe9d2096a67efd5a7a024 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Tue, 12 Apr 2022 14:49:07 -0400 Subject: [PATCH 120/122] lapack linkage check uses `dgesvd` (#3) * typo * use dgesvd (instead of dpstrf) to detect linkage dependencies of lapack on macos homebrew's openblas only some routines have dependence on fortran, dpstrf is not one of them * typos * consolidate check_{*}_exists into check_fortran_function_exists + for LAPACK test dpstrf AND dgesvd * check_fortran_function_exists -> check_fortran_functions_exist to check for a set of functions at once * detect silent compile errors in {blas,lapack}_check_int * create genex-free linalg__COMPILE_OPTIONS that can be used in contexts (such as try_compile) where genex is not permitted * factor unit tests * do install util/BLASUtilities.cmake --- FindBLAS.cmake | 18 +++- FindBLIS.cmake | 2 +- FindFLAME.cmake | 2 +- FindIBMESSL.cmake | 2 +- FindILP64.cmake | 33 +++++-- FindLAPACK.cmake | 52 +++++++---- FindOpenBLAS.cmake | 2 +- FindReferenceBLAS.cmake | 2 +- FindReferenceLAPACK.cmake | 2 +- FindReferenceScaLAPACK.cmake | 2 +- FindScaLAPACK.cmake | 7 +- FindStandardFortran.cmake | 2 +- LinAlgModulesMacros.cmake | 2 +- examples/blas/common.cmake | 12 +++ examples/blas/default/CMakeLists.txt | 8 +- examples/blas/ilp64/CMakeLists.txt | 8 +- examples/blas/lp64/CMakeLists.txt | 8 +- examples/ilp64/CMakeLists.txt | 7 ++ examples/lapack/common.cmake | 12 +++ examples/lapack/default/CMakeLists.txt | 8 +- examples/lapack/ilp64/CMakeLists.txt | 8 +- examples/lapack/lp64/CMakeLists.txt | 8 +- examples/scalapack/common.cmake | 12 +++ examples/scalapack/default/CMakeLists.txt | 8 +- examples/scalapack/ilp64/CMakeLists.txt | 8 +- examples/scalapack/lp64/CMakeLists.txt | 8 +- util/BLASUtilities.cmake | 88 +----------------- util/CommonFunctions.cmake | 78 ++++++++++++++++ util/LAPACKUtilities.cmake | 103 +++------------------- util/ScaLAPACKUtilities.cmake | 2 +- 30 files changed, 235 insertions(+), 279 deletions(-) create mode 100644 examples/blas/common.cmake create mode 100644 examples/lapack/common.cmake create mode 100644 examples/scalapack/common.cmake diff --git a/FindBLAS.cmake b/FindBLAS.cmake index b5a3531..83e1306 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -13,7 +13,7 @@ include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) # SANITY CHECK: Make sure only one integer interface is requested if( "ilp64" IN_LIST BLAS_FIND_COMPONENTS AND "lp64" IN_LIST BLAS_FIND_COMPONENTS ) - message( FATAL_ERROR "BLAS cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "BLAS cannot link to both ILP64 and LP64 interfaces" ) endif() @@ -82,11 +82,11 @@ endif() # Check if DGEMM exists in proposed BLAS_LIBRARIES -check_dgemm_exists( BLAS_LIBRARIES - BLAS_LINK_OK BLAS_FORTRAN_LOWER BLAS_FORTRAN_UNDERSCORE ) +check_fortran_functions_exist( dgemm BLAS BLAS_LIBRARIES + BLAS_LINK_OK BLAS_FORTRAN_LOWER BLAS_FORTRAN_UNDERSCORE ) -# If BLAS linkage sucessful, check if it is ILP64/LP64 +# If BLAS linkage successful, check if it is ILP64/LP64 if( BLAS_LINK_OK ) set( _dgemm_name "dgemm" ) @@ -106,6 +106,11 @@ if( BLAS_LINK_OK ) set( BLAS_ilp64_FOUND TRUE ) find_dependency( ILP64 ) list( APPEND BLAS_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) + foreach ( lang C CXX Fortran ) + if ( DEFINED ILP64_${lang}_COMPILE_OPTIONS ) + list( APPEND BLAS_${lang}_COMPILE_OPTIONS "${ILP64_${lang}_COMPILE_OPTIONS}" ) + endif() + endforeach() endif() endif() @@ -124,6 +129,11 @@ if( BLAS_FOUND ) set( BLAS_COMPILE_DEFINITIONS "${BLAS_COMPILE_DEFINITIONS}" CACHE STRING "BLAS Compile Definitions" FORCE ) set( BLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}" CACHE STRING "BLAS Include Directories" FORCE ) set( BLAS_COMPILE_OPTIONS "${BLAS_COMPILE_OPTIONS}" CACHE STRING "BLAS Compile Options" FORCE ) + foreach ( lang C CXX Fortran ) + if ( DEFINED BLAS_${lang}_COMPILE_OPTIONS ) + set( BLAS_${lang}_COMPILE_OPTIONS "${BLAS_${lang}_COMPILE_OPTIONS}" CACHE STRING "BLAS Compile Options for Language ${lang}" FORCE ) + endif() + endforeach() endif() if( BLAS_FOUND AND NOT TARGET BLAS::BLAS ) diff --git a/FindBLIS.cmake b/FindBLIS.cmake index 41b4df0..1ee6e5e 100644 --- a/FindBLIS.cmake +++ b/FindBLIS.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST BLIS_FIND_COMPONENTS AND "lp64" IN_LIST BLIS_FIND_COMPONENTS ) - message( FATAL_ERROR "BLIS cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "BLIS cannot link to both ILP64 and LP64 interfaces" ) endif() if( BLIS_PREFERS_STATIC ) diff --git a/FindFLAME.cmake b/FindFLAME.cmake index b7c0540..d8cf9c0 100644 --- a/FindFLAME.cmake +++ b/FindFLAME.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST FLAME_FIND_COMPONENTS AND "lp64" IN_LIST FLAME_FIND_COMPONENTS ) - message( FATAL_ERROR "FLAME cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "FLAME cannot link to both ILP64 and LP64 interfaces" ) endif() if( FLAME_PREFERS_STATIC ) diff --git a/FindIBMESSL.cmake b/FindIBMESSL.cmake index 1de3947..38f4e2a 100644 --- a/FindIBMESSL.cmake +++ b/FindIBMESSL.cmake @@ -1,5 +1,5 @@ if( "ilp64" IN_LIST IBMESSL_FIND_COMPONENTS AND "lp64" IN_LIST IBMESSL_FIND_COMPONENTS ) - message( FATAL_ERROR "IBMESSL cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "IBMESSL cannot link to both ILP64 and LP64 interfaces" ) endif() set( IBMESSL_LP64_SERIAL_LIBRARY_NAME "essl" ) diff --git a/FindILP64.cmake b/FindILP64.cmake index cc2a464..38231ea 100644 --- a/FindILP64.cmake +++ b/FindILP64.cmake @@ -1,10 +1,27 @@ +set( ILP64_FOUND TRUE CACHE BOOL "ILP64 Flags Found" FORCE ) set( ILP64_COMPILE_OPTIONS - # Ensure 64-bit executables for GNU C,CXX,Fortran - $<$,$>:-m64> - # Make default integers 64-bit for Fortran - $<$,$>:-i8> - $<$,$>:-fdefault-integer-8> -) + # Ensure 64-bit executables for GNU C,CXX,Fortran + $<$,$>:-m64> + # Make default integers 64-bit for Fortran + $<$,$>:-i8> + $<$,$>:-fdefault-integer-8> + ) +set( ILP64_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" CACHE STRING "ILP64 compile options" FORCE ) -set( ILP64_FOUND TRUE CACHE BOOL "ILP64 Flags Found" FORCE ) -set( ILP64_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" CACHE STRING "ILP64 Flags" FORCE ) +foreach (lang C CXX Fortran) + if ( NOT DEFINED CMAKE_${lang}_COMPILER_ID ) + continue() + endif() + if ( CMAKE_${lang}_COMPILER_ID STREQUAL GNU ) + list( APPEND ILP64_${lang}_COMPILE_OPTIONS -m64 ) + endif() + if ( lang STREQUAL Fortran ) + if ( CMAKE_Fortran_COMPILER_ID STREQUAL Intel OR CMAKE_Fortran_COMPILER_ID STREQUAL PGI ) + list( APPEND ILP64_${lang}_COMPILE_OPTIONS -i8 ) + endif() + if ( CMAKE_Fortran_COMPILER_ID STREQUAL GNU OR CMAKE_Fortran_COMPILER_ID STREQUAL Flang ) + list( APPEND ILP64_${lang}_COMPILE_OPTIONS -fdefault-integer-8 ) + endif() + endif() + set( ILP64_${lang}_COMPILE_OPTIONS "${ILP64_${lang}_COMPILE_OPTIONS}" CACHE STRING "ILP64 compile options for language ${lang}" FORCE ) +endforeach() diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 71024ac..2f9dccf 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -13,7 +13,7 @@ include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) # SANITY CHECK if( "ilp64" IN_LIST LAPACK_FIND_COMPONENTS AND "lp64" IN_LIST LAPACK_FIND_COMPONENTS ) - message( FATAL_ERROR "LAPACK cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "LAPACK cannot link to both ILP64 and LP64 interfaces" ) endif() @@ -37,23 +37,26 @@ if( NOT LAPACK_LIBRARIES ) # Find BLAS if( NOT TARGET BLAS::BLAS ) - copy_meta_data( LAPACK BLAS ) - find_dependency( BLAS - COMPONENTS ${LAPACK_REQUIRED_COMPONENTS} - OPTIONAL_COMPONENTS ${LAPACK_OPTIONAL_COMPONENTS} + copy_meta_data( LAPACK BLAS ) + find_dependency( BLAS + COMPONENTS ${LAPACK_REQUIRED_COMPONENTS} + OPTIONAL_COMPONENTS ${LAPACK_OPTIONAL_COMPONENTS} ) endif() - + # Check if BLAS contains a LAPACK linker message( STATUS "LAPACK_LIBRARIES Not Given: Checking for LAPACK in BLAS" ) set( LAPACK_LIBRARIES ${BLAS_LIBRARIES} ) set( LAPACK_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS} ) set( LAPACK_COMPILE_DEFINITIONS ${BLAS_COMPILE_DEFINITIONS} ) - check_dpstrf_exists( LAPACK_LIBRARIES - BLAS_HAS_LAPACK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE - ) - - + + # use dpstrf to check for full LAPACK API ... some implementations are incomplete (e.g. older OpenBLAS) + # also need to handle several corner cases: + # - OpenBLAS needs libgfortran only for some functions, dpstrf is not one of them, so check for dgesvd + check_fortran_functions_exist( "dpstrf;dgesvd" LAPACK LAPACK_LIBRARIES + BLAS_HAS_LAPACK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE + ) + # If BLAS has a full LAPACK Linker, propagate vars if( BLAS_HAS_LAPACK ) @@ -79,9 +82,9 @@ if( NOT LAPACK_LIBRARIES ) copy_meta_data( LAPACK ${lapack_type} ) - find_package( ${lapack_type} - COMPONENTS ${LAPACK_REQUIRED_COMPONENTS} - OPTIONAL_COMPONENTS ${LAPACK_OPTIONAL_COMPONENTS} + find_package( ${lapack_type} + COMPONENTS ${LAPACK_REQUIRED_COMPONENTS} + OPTIONAL_COMPONENTS ${LAPACK_OPTIONAL_COMPONENTS} ) if( ${lapack_type}_FOUND ) @@ -120,12 +123,13 @@ endif() if( BLAS_HAS_LAPACK ) set( LAPACK_LINK_OK TRUE ) else() - check_dpstrf_exists( LAPACK_LIBRARIES - LAPACK_LINK_OK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE - ) + # see notes above the first invocation of check_fortran_functions_exist + check_fortran_functions_exist( "dpstrf;dgesvd" LAPACK LAPACK_LIBRARIES + LAPACK_LINK_OK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE + ) endif() -# If LAPACK linkage sucessful, check if it is ILP64/LP64 +# If LAPACK linkage successful, check if it is ILP64/LP64 if( LAPACK_LINK_OK ) set( _dsyev_name "dsyev" ) @@ -145,6 +149,11 @@ if( LAPACK_LINK_OK ) set( LAPACK_ilp64_FOUND TRUE ) find_dependency( ILP64 ) list( APPEND LAPACK_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) + foreach ( lang C CXX Fortran ) + if ( DEFINED ILP64_${lang}_COMPILE_OPTIONS ) + list( APPEND LAPACK_${lang}_COMPILE_OPTIONS "${ILP64_${lang}_COMPILE_OPTIONS}" ) + endif() + endforeach() endif() else() @@ -171,10 +180,15 @@ if( LAPACK_FOUND ) set( LAPACK_COMPILE_DEFINITIONS "${LAPACK_COMPILE_DEFINITIONS}" CACHE STRING "LAPACK Compile Definitions" FORCE ) set( LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}" CACHE STRING "LAPACK Include Directories" FORCE ) set( LAPACK_COMPILE_OPTIONS "${LAPACK_COMPILE_OPTIONS}" CACHE STRING "LAPACK Compile Options" FORCE ) + foreach ( lang C CXX Fortran ) + if ( DEFINED LAPACK_${lang}_COMPILE_OPTIONS ) + set( LAPACK_${lang}_COMPILE_OPTIONS "${LAPACK_${lang}_COMPILE_OPTIONS}" CACHE STRING "LAPACK Compile Options for Language ${lang}" FORCE ) + endif() + endforeach() endif() if( LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK ) - + add_library( LAPACK::LAPACK INTERFACE IMPORTED ) set_target_properties( LAPACK::LAPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIRS}" diff --git a/FindOpenBLAS.cmake b/FindOpenBLAS.cmake index 93f5e9c..c4e3c4b 100644 --- a/FindOpenBLAS.cmake +++ b/FindOpenBLAS.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST OpenBLAS_FIND_COMPONENTS AND "lp64" IN_LIST OpenBLAS_FIND_COMPONENTS ) - message( FATAL_ERROR "OpenBLAS cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "OpenBLAS cannot link to both ILP64 and LP64 interfaces" ) endif() if( OpenBLAS_PREFERS_STATIC ) diff --git a/FindReferenceBLAS.cmake b/FindReferenceBLAS.cmake index 8a9904b..d6caf54 100644 --- a/FindReferenceBLAS.cmake +++ b/FindReferenceBLAS.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST ReferenceBLAS_FIND_COMPONENTS AND "lp64" IN_LIST ReferenceBLAS_FIND_COMPONENTS ) - message( FATAL_ERROR "ReferenceBLAS cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "ReferenceBLAS cannot link to both ILP64 and LP64 interfaces" ) endif() if( ReferenceBLAS_PREFERS_STATIC ) diff --git a/FindReferenceLAPACK.cmake b/FindReferenceLAPACK.cmake index 459e0cf..14b5095 100644 --- a/FindReferenceLAPACK.cmake +++ b/FindReferenceLAPACK.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST ReferenceLAPACK_FIND_COMPONENTS AND "lp64" IN_LIST ReferenceLAPACK_FIND_COMPONENTS ) - message( FATAL_ERROR "ReferenceLAPACK cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "ReferenceLAPACK cannot link to both ILP64 and LP64 interfaces" ) endif() if( ReferenceLAPACK_PREFERS_STATIC ) diff --git a/FindReferenceScaLAPACK.cmake b/FindReferenceScaLAPACK.cmake index 95bae4e..b09c63a 100644 --- a/FindReferenceScaLAPACK.cmake +++ b/FindReferenceScaLAPACK.cmake @@ -1,6 +1,6 @@ # SANITY CHECK if( "ilp64" IN_LIST ReferenceScaLAPACK_FIND_COMPONENTS AND "lp64" IN_LIST ReferenceScaLAPACK_FIND_COMPONENTS ) - message( FATAL_ERROR "ReferenceScaLAPACK cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "ReferenceScaLAPACK cannot link to both ILP64 and LP64 interfaces" ) endif() if( "ilp64" IN_LIST ReferenceScaLAPACK_FIND_COMPONENTS ) diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 12030e3..4836041 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -44,7 +44,7 @@ include( ${CMAKE_CURRENT_LIST_DIR}/LinAlgModulesMacros.cmake ) # SANITY CHECK if( "ilp64" IN_LIST ScaLAPACK_FIND_COMPONENTS AND "lp64" IN_LIST ScaLAPACK_FIND_COMPONENTS ) - message( FATAL_ERROR "ScaLAPACK cannot link to both ILP64 and LP64 iterfaces" ) + message( FATAL_ERROR "ScaLAPACK cannot link to both ILP64 and LP64 interfaces" ) endif() @@ -174,6 +174,11 @@ if( ScaLAPACK_LINK_OK ) set( ScaLAPACK_ilp64_FOUND TRUE ) find_dependency( ILP64 ) list( APPEND ScaLAPACK_COMPILE_OPTIONS "${ILP64_COMPILE_OPTIONS}" ) + foreach ( lang C CXX Fortran ) + if ( DEFINED ILP64_${lang}_COMPILE_OPTIONS ) + list( APPEND ScaLAPACK_${lang}_COMPILE_OPTIONS "${ILP64_${lang}_COMPILE_OPTIONS}" ) + endif() + endforeach() endif() else() diff --git a/FindStandardFortran.cmake b/FindStandardFortran.cmake index af87a4a..c58db6a 100644 --- a/FindStandardFortran.cmake +++ b/FindStandardFortran.cmake @@ -9,7 +9,7 @@ # Implemenation note. CMake provides a variable # CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES which is a list of all libraries a # compiler implicitly links against. Unfortunately, at least for GNU, this -# list includes a lot of extra libraries that we don't necessarilly want to +# list includes a lot of extra libraries that we don't necessarily want to # link against (including both static and shared versions of libgcc). This is # why we've hardcoded the list per compiler. # diff --git a/LinAlgModulesMacros.cmake b/LinAlgModulesMacros.cmake index f339ca7..6e064f9 100644 --- a/LinAlgModulesMacros.cmake +++ b/LinAlgModulesMacros.cmake @@ -40,13 +40,13 @@ set( LINALG_FIND_MODULES ) set( LINALG_UTIL_FILES + util/BLASUtilities.cmake util/blis_int_size.c util/func_check.c util/get_mpi_vendor.c util/ilp64_checker.c util/lapack_ilp64_checker.c util/openblas_int_size.c - util/BLASUtilities.cmake util/CommonFunctions.cmake util/IntrospectMPI.cmake util/IntrospectOpenMP.cmake diff --git a/examples/blas/common.cmake b/examples/blas/common.cmake new file mode 100644 index 0000000..a2bf381 --- /dev/null +++ b/examples/blas/common.cmake @@ -0,0 +1,12 @@ +message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) +message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) +message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) +message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) +foreach (lang C CXX Fortran) + if (DEFINED BLAS_${lang}_COMPILE_OPTIONS) + message( STATUS "BLAS_${lang}_COMPILE_OPTIONS = ${BLAS_${lang}_COMPILE_OPTIONS}" ) + endif() +endforeach() +message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) +message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) +message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) diff --git a/examples/blas/default/CMakeLists.txt b/examples/blas/default/CMakeLists.txt index 6f4d506..5b1457a 100644 --- a/examples/blas/default/CMakeLists.txt +++ b/examples/blas/default/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) find_package( BLAS REQUIRED ) -message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) -message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) -message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) -message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) -message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) -message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) -message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) +include( ../../blas/common.cmake ) diff --git a/examples/blas/ilp64/CMakeLists.txt b/examples/blas/ilp64/CMakeLists.txt index 0682eab..c22a120 100644 --- a/examples/blas/ilp64/CMakeLists.txt +++ b/examples/blas/ilp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) find_package( BLAS REQUIRED COMPONENTS ilp64 ) -message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) -message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) -message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) -message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) -message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) -message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) -message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) +include( ../../blas/common.cmake ) diff --git a/examples/blas/lp64/CMakeLists.txt b/examples/blas/lp64/CMakeLists.txt index b1e1040..866700c 100644 --- a/examples/blas/lp64/CMakeLists.txt +++ b/examples/blas/lp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(blas_test LANGUAGES C) find_package( BLAS REQUIRED COMPONENTS lp64 ) -message( STATUS "BLAS_VENDOR = ${BLAS_VENDOR}" ) -message( STATUS "BLAS_LIBRARIES = ${BLAS_LIBRARIES}" ) -message( STATUS "BLAS_COMPILE_DEFINITIONS = ${BLAS_COMPILE_DEFINITIONS}" ) -message( STATUS "BLAS_COMPILE_OPTIONS = ${BLAS_COMPILE_OPTIONS}" ) -message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) -message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) -message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) +include( ../../blas/common.cmake ) diff --git a/examples/ilp64/CMakeLists.txt b/examples/ilp64/CMakeLists.txt index 945e1aa..1dd62a7 100644 --- a/examples/ilp64/CMakeLists.txt +++ b/examples/ilp64/CMakeLists.txt @@ -9,3 +9,10 @@ add_executable( my_test_fortran test.f90 ) target_compile_options( my_test_c PUBLIC ${ILP64_COMPILE_OPTIONS} ) target_compile_options( my_test_cxx PUBLIC ${ILP64_COMPILE_OPTIONS} ) target_compile_options( my_test_fortran PUBLIC ${ILP64_COMPILE_OPTIONS} ) + +add_executable( my_test_c_2 test.c ) +add_executable( my_test_cxx_2 test.cxx ) +add_executable( my_test_fortran_2 test.f90 ) +target_compile_options( my_test_c PUBLIC ${ILP64_C_COMPILE_OPTIONS} ) +target_compile_options( my_test_cxx PUBLIC ${ILP64_CXX_COMPILE_OPTIONS} ) +target_compile_options( my_test_fortran PUBLIC ${ILP64_Fortran_COMPILE_OPTIONS} ) diff --git a/examples/lapack/common.cmake b/examples/lapack/common.cmake new file mode 100644 index 0000000..32ce431 --- /dev/null +++ b/examples/lapack/common.cmake @@ -0,0 +1,12 @@ +message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) +message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) +message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) +foreach (lang C CXX Fortran) + if (DEFINED LAPACK_${lang}_COMPILE_OPTIONS) + message( STATUS "LAPACK_${lang}_COMPILE_OPTIONS = ${LAPACK_${lang}_COMPILE_OPTIONS}" ) + endif() +endforeach() +message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) +message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) +message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) diff --git a/examples/lapack/default/CMakeLists.txt b/examples/lapack/default/CMakeLists.txt index 0172aed..4cb5798 100644 --- a/examples/lapack/default/CMakeLists.txt +++ b/examples/lapack/default/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) find_package( LAPACK REQUIRED ) -message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) -message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) -message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) -message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) -message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) +include( ../../lapack/common.cmake ) \ No newline at end of file diff --git a/examples/lapack/ilp64/CMakeLists.txt b/examples/lapack/ilp64/CMakeLists.txt index 05dcc0d..84be218 100644 --- a/examples/lapack/ilp64/CMakeLists.txt +++ b/examples/lapack/ilp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) find_package( LAPACK REQUIRED COMPONENTS ilp64 ) -message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) -message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) -message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) -message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) -message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) +include( ../../lapack/common.cmake ) \ No newline at end of file diff --git a/examples/lapack/lp64/CMakeLists.txt b/examples/lapack/lp64/CMakeLists.txt index f4cef88..3efe500 100644 --- a/examples/lapack/lp64/CMakeLists.txt +++ b/examples/lapack/lp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(lapack_test LANGUAGES C) find_package( LAPACK REQUIRED COMPONENTS lp64 ) -message( STATUS "LAPACK_VENDOR = ${LAPACK_VENDOR}" ) -message( STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" ) -message( STATUS "LAPACK_COMPILE_DEFINITIONS = ${LAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "LAPACK_COMPILE_OPTIONS = ${LAPACK_COMPILE_OPTIONS}" ) -message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) -message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) +include( ../../lapack/common.cmake ) \ No newline at end of file diff --git a/examples/scalapack/common.cmake b/examples/scalapack/common.cmake new file mode 100644 index 0000000..8d04d43 --- /dev/null +++ b/examples/scalapack/common.cmake @@ -0,0 +1,12 @@ +message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) +message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) +message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) +message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) +foreach (lang C CXX Fortran) + if (DEFINED ScaLAPACK_${lang}_COMPILE_OPTIONS) + message( STATUS "ScaLAPACK_${lang}_COMPILE_OPTIONS = ${ScaLAPACK_${lang}_COMPILE_OPTIONS}" ) + endif() +endforeach() +message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) +message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) +message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) diff --git a/examples/scalapack/default/CMakeLists.txt b/examples/scalapack/default/CMakeLists.txt index 3c944ce..17c7710 100644 --- a/examples/scalapack/default/CMakeLists.txt +++ b/examples/scalapack/default/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) find_package( ScaLAPACK REQUIRED ) -message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) -message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) -message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) -message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) -message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) +include( ../../scalapack/common.cmake ) \ No newline at end of file diff --git a/examples/scalapack/ilp64/CMakeLists.txt b/examples/scalapack/ilp64/CMakeLists.txt index c1c6769..b291fb6 100644 --- a/examples/scalapack/ilp64/CMakeLists.txt +++ b/examples/scalapack/ilp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) find_package( ScaLAPACK REQUIRED COMPONENTS ilp64 ) -message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) -message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) -message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) -message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) -message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) +include( ../../scalapack/common.cmake ) \ No newline at end of file diff --git a/examples/scalapack/lp64/CMakeLists.txt b/examples/scalapack/lp64/CMakeLists.txt index 34e68d5..bed3ae4 100644 --- a/examples/scalapack/lp64/CMakeLists.txt +++ b/examples/scalapack/lp64/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required( VERSION 3.10 ) project(scalapack_test LANGUAGES C) find_package( ScaLAPACK REQUIRED COMPONENTS lp64 ) -message( STATUS "ScaLAPACK_VENDOR = ${ScaLAPACK_VENDOR}" ) -message( STATUS "ScaLAPACK_LIBRARIES = ${ScaLAPACK_LIBRARIES}" ) -message( STATUS "ScaLAPACK_COMPILE_DEFINITIONS = ${ScaLAPACK_COMPILE_DEFINITIONS}" ) -message( STATUS "ScaLAPACK_COMPILE_OPTIONS = ${ScaLAPACK_COMPILE_OPTIONS}" ) -message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) -message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) -message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" ) +include( ../../scalapack/common.cmake ) \ No newline at end of file diff --git a/util/BLASUtilities.cmake b/util/BLASUtilities.cmake index 29b7613..1d782f3 100644 --- a/util/BLASUtilities.cmake +++ b/util/BLASUtilities.cmake @@ -1,89 +1,5 @@ set( BLAS_UTILITY_CMAKE_FILE_DIR ${CMAKE_CURRENT_LIST_DIR} ) - -function( check_dgemm_exists _libs _link_ok _uses_lower _uses_underscore ) - -include( ${BLAS_UTILITY_CMAKE_FILE_DIR}/CommonFunctions.cmake ) - -set( ${_link_ok} FALSE ) -set( ${_uses_lower} ) -set( ${_uses_underscore} ) - - -foreach( _uplo LOWER UPPER ) - - set( _dgemm_name_template "dgemm" ) - string( TO${_uplo} ${_dgemm_name_template} _dgemm_name_uplo ) - - foreach( _under UNDERSCORE NO_UNDERSCORE ) - - set( _item BLAS_${_uplo}_${_under} ) - if( _under EQUAL "UNDERSCORE" ) - set( _dgemm_name "${_dgemm_name_uplo}_" ) - else() - set( _dgemm_name "${_dgemm_name_uplo}_" ) - endif() - - check_function_exists_w_results( - "${${_libs}}" ${_dgemm_name} _compile_output _compile_result - ) - - message( STATUS "Performing Test ${_item}" ) - if( _compile_result ) - - message( STATUS "Performing Test ${_item} -- found" ) - set( ${_link_ok} TRUE ) - string( COMPARE EQUAL "${_uplo}" "LOWER" ${_uses_lower} ) - string( COMPARE EQUAL "${_under}" "UNDERSCORE" ${_uses_underscore} ) - break() - - else() - - append_possibly_missing_libs( BLAS _compile_output ${_libs} _new_libs ) - list( APPEND ${_libs} ${_new_libs} ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - - # Recheck Compiliation - check_function_exists_w_results( - "${${_libs}}" ${_dgemm_name} _compile_output _compile_result - ) - - if( _compile_result ) - message( STATUS "Performing Test ${_item} -- found" ) - set( ${_link_ok} TRUE ) - string( COMPARE EQUAL "${_uplo}" "LOWER" ${_uses_lower} ) - string( COMPARE EQUAL "${_under}" "UNDERSCORE" ${_uses_underscore} ) - break() - else() - message( STATUS "Performing Test ${_item} -- not found" ) - endif() - - endif() - - endforeach() - - if( ${${_link_ok}} ) - break() - endif() - - unset( _dgemm_name_template ) - unset( _dgemm_name_uplo ) -endforeach() - -#cmake_pop_check_state() - - -set( ${_link_ok} ${${_link_ok}} PARENT_SCOPE ) -set( ${_uses_lower} ${${_uses_lower}} PARENT_SCOPE ) -set( ${_uses_underscore} ${${_uses_underscore}} PARENT_SCOPE ) - -endfunction() - - - - - - function( check_blas_int _libs _dgemm_name _libs_are_lp64 ) try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} @@ -94,6 +10,10 @@ try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} RUN_OUTPUT_VARIABLE _run_output ) +if (NOT _compile_result) + message(FATAL_ERROR "check_blas_int: try_run failed: _compile_output=${_compile_output}") +endif() + if( _run_output MATCHES "BLAS IS LP64" ) set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() diff --git a/util/CommonFunctions.cmake b/util/CommonFunctions.cmake index 2e158c7..26d66cc 100644 --- a/util/CommonFunctions.cmake +++ b/util/CommonFunctions.cmake @@ -211,3 +211,81 @@ function( append_possibly_missing_libs _linker_test __compile_output _orig_libs set( ${__new_libs} "${_tmp_libs}" PARENT_SCOPE ) endfunction() + +# _funcs = LIST of lowercase symbol name +# _namespace = namespace (BLAS, LAPACK, etc.) +function( check_fortran_functions_exist _funcs _namespace _libs _link_ok _uses_lower _uses_underscore ) + + set( ${_link_ok} FALSE ) + set( ${_uses_lower} ) + set( ${_uses_underscore} ) + + foreach( _uplo LOWER UPPER ) + + foreach( _under UNDERSCORE NO_UNDERSCORE ) + + set( _item ${_namespace}_${_uplo}_${_under} ) + message( STATUS "Performing Test ${_item}" ) + + # ask linker for each symbol in _funcs, exit early if any fail + foreach( _func IN LISTS _funcs) + + set( _${_func}_name_template "${_func}" ) + string( TO${_uplo} ${_${_func}_name_template} _${_func}_name_uplo ) + if( _under EQUAL "UNDERSCORE" ) + set( _${_func}_name "${_${_func}_name_uplo}_" ) + else() + set( _${_func}_name "${_${_func}_name_uplo}_" ) + endif() + + check_function_exists_w_results( + "${${_libs}}" ${_${_func}_name} _compile_output _compile_result + ) + + if( NOT _compile_result ) + + append_possibly_missing_libs( ${_namespace} _compile_output ${_libs} _new_libs ) + list( APPEND ${_libs} ${_new_libs} ) + set( ${_libs} ${${_libs}} PARENT_SCOPE ) + + # try linking again + check_function_exists_w_results( + "${${_libs}}" ${_${_func}_name} _compile_output _compile_result + ) + + endif() + + unset( _${_func}_name_template ) + unset( _${_func}_name_uplo ) + + if( _compile_result ) + set( ${_link_ok} TRUE ) + string( COMPARE EQUAL "${_uplo}" "LOWER" ${_uses_lower} ) + string( COMPARE EQUAL "${_under}" "UNDERSCORE" ${_uses_underscore} ) + else() + break() # early exit foreach if linking failed for any symbol even with extra libs + endif() + + endforeach() # _funcs + + if( ${${_link_ok}} ) + message( STATUS "Performing Test ${_item} -- found" ) + break() + else () + message( STATUS "Performing Test ${_item} -- not found" ) + endif() + + endforeach() # underscore + + if( ${${_link_ok}} ) + break() + endif() + + endforeach() # lowerupper + + + set( ${_link_ok} ${${_link_ok}} PARENT_SCOPE ) + set( ${_uses_lower} ${${_uses_lower}} PARENT_SCOPE ) + set( ${_uses_underscore} ${${_uses_underscore}} PARENT_SCOPE ) + +endfunction() diff --git a/util/LAPACKUtilities.cmake b/util/LAPACKUtilities.cmake index 9fddcce..ed78c03 100644 --- a/util/LAPACKUtilities.cmake +++ b/util/LAPACKUtilities.cmake @@ -1,100 +1,23 @@ set( LAPACK_UTILITY_CMAKE_FILE_DIR ${CMAKE_CURRENT_LIST_DIR} ) -function( check_dpstrf_exists _libs _link_ok _uses_lower _uses_underscore ) - -include( ${LAPACK_UTILITY_CMAKE_FILE_DIR}/CommonFunctions.cmake ) - -set( ${_link_ok} FALSE ) -set( ${_uses_lower} ) -set( ${_uses_underscore} ) - -foreach( _uplo LOWER UPPER ) +function( check_lapack_int _libs _dsyev_name _libs_are_lp64 ) - set( _dpstrf_name_template "dpstrf" ) - string( TO${_uplo} ${_dpstrf_name_template} _dpstrf_name_uplo ) - - foreach( _under UNDERSCORE NO_UNDERSCORE ) + try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${LAPACK_UTILITY_CMAKE_FILE_DIR}/lapack_ilp64_checker.c + LINK_LIBRARIES ${${_libs}} + COMPILE_DEFINITIONS "-DDSYEV_NAME=${_dsyev_name}" + COMPILE_OUTPUT_VARIABLE _compile_output + RUN_OUTPUT_VARIABLE _run_output + ) - set( _item LAPACK_${_uplo}_${_under} ) - if( _under EQUAL "UNDERSCORE" ) - set( _dpstrf_name "${_dpstrf_name_uplo}_" ) - else() - set( _dpstrf_name "${_dpstrf_name_uplo}_" ) + if (NOT _compile_result) + message(FATAL_ERROR "check_lapack_int: try_run failed: _compile_output=${_compile_output}") endif() - check_function_exists_w_results( - "${${_libs}}" ${_dpstrf_name} _compile_output _compile_result - ) - - message( STATUS "Performing Test ${_item}" ) - if( _compile_result ) - - message( STATUS "Performing Test ${_item} -- found" ) - set( ${_link_ok} TRUE ) - string( COMPARE EQUAL "${_uplo}" "LOWER" ${_uses_lower} ) - string( COMPARE EQUAL "${_under}" "UNDERSCORE" ${_uses_underscore} ) - break() - + if( _run_output MATCHES "LAPACK IS LP64" ) + set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) else() - - append_possibly_missing_libs( LAPACK _compile_output ${_libs} _new_libs ) - list( APPEND ${_libs} ${_new_libs} ) - set( ${_libs} ${${_libs}} PARENT_SCOPE ) - - - # Recheck Compiliation - check_function_exists_w_results( - "${${_libs}}" ${_dpstrf_name} _compile_output _compile_result - ) - - if( _compile_result ) - message( STATUS "Performing Test ${_item} -- found" ) - set( ${_link_ok} TRUE ) - string( COMPARE EQUAL "${_uplo}" "LOWER" ${_uses_lower} ) - string( COMPARE EQUAL "${_under}" "UNDERSCORE" ${_uses_underscore} ) - break() - else() - message( STATUS "Performing Test ${_item} -- not found" ) - endif() - + set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) endif() - endforeach() - - if( ${${_link_ok}} ) - break() - endif() - - unset( _dpstrf_name_template ) - unset( _dpstrf_name_uplo ) -endforeach() - -#cmake_pop_check_state() - - -set( ${_link_ok} ${${_link_ok}} PARENT_SCOPE ) -set( ${_uses_lower} ${${_uses_lower}} PARENT_SCOPE ) -set( ${_uses_underscore} ${${_uses_underscore}} PARENT_SCOPE ) - endfunction() - - - - -function( check_lapack_int _libs _dsyev_name _libs_are_lp64 ) - -try_run( _run_result _compile_result ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${LAPACK_UTILITY_CMAKE_FILE_DIR}/lapack_ilp64_checker.c - LINK_LIBRARIES ${${_libs}} - COMPILE_DEFINITIONS "-DDSYEV_NAME=${_dsyev_name}" - COMPILE_OUTPUT_VARIABLE _compile_output - RUN_OUTPUT_VARIABLE _run_output -) - -if( _run_output MATCHES "LAPACK IS LP64" ) - set( ${_libs_are_lp64} TRUE PARENT_SCOPE ) -else() - set( ${_libs_are_lp64} FALSE PARENT_SCOPE ) -endif() - -endfunction() diff --git a/util/ScaLAPACKUtilities.cmake b/util/ScaLAPACKUtilities.cmake index 90f8057..a77190e 100644 --- a/util/ScaLAPACKUtilities.cmake +++ b/util/ScaLAPACKUtilities.cmake @@ -41,7 +41,7 @@ foreach( _uplo LOWER UPPER ) list( APPEND ${_libs} ${_new_libs} ) set( ${_libs} ${${_libs}} PARENT_SCOPE ) - # Recheck Compiliation + # Recheck Compilation check_function_exists_w_results( "${${_libs}}" ${_pdpotrf_name} _compile_output _compile_result ) From 530b4e0b565d812f245b31b6156ff88cb29c4aea Mon Sep 17 00:00:00 2001 From: David Williams-Young Date: Wed, 20 Apr 2022 09:15:45 -0700 Subject: [PATCH 121/122] [CI] Force OpenBLAS GENERIC build in CI to avoid hangups --- .github/workflows/linalg/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linalg/Makefile b/.github/workflows/linalg/Makefile index 9ccb65d..4836b3d 100644 --- a/.github/workflows/linalg/Makefile +++ b/.github/workflows/linalg/Makefile @@ -127,28 +127,28 @@ download/openblas: install/openblas/lp64-sequential: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-sequential install install/openblas/lp64-pthreads: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-pthreads install install/openblas/lp64-openmp: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-lp64-openmp install install/openblas/ilp64-sequential: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 INTERFACE64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 INTERFACE64=1 USE_THREAD=0 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-sequential install install/openblas/ilp64-pthreads: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 INTERFACE64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 INTERFACE64=1 USE_THREAD=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-pthreads install install/openblas/ilp64-openmp: make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 clean - BINARY64=1 INTERFACE64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 + BINARY64=1 INTERFACE64=1 USE_OPENMP=1 CC=gcc FC=gfortran NO_CBLAS=1 NO_LAPACKE=1 TARGET=GENERIC make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 make -C ${software_prefix}/src/openblas/OpenBLAS-0.3.13 PREFIX=${software_prefix}/install/openblas-ilp64-openmp install # NETLIB == NETLIB-ScaLAPACK b/c it includes NETLIB-BLAS/LAPACK From 0bc70fba80f798f3093771f450e906eb31f3b056 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Wed, 20 Apr 2022 13:05:55 -0400 Subject: [PATCH 122/122] FORTRAN -> Fortran (#4) * typo * use dgesvd (instead of dpstrf) to detect linkage dependencies of lapack on macos homebrew's openblas only some routines have dependence on fortran, dpstrf is not one of them * typos * consolidate check_{*}_exists into check_fortran_function_exists + for LAPACK test dpstrf AND dgesvd * check_fortran_function_exists -> check_fortran_functions_exist to check for a set of functions at once * detect silent compile errors in {blas,lapack}_check_int * create genex-free linalg__COMPILE_OPTIONS that can be used in contexts (such as try_compile) where genex is not permitted * factor unit tests * do install util/BLASUtilities.cmake * FORTRAN -> Fortran * [CI] Force OpenBLAS GENERIC build in CI to avoid hangups Co-authored-by: David Williams-Young --- FindBLAS.cmake | 6 +++--- FindLAPACK.cmake | 8 ++++---- FindScaLAPACK.cmake | 8 ++++---- examples/blas/common.cmake | 4 ++-- examples/lapack/common.cmake | 4 ++-- examples/scalapack/common.cmake | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/FindBLAS.cmake b/FindBLAS.cmake index 83e1306..10379b7 100644 --- a/FindBLAS.cmake +++ b/FindBLAS.cmake @@ -83,17 +83,17 @@ endif() # Check if DGEMM exists in proposed BLAS_LIBRARIES check_fortran_functions_exist( dgemm BLAS BLAS_LIBRARIES - BLAS_LINK_OK BLAS_FORTRAN_LOWER BLAS_FORTRAN_UNDERSCORE ) + BLAS_LINK_OK BLAS_Fortran_LOWER BLAS_Fortran_UNDERSCORE ) # If BLAS linkage successful, check if it is ILP64/LP64 if( BLAS_LINK_OK ) set( _dgemm_name "dgemm" ) - if( NOT BLAS_FORTRAN_LOWER ) + if( NOT BLAS_Fortran_LOWER ) string( TOUPPER "${_dgemm_name}" _dgemm_name ) endif() - if( BLAS_FORTRAN_UNDERSCORE ) + if( BLAS_Fortran_UNDERSCORE ) set( _dgemm_name "${_dgemm_name}_" ) endif() diff --git a/FindLAPACK.cmake b/FindLAPACK.cmake index 2f9dccf..3fe8a0a 100644 --- a/FindLAPACK.cmake +++ b/FindLAPACK.cmake @@ -54,7 +54,7 @@ if( NOT LAPACK_LIBRARIES ) # also need to handle several corner cases: # - OpenBLAS needs libgfortran only for some functions, dpstrf is not one of them, so check for dgesvd check_fortran_functions_exist( "dpstrf;dgesvd" LAPACK LAPACK_LIBRARIES - BLAS_HAS_LAPACK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE + BLAS_HAS_LAPACK LAPACK_Fortran_LOWER LAPACK_Fortran_UNDERSCORE ) # If BLAS has a full LAPACK Linker, propagate vars @@ -125,7 +125,7 @@ if( BLAS_HAS_LAPACK ) else() # see notes above the first invocation of check_fortran_functions_exist check_fortran_functions_exist( "dpstrf;dgesvd" LAPACK LAPACK_LIBRARIES - LAPACK_LINK_OK LAPACK_FORTRAN_LOWER LAPACK_FORTRAN_UNDERSCORE + LAPACK_LINK_OK LAPACK_Fortran_LOWER LAPACK_Fortran_UNDERSCORE ) endif() @@ -133,10 +133,10 @@ endif() if( LAPACK_LINK_OK ) set( _dsyev_name "dsyev" ) - if( NOT LAPACK_FORTRAN_LOWER ) + if( NOT LAPACK_Fortran_LOWER ) string( TOUPPER "${_dsyev_name}" _dsyev_name ) endif() - if( LAPACK_FORTRAN_UNDERSCORE ) + if( LAPACK_Fortran_UNDERSCORE ) set( _dsyev_name "${_dsyev_name}_" ) endif() diff --git a/FindScaLAPACK.cmake b/FindScaLAPACK.cmake index 4836041..11b1375 100644 --- a/FindScaLAPACK.cmake +++ b/FindScaLAPACK.cmake @@ -82,7 +82,7 @@ if( NOT ScaLAPACK_LIBRARIES ) set( ScaLAPACK_INCLUDE_DIR ${LAPACK_INCLUDE_DIR} ) set( ScaLAPACK_COMPILE_DEFINITIONS ${LAPACK_COMPILE_DEFINITIONS} ) check_pdpotrf_exists( ScaLAPACK_LIBRARIES - LAPACK_HAS_ScaLAPACK ScaLAPACK_FORTRAN_LOWER ScaLAPACK_FORTRAN_UNDERSCORE + LAPACK_HAS_ScaLAPACK ScaLAPACK_Fortran_LOWER ScaLAPACK_Fortran_UNDERSCORE ) # If LAPACK has a full ScaLAPACK Linker, propagate vars @@ -143,7 +143,7 @@ if( LAPACK_HAS_ScaLAPACK ) set( ScaLAPACK_LINK_OK TRUE ) else() check_pdpotrf_exists( ScaLAPACK_LIBRARIES - ScaLAPACK_LINK_OK ScaLAPACK_FORTRAN_LOWER ScaLAPACK_FORTRAN_UNDERSCORE + ScaLAPACK_LINK_OK ScaLAPACK_Fortran_LOWER ScaLAPACK_Fortran_UNDERSCORE ) endif() @@ -152,10 +152,10 @@ if( ScaLAPACK_LINK_OK ) # TODO: This requires running an MPI program, pretty dangerous #set( _pdpotrf_name "pdpotrf" ) - #if( NOT ScaLAPACK_FORTRAN_LOWER ) + #if( NOT ScaLAPACK_Fortran_LOWER ) # string( TOUPPER "${_pdpotrf_name}" _pdpotrf_name ) #endif() - #if( ScaLAPACK_FORTRAN_UNDERSCORE ) + #if( ScaLAPACK_Fortran_UNDERSCORE ) # set( _pdpotrf_name "${_pdpotrf_name}_" ) #endif() diff --git a/examples/blas/common.cmake b/examples/blas/common.cmake index a2bf381..f134490 100644 --- a/examples/blas/common.cmake +++ b/examples/blas/common.cmake @@ -7,6 +7,6 @@ foreach (lang C CXX Fortran) message( STATUS "BLAS_${lang}_COMPILE_OPTIONS = ${BLAS_${lang}_COMPILE_OPTIONS}" ) endif() endforeach() -message( STATUS "BLAS_FORTRAN_LOWER = ${BLAS_FORTRAN_LOWER}" ) -message( STATUS "BLAS_FORTRAN_UNDERSCORE = ${BLAS_FORTRAN_UNDERSCORE}" ) +message( STATUS "BLAS_Fortran_LOWER = ${BLAS_Fortran_LOWER}" ) +message( STATUS "BLAS_Fortran_UNDERSCORE = ${BLAS_Fortran_UNDERSCORE}" ) message( STATUS "BLAS_IS_LP64 = ${BLAS_IS_LP64}" ) diff --git a/examples/lapack/common.cmake b/examples/lapack/common.cmake index 32ce431..ee208a9 100644 --- a/examples/lapack/common.cmake +++ b/examples/lapack/common.cmake @@ -7,6 +7,6 @@ foreach (lang C CXX Fortran) message( STATUS "LAPACK_${lang}_COMPILE_OPTIONS = ${LAPACK_${lang}_COMPILE_OPTIONS}" ) endif() endforeach() -message( STATUS "LAPACK_FORTRAN_LOWER = ${LAPACK_FORTRAN_LOWER}" ) -message( STATUS "LAPACK_FORTRAN_UNDERSCORE = ${LAPACK_FORTRAN_UNDERSCORE}" ) +message( STATUS "LAPACK_Fortran_LOWER = ${LAPACK_Fortran_LOWER}" ) +message( STATUS "LAPACK_Fortran_UNDERSCORE = ${LAPACK_Fortran_UNDERSCORE}" ) message( STATUS "LAPACK_IS_LP64 = ${LAPACK_IS_LP64}" ) diff --git a/examples/scalapack/common.cmake b/examples/scalapack/common.cmake index 8d04d43..7ea9cf0 100644 --- a/examples/scalapack/common.cmake +++ b/examples/scalapack/common.cmake @@ -7,6 +7,6 @@ foreach (lang C CXX Fortran) message( STATUS "ScaLAPACK_${lang}_COMPILE_OPTIONS = ${ScaLAPACK_${lang}_COMPILE_OPTIONS}" ) endif() endforeach() -message( STATUS "ScaLAPACK_FORTRAN_LOWER = ${ScaLAPACK_FORTRAN_LOWER}" ) -message( STATUS "ScaLAPACK_FORTRAN_UNDERSCORE = ${ScaLAPACK_FORTRAN_UNDERSCORE}" ) +message( STATUS "ScaLAPACK_Fortran_LOWER = ${ScaLAPACK_Fortran_LOWER}" ) +message( STATUS "ScaLAPACK_Fortran_UNDERSCORE = ${ScaLAPACK_Fortran_UNDERSCORE}" ) message( STATUS "ScaLAPACK_IS_LP64 = ${ScaLAPACK_IS_LP64}" )