Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove most special handling of MKL in CMake configuration #1149

Merged
merged 32 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5d0f37d
Use spack's blas/lapack libraries for MKL from version 0.5.X onwards
msimberg May 28, 2024
018ebcd
Remove DLAF_WITH_MKL_LEGACY CMake option
msimberg May 28, 2024
3f9ffc1
Add auto-detection for MKL
msimberg May 28, 2024
dc0ffe3
TEMP: Disable most CI configurations for testing
msimberg May 28, 2024
9967509
Update SPACK_SHA in CI
msimberg May 28, 2024
f71272b
Add libssl-dev to CI image for external openssl
msimberg May 28, 2024
910724d
Don't explicitly set DLAF_WITH_MKL in spack package
msimberg May 28, 2024
e681b72
Print MKL try_compile result
msimberg May 28, 2024
bedcec4
Don't find_package(MKL)
msimberg May 29, 2024
3ec281b
Don't use -Werror=all-warnings for CUDA in CI
msimberg May 29, 2024
a5cdae8
Add TODO about enabling MKL and OpenMP
msimberg May 29, 2024
c54431b
Remove -Werror=missing-launch-bounds from CUDA CI configuration
msimberg May 29, 2024
ecb341d
Use older try_compile signature
msimberg May 29, 2024
ebe5106
Add LAPACK_INCLUDE_DIR and SCALAPACK_INCLUDE_DIR variables
msimberg May 29, 2024
1631e50
Add placeholder for empty LAPACK_INCLUDE_DIR
msimberg May 29, 2024
ed6f9da
Remove semicolons from CMAKE_CUDA_FLAGS list
msimberg May 29, 2024
6e365c7
Disable all CUDA warnings in CI
msimberg May 29, 2024
0e1c544
Uncomment all CI configurations
msimberg May 29, 2024
68519ff
Conditionally use separable compilation
msimberg May 29, 2024
76aa169
Use -Werror=all-warnings again in CUDA CI
msimberg May 29, 2024
bb54476
Make minimum cmake version 3.22 again
msimberg May 29, 2024
becc830
Remove TODO
msimberg May 29, 2024
7cbc163
Remove TODOs
msimberg May 29, 2024
fb0d487
Remove TODO about auto-detecting MKL in spack package
msimberg May 29, 2024
460d24f
Update DLAF_WITH_MKL option description
msimberg May 29, 2024
b25b3e1
Rerun MKL detection every time CMake is configured
msimberg May 29, 2024
672a700
Fix MKL try_compile build directory
msimberg May 29, 2024
22b3f18
Refactor MKL auto-detection
msimberg May 30, 2024
9dc2f78
Remove DLAF_WITH_MKL as an option
msimberg May 31, 2024
1758a66
Simplify checks for empty LAPACK_LIBRARY and LAPACK_INCLUDE_DIR
msimberg May 31, 2024
5f5bb92
Remove DLAF_WITH_MKL from DLAFConfig.cmake.in
msimberg May 31, 2024
f0fd524
Update SPACK_SHA
msimberg May 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ CMake option | Values | Note
`blaspp_DIR` | CMAKE:PATH | Location of the blaspp CMake-config file
`lapackpp_DIR` | CMAKE:PATH | Location of the lapackpp CMake-config file
`DLAF_WITH_MKL` | `{ON,OFF}` (default: `OFF`) | if blaspp/lapackpp is built with oneMKL
`DLAF_WITH_LEGACY_MKL` | `{ON,OFF}` (default: `OFF`) | if blaspp/lapackpp is built with MKL (deprecated)
`DLAF_WITH_SCALAPACK` | `{ON,OFF}` (default: `OFF`) | Enable ScaLAPACK-like API.
`MKL_ROOT` | CMAKE:PATH | Location of the MKL library
`DLAF_ASSERT_ENABLE` | `{ON,OFF}` (default: `ON`) | enable/disable cheap assertions
Expand Down
48 changes: 10 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# SPDX-License-Identifier: BSD-3-Clause
#

