From 9c31b7d589245f0c1c69931c43870c8747ac4e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Scipione?= Date: Fri, 11 Oct 2024 15:52:46 +0200 Subject: [PATCH] [DFT][MKLGPU] Update mklgpu support to mkl preparing for oneapi 2025.0 release (#575) --- src/dft/backends/mklgpu/CMakeLists.txt | 12 +++++++++--- src/dft/backends/mklgpu/backward.cpp | 7 ++++++- src/dft/backends/mklgpu/commit.cpp | 8 ++++++-- src/dft/backends/mklgpu/forward.cpp | 7 ++++++- src/dft/backends/mklgpu/mklgpu_helpers.hpp | 10 ++++++---- tests/unit_tests/dft/source/compute_tests.cpp | 3 ++- 6 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/dft/backends/mklgpu/CMakeLists.txt b/src/dft/backends/mklgpu/CMakeLists.txt index 7e88a23d9..8ec322de8 100644 --- a/src/dft/backends/mklgpu/CMakeLists.txt +++ b/src/dft/backends/mklgpu/CMakeLists.txt @@ -32,12 +32,18 @@ add_library(${LIB_OBJ} OBJECT ) add_dependencies(onemkl_backend_libs_dft ${LIB_NAME}) -target_include_directories(${LIB_OBJ} - PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS} -) target_include_directories(${LIB_NAME} PUBLIC ${ONEMKL_INTERFACE_INCLUDE_DIRS} ) + +# Due to using the same file name for different headers in this library and in +# the Intel(R) oneAPI Math Kernel Library, we force the compiler to follow C++ +# Core Guideline SF.12 using the flag "-iquote" to avoid conflicts and find the +# correct header. +target_compile_options(${LIB_OBJ} + BEFORE PRIVATE -iquote $ +) + target_include_directories(${LIB_OBJ} PRIVATE ${PROJECT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/bin diff --git a/src/dft/backends/mklgpu/backward.cpp b/src/dft/backends/mklgpu/backward.cpp index 6c4896c66..4899ed3e7 100644 --- a/src/dft/backends/mklgpu/backward.cpp +++ b/src/dft/backends/mklgpu/backward.cpp @@ -30,8 +30,13 @@ #include "mklgpu_helpers.hpp" +#include "mkl_version.h" // MKLGPU header -#include "oneapi/mkl/dfti.hpp" +#if INTEL_MKL_VERSION < 20250000 +#include +#else +#include +#endif namespace oneapi::mkl::dft::mklgpu { namespace detail { diff --git a/src/dft/backends/mklgpu/commit.cpp b/src/dft/backends/mklgpu/commit.cpp index d3a3f1cd6..bae1eb69f 100644 --- a/src/dft/backends/mklgpu/commit.cpp +++ b/src/dft/backends/mklgpu/commit.cpp @@ -35,11 +35,15 @@ #include "dft/backends/mklgpu/mklgpu_helpers.hpp" #include "../stride_helper.hpp" +#include "mkl_version.h" // MKLGPU header -#include "oneapi/mkl/dfti.hpp" +#if INTEL_MKL_VERSION < 20250000 +#include +#else +#include +#endif // MKL 2024.1 deprecates input/output strides. -#include "mkl_version.h" #if INTEL_MKL_VERSION < 20240001 #error MKLGPU requires oneMKL 2024.1 or later #endif diff --git a/src/dft/backends/mklgpu/forward.cpp b/src/dft/backends/mklgpu/forward.cpp index 39da42e45..9dbffa081 100644 --- a/src/dft/backends/mklgpu/forward.cpp +++ b/src/dft/backends/mklgpu/forward.cpp @@ -31,8 +31,13 @@ #include "mklgpu_helpers.hpp" +#include "mkl_version.h" // MKLGPU header -#include "oneapi/mkl/dfti.hpp" +#if INTEL_MKL_VERSION < 20250000 +#include +#else +#include +#endif /** Note that in this file, the Intel oneMKL-GPU library's interface mirrors the diff --git a/src/dft/backends/mklgpu/mklgpu_helpers.hpp b/src/dft/backends/mklgpu/mklgpu_helpers.hpp index 6813297ea..4b93d1423 100644 --- a/src/dft/backends/mklgpu/mklgpu_helpers.hpp +++ b/src/dft/backends/mklgpu/mklgpu_helpers.hpp @@ -23,8 +23,13 @@ #include "oneapi/mkl/detail/exceptions.hpp" #include "oneapi/mkl/dft/detail/types_impl.hpp" +#include "mkl_version.h" // MKLGPU header -#include "oneapi/mkl/dfti.hpp" +#if INTEL_MKL_VERSION < 20250000 +#include +#else +#include +#endif namespace oneapi { namespace mkl { @@ -64,13 +69,10 @@ inline constexpr dft::config_param to_mklgpu(dft::detail::config_param param) { case iparam::FORWARD_SCALE: return oparam::FORWARD_SCALE; case iparam::NUMBER_OF_TRANSFORMS: return oparam::NUMBER_OF_TRANSFORMS; case iparam::COMPLEX_STORAGE: return oparam::COMPLEX_STORAGE; - case iparam::REAL_STORAGE: return oparam::REAL_STORAGE; case iparam::CONJUGATE_EVEN_STORAGE: return oparam::CONJUGATE_EVEN_STORAGE; case iparam::FWD_DISTANCE: return oparam::FWD_DISTANCE; case iparam::BWD_DISTANCE: return oparam::BWD_DISTANCE; case iparam::WORKSPACE: return oparam::WORKSPACE; - case iparam::ORDERING: return oparam::ORDERING; - case iparam::TRANSPOSE: return oparam::TRANSPOSE; case iparam::PACKED_FORMAT: return oparam::PACKED_FORMAT; case iparam::WORKSPACE_PLACEMENT: return oparam::WORKSPACE; // Same as WORKSPACE case iparam::WORKSPACE_EXTERNAL_BYTES: return oparam::WORKSPACE_BYTES; diff --git a/tests/unit_tests/dft/source/compute_tests.cpp b/tests/unit_tests/dft/source/compute_tests.cpp index 005f833ef..7f737ef50 100644 --- a/tests/unit_tests/dft/source/compute_tests.cpp +++ b/tests/unit_tests/dft/source/compute_tests.cpp @@ -75,7 +75,8 @@ class ComputeTests_real_real_out_of_place_REAL } \ catch (std::exception & e) { \ std::string msg = e.what(); \ - if (msg.find("FFT_UNIMPLEMENTED") != std::string::npos) { \ + if ((msg.find("FFT_UNIMPLEMENTED") != std::string::npos) || \ + (msg.find("Unimplemented") != std::string::npos)) { \ std::cout << "Skipping test because: \"" << msg << "\"" << std::endl; \ GTEST_SKIP(); \ } \