Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
68a98b1
FFT_MKLCPU_staging + sync #261
anantsrivastava30 Feb 28, 2023
64cfbd1
fix real_real failures
anantsrivastava30 Mar 1, 2023
1150033
tests for CPU backend
anantsrivastava30 Mar 6, 2023
cb2655d
[DFT] fix rebase issues
anantsrivastava30 Mar 13, 2023
66a1aad
Merge branch 'develop' of https://github.com/oneapi-src/oneMKL into s…
anantsrivastava30 Mar 14, 2023
f09b61e
[DFT] address reviews
anantsrivastava30 Mar 14, 2023
9d08e22
address reviews
anantsrivastava30 Apr 2, 2023
9ca597a
sync w/ head
anantsrivastava30 Apr 3, 2023
04b0894
minor changes and error checks
anantsrivastava30 Apr 3, 2023
963670d
command group handles only the DftiCommitDescriptor
anantsrivastava30 Apr 5, 2023
27e8af5
move queue to pass by reference
anantsrivastava30 Apr 5, 2023
fbdf123
set the distance to true default
anantsrivastava30 Apr 11, 2023
08cdf26
fix testing issue with complex_complex
anantsrivastava30 Apr 11, 2023
36af25c
change real_real test to work for md, batch transforms
anantsrivastava30 Apr 12, 2023
1e725f2
adderssing minor comments
anantsrivastava30 Apr 13, 2023
2e14329
add error messages for ordering, transpose, workspace
anantsrivastava30 Apr 13, 2023
b56bf89
change error message from cpu to gpu
anantsrivastava30 Apr 14, 2023
9c560c4
move the desc_buffer to the commit class to avoid descructor invoke
anantsrivastava30 Apr 15, 2023
ae4ef45
refactor forward declared derived class
anantsrivastava30 Apr 15, 2023
7d8ab36
extend buffer lifetime for backward
anantsrivastava30 Apr 16, 2023
3c74bc3
add error messaging for compute
anantsrivastava30 Apr 16, 2023
f34cd13
clang-format
anantsrivastava30 Apr 16, 2023
c003254
address reviews
anantsrivastava30 Apr 17, 2023
40cabd8
patchfix for transform in/out distances to fwd/bwd
anantsrivastava30 Apr 19, 2023
113cb04
revert resetting dist in roundtrip
anantsrivastava30 Apr 19, 2023
eea2936
revert tests to match specs
anantsrivastava30 Apr 19, 2023
2da7ee6
clang-format
anantsrivastava30 Apr 19, 2023
06ee321
fix ct adding both backends to the linkline
anantsrivastava30 Apr 20, 2023
968c2cc
add line
anantsrivastava30 Apr 20, 2023
51bb1e8
FFT_MKLCPU_staging + sync #261
anantsrivastava30 Feb 28, 2023
464121a
fix real_real failures
anantsrivastava30 Mar 1, 2023
e97a40d
tests for CPU backend
anantsrivastava30 Mar 6, 2023
e3fb0b0
[DFT] fix rebase issues
anantsrivastava30 Mar 13, 2023
8c558ab
[DFT] address reviews
anantsrivastava30 Mar 14, 2023
e583b06
address reviews
anantsrivastava30 Apr 2, 2023
82a8ef8
minor changes and error checks
anantsrivastava30 Apr 3, 2023
cb619b2
command group handles only the DftiCommitDescriptor
anantsrivastava30 Apr 5, 2023
fb93b03
move queue to pass by reference
anantsrivastava30 Apr 5, 2023
4443718
set the distance to true default
anantsrivastava30 Apr 11, 2023
88fbaf7
fix testing issue with complex_complex
anantsrivastava30 Apr 11, 2023
d08713a
change real_real test to work for md, batch transforms
anantsrivastava30 Apr 12, 2023
8e42c85
adderssing minor comments
anantsrivastava30 Apr 13, 2023
822d7f6
add error messages for ordering, transpose, workspace
anantsrivastava30 Apr 13, 2023
19ba45d
change error message from cpu to gpu
anantsrivastava30 Apr 14, 2023
71472df
move the desc_buffer to the commit class to avoid descructor invoke
anantsrivastava30 Apr 15, 2023
27da795
refactor forward declared derived class
anantsrivastava30 Apr 15, 2023
5bfcab3
extend buffer lifetime for backward
anantsrivastava30 Apr 16, 2023
e0f5165
add error messaging for compute
anantsrivastava30 Apr 16, 2023
4313b42
clang-format
anantsrivastava30 Apr 16, 2023
735e843
address reviews
anantsrivastava30 Apr 17, 2023
5ac42ad
patchfix for transform in/out distances to fwd/bwd
anantsrivastava30 Apr 19, 2023
5bcb41c
revert resetting dist in roundtrip
anantsrivastava30 Apr 19, 2023
20f6913
revert tests to match specs
anantsrivastava30 Apr 19, 2023
859ff4b
clang-format
anantsrivastava30 Apr 19, 2023
b056587
fix ct adding both backends to the linkline
anantsrivastava30 Apr 20, 2023
728f6e2
add line
anantsrivastava30 Apr 20, 2023
8eb616f
Merge branch 'synced_mklcpu_backend' of https://github.com/anantsriva…
anantsrivastava30 Apr 20, 2023
86c1ec9
address reviews
anantsrivastava30 Apr 20, 2023
092ba93
move the derived class to its own file
anantsrivastava30 Apr 20, 2023
89edd4d
address warnings, and change buffer type
anantsrivastava30 Apr 20, 2023
0f0bac0
Update src/dft/backends/mklcpu/commit.cpp
anantsrivastava30 Apr 20, 2023
b690dad
resovle dynamic dispatch issue
anantsrivastava30 Apr 26, 2023
0463106
merge cmake for both device
anantsrivastava30 Apr 26, 2023
a118caf
remove bad file
anantsrivastava30 Apr 26, 2023
826bb63
removed old comment
anantsrivastava30 Apr 26, 2023
8f63032
Merge branch 'develop' into synced_mklcpu_backend
anantsrivastava30 Apr 27, 2023
ba3146d
clang-format
anantsrivastava30 Apr 28, 2023
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
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,14 @@ Supported domains: BLAS, LAPACK, RNG, DFT
<td align="center">LLVM*, hipSYCL</td>
</tr>
<tr>
<td rowspan=1 align="center">DFT</td>
<td rowspan=2 align="center">DFT</td>
<td align="center">Intel GPU</td>
<td rowspan=1 align="center">Intel(R) oneAPI Math Kernel Library</td>
<td rowspan=2 align="center">Intel(R) oneAPI Math Kernel Library</td>
<td align="center">Dynamic, Static</td>
<td align="center">DPC++</td>
</tr>
<tr>
<td align="center">x86 CPU</td>
<td align="center">Dynamic, Static</td>
<td align="center">DPC++</td>
</tr>
Expand Down
33 changes: 25 additions & 8 deletions examples/dft/compile_time_dispatching/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,45 @@