cmake_minimum_required(VERSION 3.22)
# TODO: Bump to 3.25 or keep 3.22?
msimberg marked this conversation as resolved.
Show resolved Hide resolved
cmake_minimum_required(VERSION 3.25)

project(DLAF VERSION 0.4.1)

Expand All @@ -34,8 +35,6 @@ endif()

option(BUILD_SHARED_LIBS "Build shared libraries." ON)
option(DLAF_WITH_OPENMP "${DLAF_WITH_OPENMP_DESCRIPTION}" ${DLAF_WITH_OPENMP_DEFAULT})
option(DLAF_WITH_MKL "Enable oneMKL as provider for BLAS and LAPACK" OFF)
option(DLAF_WITH_MKL_LEGACY "Enable MKL as provider for BLAS and LAPACK" OFF)
option(DLAF_WITH_CUDA "Enable CUDA support" OFF)
option(DLAF_WITH_HIP "Enable HIP support" OFF)
cmake_dependent_option(
Expand All @@ -55,11 +54,15 @@ option(DLAF_BUILD_DOC "Build documentation" OFF)
option(DLAF_WITH_PRECOMPILED_HEADERS "Use precompiled headers." OFF)
option(DLAF_WITH_SCALAPACK "Build ScaLAPACK-like C API (requires ScaLAPACK)" OFF)

if(DLAF_WITH_MKL AND DLAF_WITH_MKL_LEGACY)
message(SEND_ERROR "DLAF_WITH_MKL and DLAF_WITH_MKL_LEGACY are mutually exclusive.")
endif()
try_compile(
DLAF_WITH_MKL_TRY_COMPILE SOURCES "${PROJECT_SOURCE_DIR}/cmake/tests/mkl_set_num_threads.cpp"
LINK_OPTIONS "${LAPACK_LIBRARY}"
)
# TODO: Maybe don't need to print this? Though maybe it's nice to have...
msimberg marked this conversation as resolved.
Show resolved Hide resolved
message(WARNING "DLAF_WITH_MKL_TRY_COMPILE=${DLAF_WITH_MKL_TRY_COMPILE}")
option(DLAF_WITH_MKL "Enable oneMKL as provider for BLAS and LAPACK" "${DLAF_WITH_MKL_TRY_COMPILE}")
msimberg marked this conversation as resolved.
Show resolved Hide resolved

if(DLAF_WITH_MKL OR DLAF_WITH_MKL_LEGACY)
if(DLAF_WITH_MKL)
msimberg marked this conversation as resolved.
Show resolved Hide resolved
# When using MKL there is no need to set the number of threads with
# omp_set_num_threads; it's sufficient to use MKL's own mechanisms.
set(DLAF_WITH_OPENMP OFF CACHE BOOL "${DLAF_WITH_OPENMP_DESCRIPTION}" FORCE)
Expand Down Expand Up @@ -156,37 +159,6 @@ if(DLAF_WITH_MKL) # oneMKL
set(SCALAPACK_FOUND TRUE)
add_library(DLAF::SCALAPACK INTERFACE IMPORTED GLOBAL)
endif()
elseif(DLAF_WITH_MKL_LEGACY) # MKL (deprecated)
find_package(MKL MODULE REQUIRED)

set(MKL_LAPACK_TARGET "mkl::mkl_intel_32bit_seq_dyn"
CACHE STRING "MKL LAPACK target (see FindMKL for details)"
)

# Note:
# If specified targets are found, "standardize" them

if(TARGET ${MKL_LAPACK_TARGET})
set(LAPACK_FOUND TRUE)
add_library(DLAF::LAPACK INTERFACE IMPORTED GLOBAL)
target_link_libraries(DLAF::LAPACK INTERFACE ${MKL_LAPACK_TARGET})
else()
message(FATAL_ERROR "${MKL_LAPACK_TARGET} as LAPACK target has not been found")
endif()

if(DLAF_WITH_SCALAPACK)
set(MKL_SCALAPACK_TARGET "mkl::scalapack_intel_32bit_seq_dyn"
CACHE STRING "MKL ScaLAPACK target (see FindMKL for details)"
)

if(TARGET ${MKL_SCALAPACK_TARGET})
set(SCALAPACK_FOUND TRUE)
add_library(DLAF::SCALAPACK INTERFACE IMPORTED GLOBAL)
target_link_libraries(DLAF::SCALAPACK INTERFACE ${MKL_SCALAPACK_TARGET})
else()
message(FATAL_ERROR "${MKL_SCALAPACK_TARGET} as ScaLAPACK target has not been found")
endif()
endif()
else()
find_package(LAPACK REQUIRED)
if(DLAF_WITH_SCALAPACK)
Expand Down
28 changes: 14 additions & 14 deletions ci/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
include:
- local: 'ci/cpu/asan_ubsan_lsan.yml'
- local: 'ci/cpu/clang12_release.yml'
- local: 'ci/cpu/clang13_release_cxx20.yml'
- local: 'ci/cpu/clang14_release_stdexec.yml'
- local: 'ci/cpu/clang15_release.yml'
- local: 'ci/cpu/clang16_release.yml'
- local: 'ci/cpu/gcc11_codecov.yml'
- local: 'ci/cpu/gcc11_release.yml'
- local: 'ci/cpu/gcc11_release_stdexec.yml'
- local: 'ci/cpu/gcc11_debug_stdexec.yml'
- local: 'ci/cpu/gcc12_release_cxx20.yml'
# - local: 'ci/cpu/asan_ubsan_lsan.yml'
msimberg marked this conversation as resolved.
Show resolved Hide resolved
# - local: 'ci/cpu/clang12_release.yml'
# - local: 'ci/cpu/clang13_release_cxx20.yml'
# - local: 'ci/cpu/clang14_release_stdexec.yml'
# - local: 'ci/cpu/clang15_release.yml'
# - local: 'ci/cpu/clang16_release.yml'
# - local: 'ci/cpu/gcc11_codecov.yml'
# - local: 'ci/cpu/gcc11_release.yml'
# - local: 'ci/cpu/gcc11_release_stdexec.yml'
# - local: 'ci/cpu/gcc11_debug_stdexec.yml'
# - local: 'ci/cpu/gcc12_release_cxx20.yml'
- local: 'ci/cuda/gcc11_release.yml'
- local: 'ci/cuda/gcc11_release_scalapack.yml'
- local: 'ci/cuda/gcc11_codecov.yml'
- local: 'ci/cuda/gcc11_debug_scalapack.yml'
- local: 'ci/rocm/clang14_release.yml'
- local: 'ci/rocm/clang14_release_stdexec.yml'
# - local: 'ci/cuda/gcc11_debug_scalapack.yml'
# - local: 'ci/rocm/clang14_release.yml'
# - local: 'ci/rocm/clang14_release_stdexec.yml'
2 changes: 1 addition & 1 deletion ci/common-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stages:
reports:
dotenv: build.env
variables:
SPACK_SHA: dcc4423a9d0219a26ceeb52e329ed956e41f4d2c
SPACK_SHA: fd3c18b6fd7eda8abbb72ee81b39aa81b053d9bd
rasolca marked this conversation as resolved.
Show resolved Hide resolved
SPACK_DLAF_REPO: ./spack
DOCKER_BUILD_ARGS: '[
"BASE_IMAGE",
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get -yqq update && \
apt-get -yqq install --no-install-recommends \
software-properties-common \
build-essential gfortran \
autoconf automake ninja-build pkg-config \
autoconf automake libssl-dev ninja-build pkg-config \
msimberg marked this conversation as resolved.
Show resolved Hide resolved
${EXTRA_APTGET} \
gawk \
python3 python3-distutils \
Expand Down
Loading
Loading