From 908ddc964d900318ff714cde940cdcf12e5e089c Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 10 Jun 2020 16:47:28 -0400 Subject: [PATCH 1/5] Updates to allow GEOS to build without MKL This set of PRs is to allow GEOS to build without MKL. Note that it currently does this by making RRTMGP unusable if MKL is not found. This is not ideal, but it's a first attempt. --- esma.cmake | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/esma.cmake b/esma.cmake index 742b0190..9ab17b92 100644 --- a/esma.cmake +++ b/esma.cmake @@ -87,19 +87,34 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(MPI_DETERMINE_LIBRARY_VERSION TRUE) find_package (MPI REQUIRED) -if (APPLE) - if (DEFINED ENV{MKLROOT}) - set (MKL_Fortran) - find_package (MKL REQUIRED) - else () - if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - #USE FRAMEWORK - message(STATUS "Found macOS and gfortran, using framework Accelerate") - link_libraries("-framework Accelerate") - endif () - endif () -else () - find_package (MKL REQUIRED) + +find_package(LAPACK REQUIRED) +if (LAPACK_FOUND) + ecbuild_info("Found LAPACK:") + ecbuild_info(" LAPACK_LINKER_FLAGS: ${LAPACK_LINKER_FLAGS}") + ecbuild_info(" LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}") + if (LAPACK95_FOUND) + ecbuild_info("Found LAPACK95:") + ecbuild_info(" LAPACK95_LIBRARIES: ${LAPACK95_LIBRARIES}") + endif () +endif () + +find_package(BLAS REQUIRED) +if (BLAS_FOUND) + ecbuild_info("Found BLAS:") + ecbuild_info(" BLAS_LINKER_FLAGS: ${BLAS_LINKER_FLAGS}") + ecbuild_info(" BLAS_LIBRARIES: ${BLAS_LIBRARIES}") + if (BLAS95_FOUND) + ecbuild_info("Found BLAS95:") + ecbuild_info(" BLAS95_LIBRARIES: ${BLAS95_LIBRARIES}") + endif () +endif () + +find_package(MKL) +if (MKL_FOUND) + ecbuild_info("Found MKL:") + ecbuild_info(" MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}") + ecbuild_info(" MKL_LIBRARIES: ${MKL_LIBRARIES}") endif () option (ESMA_ALLOW_DEPRECATED "suppress warnings about deprecated features" ON) From 401bccc7405c8587a455e9d0f099e8141c6754dd Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 11 Jun 2020 12:15:48 -0400 Subject: [PATCH 2/5] Put MKL first and force sequential libraries --- esma.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/esma.cmake b/esma.cmake index 9ab17b92..5fe3fbed 100644 --- a/esma.cmake +++ b/esma.cmake @@ -87,6 +87,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(MPI_DETERMINE_LIBRARY_VERSION TRUE) find_package (MPI REQUIRED) +find_package(MKL) +if (MKL_FOUND) + ecbuild_info("Found MKL:") + ecbuild_info(" MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}") + ecbuild_info(" MKL_LIBRARIES: ${MKL_LIBRARIES}") + + set(BLA_VENDOR Intel10_64lp_seq) +endif () find_package(LAPACK REQUIRED) if (LAPACK_FOUND) @@ -110,13 +118,6 @@ if (BLAS_FOUND) endif () endif () -find_package(MKL) -if (MKL_FOUND) - ecbuild_info("Found MKL:") - ecbuild_info(" MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}") - ecbuild_info(" MKL_LIBRARIES: ${MKL_LIBRARIES}") -endif () - option (ESMA_ALLOW_DEPRECATED "suppress warnings about deprecated features" ON) # Baselibs ... From 7a325eb6ea8b023be659f7e00919dd9c257c7dda Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 1 Sep 2020 15:45:40 +0000 Subject: [PATCH 3/5] Add aarch64 option for GNU --- GNU.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GNU.cmake b/GNU.cmake index 148780d9..f4a6d8e2 100644 --- a/GNU.cmake +++ b/GNU.cmake @@ -125,7 +125,12 @@ set (GEOS_Fortran_Debug_FPE_Flags "${common_Fortran_fpe_flags}") # GEOS Release # ------------ -set (GEOS_Fortran_Release_Flags "${FOPT3} -march=westmere -mtune=generic -funroll-loops ${DEBINFO}") +if ( ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL aarch64 ) + set(GNU_TARGET_ARCH "armv8.2-a+crypto+crc+fp16+rcpc+dotprod") +else () + set(GNU_TARGET_ARCH "westmere") +endif () +set (GEOS_Fortran_Release_Flags "${FOPT3} -march=${GNU_TARGET_ARCH} -mtune=generic -funroll-loops ${DEBINFO}") set (GEOS_Fortran_Release_FPE_Flags "${common_Fortran_fpe_flags}") # GEOS Vectorize From 1c8b0cdc82bedfbf9cde5823f5541a7a65c45ec9 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 3 Sep 2020 09:45:17 -0400 Subject: [PATCH 4/5] Add mismatch and allow_boz to vect flags --- GNU.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GNU.cmake b/GNU.cmake index f4a6d8e2..98504fd3 100644 --- a/GNU.cmake +++ b/GNU.cmake @@ -140,11 +140,11 @@ set (GEOS_Fortran_Release_FPE_Flags "${common_Fortran_fpe_flags}") # Options per Jerry DeLisle on GCC Fortran List #set (GEOS_Fortran_Vect_Flags "${FOPT2} -march=native -ffast-math -ftree-vectorize -funroll-loops --param max-unroll-times=4 -mprefer-avx128 -mno-fma") -#set (GEOS_Fortran_Vect_FPE_Flags "${DEBINFO} ${TRACEBACK}") +#set (GEOS_Fortran_Vect_FPE_Flags "${DEBINFO} ${TRACEBACK} ${MISMATCH} ${ALLOW_BOZ}") # Options per Jerry DeLisle on GCC Fortran List with SVML (does not seem to help) #set (GEOS_Fortran_Vect_Flags "-O2 -march=native -ffast-math -ftree-vectorize -funroll-loops --param max-unroll-times=4 -mprefer-avx128 -mno-fma -mveclibabi=svml") -#set (GEOS_Fortran_Vect_FPE_Flags "${DEBINFO} ${TRACEBACK}") +#set (GEOS_Fortran_Vect_FPE_Flags "${DEBINFO} ${TRACEBACK} ${MISMATCH} ${ALLOW_BOZ}") # Until good options can be found, make vectorize equal common flags set (GEOS_Fortran_Vect_Flags ${GEOS_Fortran_Release_Flags}) From d83790ace247ebb1ac085c9ade4fd3404ec24654 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 9 Sep 2020 10:38:24 -0400 Subject: [PATCH 5/5] Don't require BLAS/LAPACK in ESMA_cmake Instead, the CMakeLists.txt in the package that requires BLAS or LAPACK should REQUIRED it. --- esma.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esma.cmake b/esma.cmake index 471fe9ba..44024203 100644 --- a/esma.cmake +++ b/esma.cmake @@ -103,7 +103,7 @@ if (MKL_FOUND) set(BLA_VENDOR Intel10_64lp_seq) endif () -find_package(LAPACK REQUIRED) +find_package(LAPACK) if (LAPACK_FOUND) ecbuild_info("Found LAPACK:") ecbuild_info(" LAPACK_LINKER_FLAGS: ${LAPACK_LINKER_FLAGS}") @@ -114,7 +114,7 @@ if (LAPACK_FOUND) endif () endif () -find_package(BLAS REQUIRED) +find_package(BLAS) if (BLAS_FOUND) ecbuild_info("Found BLAS:") ecbuild_info(" BLAS_LINKER_FLAGS: ${BLAS_LINKER_FLAGS}")