Skip to content

Commit

Permalink
[DFT][MKLGPU] Update mklgpu support to mkl preparing for oneapi 2025.…
Browse files Browse the repository at this point in the history
…0 release (#575)
  • Loading branch information
s-Nick authored Oct 11, 2024
1 parent 21229ee commit 9c31b7d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
12 changes: 9 additions & 3 deletions src/dft/backends/mklgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)

target_include_directories(${LIB_OBJ}
PRIVATE ${PROJECT_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/bin
Expand Down
7 changes: 6 additions & 1 deletion src/dft/backends/mklgpu/backward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <oneapi/mkl/dfti.hpp>
#else
#include <oneapi/mkl/dft.hpp>
#endif

namespace oneapi::mkl::dft::mklgpu {
namespace detail {
Expand Down
8 changes: 6 additions & 2 deletions src/dft/backends/mklgpu/commit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <oneapi/mkl/dfti.hpp>
#else
#include <oneapi/mkl/dft.hpp>
#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
Expand Down
7 changes: 6 additions & 1 deletion src/dft/backends/mklgpu/forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <oneapi/mkl/dfti.hpp>
#else
#include <oneapi/mkl/dft.hpp>
#endif

/**
Note that in this file, the Intel oneMKL-GPU library's interface mirrors the
Expand Down
10 changes: 6 additions & 4 deletions src/dft/backends/mklgpu/mklgpu_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <oneapi/mkl/dfti.hpp>
#else
#include <oneapi/mkl/dft.hpp>
#endif

namespace oneapi {
namespace mkl {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/dft/source/compute_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); \
} \
Expand Down

0 comments on commit 9c31b7d

Please sign in to comment.