#Build object from all sources
set(DFTI_CT_SOURCES "")

if(ENABLE_MKLGPU_BACKEND)
list(APPEND DFTI_CT_SOURCES "complex_fwd_buffer_mklgpu")
endif()

if(ENABLE_MKLCPU_BACKEND)
list(APPEND DFTI_CT_SOURCES "complex_fwd_buffer_mklcpu")
endif()

include(WarningsUtils)

foreach(dfti_ct_sources ${DFTI_CT_SOURCES})
add_executable(example_${domain}_${dfti_ct_sources} ${dfti_ct_sources}.cpp)
# add executable and define include directories
# add dependencies and link libraries
# register example as ctest
add_executable(example_${domain}_${dfti_ct_sources} ${dfti_ct_sources}.cpp)
target_include_directories(example_${domain}_${dfti_ct_sources}
PUBLIC ${PROJECT_SOURCE_DIR}/examples/include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
)
if(domain STREQUAL "dft" AND ENABLE_MKLGPU_BACKEND)
add_dependencies(example_${domain}_${dfti_ct_sources} onemkl_${domain}_mklgpu)
list(APPEND ONEMKL_LIBRARIES_${domain} onemkl_${domain}_mklgpu)

set(ONEMKL_LIBRARIES_${domain} "")
if(domain STREQUAL "dft")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is domain ever not dft?
That applies to a lot of this file.
Otherwise it looks a lot better :)

if(dfti_ct_sources MATCHES "_mklcpu$")
add_dependencies(example_${domain}_${dfti_ct_sources} onemkl_${domain}_mklcpu)
list(APPEND ONEMKL_LIBRARIES_${domain} onemkl_${domain}_mklcpu)
endif()
if(dfti_ct_sources MATCHES "_mklgpu$")
add_dependencies(example_${domain}_${dfti_ct_sources} onemkl_${domain}_mklgpu)
list(APPEND ONEMKL_LIBRARIES_${domain} onemkl_${domain}_mklgpu)
endif()
endif()

target_link_libraries(example_${domain}_${dfti_ct_sources}
PUBLIC ${ONEMKL_LIBRARIES_${domain}}
PUBLIC ONEMKL::SYCL::SYCL
PRIVATE onemkl_warnings
${ONEMKL_LIBRARIES_${domain}}
ONEMKL::SYCL::SYCL
)
# Register example as ctest
add_test(NAME ${domain}/EXAMPLE/CT/${dfti_ct_sources} COMMAND example_${domain}_${dfti_ct_sources})
endforeach(dfti_ct_sources)
add_test(NAME ${domain}/EXAMPLE/CT/${dfti_ct_sources} COMMAND example_${domain}_${dfti_ct_sources})
endforeach(dfti_ct_sources)
132 changes: 132 additions & 0 deletions examples/dft/compile_time_dispatching/complex_fwd_buffer_mklcpu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*******************************************************************************
* Copyright 2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/

// STL includes
#include <iostream>

// oneMKL/SYCL includes
#if __has_include(<sycl/sycl.hpp>)
#include <sycl/sycl.hpp>
#else
#include <CL/sycl.hpp>
#endif
#include "oneapi/mkl.hpp"

