Skip to content

Add a COMPILER_VERSION_2025_OR_LATER to be able to run dpnp with both 2024.2 and 2025.0 versions of the compiler/MKL #2025

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

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ else()
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "2025.0.0")
add_definitions(-DCOMPILER_VERSION_2025_OR_LATER=1)
else()
add_definitions(-DCOMPILER_VERSION_2025_OR_LATER=0)
endif()

include(GNUInstallDirs)

Expand Down
29 changes: 23 additions & 6 deletions dpnp/backend/extensions/fft/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ class DescriptorWrapper
const typename valT::value_type dim = get_dim();

valT fwd_strides(dim + 1);
#if COMPILER_VERSION_2025_OR_LATER
descr_.get_value(mkl_dft::config_param::FWD_STRIDES, &fwd_strides);
#else
descr_.get_value(mkl_dft::config_param::FWD_STRIDES,
fwd_strides.data());
#endif // COMPILER_VERSION_2025_OR_LATER
return fwd_strides;
}

Expand All @@ -126,6 +130,11 @@ class DescriptorWrapper
"Strides length does not match descriptor's dimension");
}
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides.data());
#if COMPILER_VERSION_2025_OR_LATER
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides);
#else
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides.data());
#endif // COMPILER_VERSION_2025_OR_LATER
}

// config_param::BWD_STRIDES
Expand All @@ -135,8 +144,12 @@ class DescriptorWrapper
const typename valT::value_type dim = get_dim();

valT bwd_strides(dim + 1);
#if COMPILER_COMPILER_VERSION_2025_OR_LATER
descr_.get_value(mkl_dft::config_param::BWD_STRIDES, &bwd_strides);
#else
descr_.get_value(mkl_dft::config_param::BWD_STRIDES,
bwd_strides.data());
#endif // COMPILER_VERSION_2025_OR_LATER
return bwd_strides;
}

Expand All @@ -149,7 +162,11 @@ class DescriptorWrapper
throw py::value_error(
"Strides length does not match descriptor's dimension");
}
#if COMPILER_VERSION_2025_OR_LATER
descr_.set_value(mkl_dft::config_param::BWD_STRIDES, strides);
#else
descr_.set_value(mkl_dft::config_param::BWD_STRIDES, strides.data());
#endif // COMPILER_VERSION_2025_OR_LATER
}

// config_param::FWD_DISTANCE
Expand Down Expand Up @@ -187,7 +204,7 @@ class DescriptorWrapper
// config_param::PLACEMENT
bool get_in_place()
{
#if defined(USE_ONEMKL_INTERFACES)
#if defined(USE_ONEMKL_INTERFACES) || COMPILER_VERSION_2025_OR_LATER
mkl_dft::config_value placement;
descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement);
return (placement == mkl_dft::config_value::INPLACE);
Expand All @@ -196,12 +213,12 @@ class DescriptorWrapper
DFTI_CONFIG_VALUE placement;
descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement);
return (placement == DFTI_CONFIG_VALUE::DFTI_INPLACE);
#endif // USE_ONEMKL_INTERFACES
#endif // USE_ONEMKL_INTERFACES or COMPILER_VERSION_2025_OR_LATER
}

void set_in_place(const bool &in_place_request)
{
#if defined(USE_ONEMKL_INTERFACES)
#if defined(USE_ONEMKL_INTERFACES) || COMPILER_VERSION_2025_OR_LATER
descr_.set_value(mkl_dft::config_param::PLACEMENT,
(in_place_request)
? mkl_dft::config_value::INPLACE
Expand All @@ -212,7 +229,7 @@ class DescriptorWrapper
(in_place_request)
? DFTI_CONFIG_VALUE::DFTI_INPLACE
: DFTI_CONFIG_VALUE::DFTI_NOT_INPLACE);
#endif // USE_ONEMKL_INTERFACES
#endif // USE_ONEMKL_INTERFACES or COMPILER_VERSION_2025_OR_LATER
}

// config_param::PRECISION
Expand All @@ -227,7 +244,7 @@ class DescriptorWrapper
// config_param::COMMIT_STATUS
bool is_committed()
{
#if defined(USE_ONEMKL_INTERFACES)
#if defined(USE_ONEMKL_INTERFACES) || COMPILER_VERSION_2025_OR_LATER
mkl_dft::config_value committed;
descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed);
return (committed == mkl_dft::config_value::COMMITTED);
Expand All @@ -236,7 +253,7 @@ class DescriptorWrapper
DFTI_CONFIG_VALUE committed;
descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed);
return (committed == DFTI_CONFIG_VALUE::DFTI_COMMITTED);
#endif // USE_ONEMKL_INTERFACES
#endif // USE_ONEMKL_INTERFACES or COMPILER_VERSION_2025_OR_LATER
}

private:
Expand Down
Loading