- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
There are multiple errors reported:
SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
SYCL kernel cannot call a variadic function Code
#include <CL/sycl.hpp>
#include <mkl_dfti.h>
#include <iostream>
#include <complex>
#include <vector>
using namespace std;
using namespace sycl;
int main() {
complex<double> input[48] = { 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761 };
complex<double> output[48]; // Output for complex-to-complex DFT;
// Create queue and device selector
queue q(cpu_selector{});
// Allocate memory for input and output on the device
buffer<complex<double>, 1> input_buffer(input, range<1>(48));
buffer<complex<double>, 1> output_buffer(output, range<1>(48));
// Submit work to the queue for execution
q.submit([&](handler& h) {
// Get accessors to access data on the device
auto input_accessor = input_buffer.get_access<access::mode::read>(h);
auto output_accessor = output_buffer.get_access<access::mode::write>(h);
// Execute DFT in kernel
h.parallel_for(range<1>(1), [=](id<1> idx) {
// Call MKL DFT setup and compute in kernel
DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL; // Descriptor handle for complex-to-complex FFT;
MKL_LONG status; // Variable to store command execution status;
status = DftiCreateDescriptor(&my_desc_handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 48); // Create a descriptor;
status = DftiSetValue(my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE); // Set non-inplace operation;
status = DftiSetValue(my_desc_handle, DFTI_NUMBER_OF_TRANSFORMS, 1); // Set number of transforms to 1;
status = DftiCommitDescriptor(my_desc_handle); // Commit descriptor to make configuration effective;
status = DftiComputeForward(my_desc_handle, input_accessor.get_pointer(), output_accessor.get_pointer()); // Perform forward FFT;
status = DftiFreeDescriptor(&my_desc_handle); // Free descriptor;
});
});
// Wait for the queue to finish execution
q.wait();
// Output complex-to-complex FFT result
cout << "FFT result:" << "\n";
auto result = output_buffer.get_access<access::mode::read>();
for (int i = 0; i < 48; i++) {
cout << result[i] << "\n";
}
cout << "\n";
return 0;
}
링크가 복사됨
1 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
So far we don't have device APIs (can be called in SYCL kernels) for oneMKL DFT. Could you please provide more information about the usage and the motivation to use device APIs rather than host APIs?
Thanks.