void run_example(const sycl::device& cpu_device) {
constexpr int N = 10;

// Catch asynchronous exceptions for cpu
auto cpu_error_handler = [&](sycl::exception_list exceptions) {
for (auto const& e : exceptions) {
try {
std::rethrow_exception(e);
}
catch (sycl::exception const& e) {
// Handle not dft related exceptions that happened during asynchronous call
std::cerr << "Caught asynchronous SYCL exception:" << std::endl;
std::cerr << "\t" << e.what() << std::endl;
}
}
std::exit(2);
};

sycl::queue cpu_queue(cpu_device, cpu_error_handler);

std::vector<std::complex<double>> input_data(N);
std::vector<std::complex<double>> output_data(N);

// enabling
// 1. create descriptors
oneapi::mkl::dft::descriptor<oneapi::mkl::dft::precision::DOUBLE,
oneapi::mkl::dft::domain::COMPLEX>
desc(N);

// 2. variadic set_value
desc.set_value(oneapi::mkl::dft::config_param::PLACEMENT,
oneapi::mkl::dft::config_value::NOT_INPLACE);
desc.set_value(oneapi::mkl::dft::config_param::NUMBER_OF_TRANSFORMS,
static_cast<std::int64_t>(1));

// 3. commit_descriptor (compile_time MKLCPU)
desc.commit(oneapi::mkl::backend_selector<oneapi::mkl::backend::mklcpu>{ cpu_queue });

// 4. compute_forward / compute_backward (MKLCPU)
{
sycl::buffer<std::complex<double>> input_buffer(input_data.data(), sycl::range<1>(N));
sycl::buffer<std::complex<double>> output_buffer(output_data.data(), sycl::range<1>(N));
oneapi::mkl::dft::compute_forward<decltype(desc), std::complex<double>,
std::complex<double>>(desc, input_buffer, output_buffer);
}
}

//
// Description of example setup, apis used and supported floating point type precisions
//
void print_example_banner() {
std::cout << "\n"
"########################################################################\n"
"# Complex out-of-place forward transform for Buffer API's example:\n"
"#\n"
"# Using APIs:\n"
"# Compile-time dispatch API\n"
"# Buffer forward complex out-of-place\n"
"#\n"
"# Using double precision (double) data type\n"
"#\n"
"# For Intel CPU with Intel MKLCPU backend.\n"
"#\n"
"# The environment variable SYCL_DEVICE_FILTER can be used to specify\n"
"# SYCL device\n"
"########################################################################\n"
<< std::endl;
}

//
// Main entry point for example.
//
int main(int argc, char** argv) {
print_example_banner();

try {
sycl::device cpu_device((sycl::cpu_selector_v));
std::cout << "Running DFT Complex forward out-of-place buffer example" << std::endl;
std::cout << "Using compile-time dispatch API with MKLCPU." << std::endl;
std::cout << "Running with double precision real data type on:" << std::endl;
std::cout << "\tCPU device :" << cpu_device.get_info<sycl::info::device::name>()
<< std::endl;

run_example(cpu_device);
std::cout << "DFT Complex USM example ran OK on MKLCPU" << std::endl;
}
catch (sycl::exception const& e) {
// Handle not dft related exceptions that happened during synchronous call
std::cerr << "Caught synchronous SYCL exception:" << std::endl;
std::cerr << "\t" << e.what() << std::endl;
std::cerr << "\tSYCL error code: " << e.code().value() << std::endl;
return 1;
}
catch (std::exception const& e) {
// Handle not SYCL related exceptions that happened during synchronous call
std::cerr << "Caught synchronous std::exception:" << std::endl;
std::cerr << "\t" << e.what() << std::endl;
return 1;
}

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
void run_example(const sycl::device& gpu_device) {
constexpr std::size_t N = 10;

// Catch asynchronous exceptions for cpu
// Catch asynchronous exceptions for gpu
auto gpu_error_handler = [&](sycl::exception_list exceptions) {
for (auto const& e : exceptions) {
try {
Expand Down Expand Up @@ -92,7 +92,7 @@ void print_example_banner() {
"# For Intel GPU with Intel MKLGPU backend.\n"
"#\n"
"# The environment variable SYCL_DEVICE_FILTER can be used to specify\n"
"#SYCL device\n"
"# SYCL device\n"
"########################################################################\n"
<< std::endl;
}
Expand Down
2 changes: 0 additions & 2 deletions include/oneapi/mkl/dft/detail/types_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace detail {

typedef long DFT_ERROR;

#define DFT_NOTSET -1

enum class precision { SINGLE, DOUBLE };

template <precision prec>
Expand Down
2 changes: 1 addition & 1 deletion src/dft/backends/mklcpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ target_include_directories(${LIB_OBJ}
${MKL_INCLUDE}
)

target_compile_options(${LIB_OBJ} PRIVATE ${ONEMKL_BUILD_COPT} ${MKL_COPT} -DBUILD_COMP)
target_compile_options(${LIB_OBJ} PRIVATE ${ONEMKL_BUILD_COPT} ${MKL_COPT})
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET ${LIB_OBJ} SOURCES ${SOURCES})
endif()
Expand Down
Loading