Compute Functions#
This page describes the function templates oneapi::mkl::experimental::dft::compute_forward and oneapi::mkl::experimental::dft::compute_backward, which both pertain to the calculation of a distributed DFT defined by a committed oneapi::mkl::experimental::dft::distributed_descriptor object desc. These function templates belong to the oneapi::mkl::experimental::dft namespace and are declared in oneapi/mkl/experimental/distributed_dft.hpp (file to be included).
The usage of prepended namespace specifier oneapi::mkl::experimental::dft is omitted below for conciseness while the namespace specifier oneapi::mkl::dft is kept for clarity.
namespace oneapi::mkl::experimental::dft {
/*----------------------- for in-place transforms -----------------------*/
template <typename descriptor_type, typename data_type>
sycl::event compute_forward(descriptor_type &desc,
data_type *inout,
const std::vector<sycl::event> &dependencies = {});
template <typename descriptor_type, typename data_type>
sycl::event compute_backward(descriptor_type &desc,
data_type *inout,
const std::vector<sycl::event> &dependencies = {});
/*--------------------- for out-of-place transforms ---------------------*/
template<typename descriptor_type, typename input_type, typename output_type>
sycl::event compute_forward(descriptor_type &desc,
input_type *in,
output_type *out,
const std::vector<sycl::event> &dependencies = {});
template<typename descriptor_type, typename input_type, typename output_type>
sycl::event compute_backward(descriptor_type &desc,
input_type *in,
output_type *out,
const std::vector<sycl::event> &dependencies = {});
}
Description#
The compute_forward (resp. compute_backward) function templates accept a committed distributed_descriptor object desc followed by one or more data-containing arguments, and enqueue the computation of the forward (resp. backward) DFT that desc defines, i.e., the transform defined by \(\delta = -1\) (resp. \(\delta = +1\)). The computations are added to the queue to which desc was committed. Each process takes in the local chunk of the input, computes DFT on the data it is provided, exchanges the intermediate results using MPI, and provides the final local output chunk. Refer to data distribution on how the local input/output data is distributed across the processes.
Successive global computations require the distributed_descriptor objects across the processes be serialized to guarantee correct results. This can be done by waiting on the queue passed at commit, or by using an in-order queue. Alternatively, computations can be serialized using the returned syc::event and input dependencies.
The number of data-containing arguments to be provided depends exclusively on whether the desired DFT calculations are to be done in-place (output data overwriting the input data) or out-of-place (output data stored separately from the input data). One data-containing argument is required for in-place operations whereas two such arguments are needed for out-of-place calculations. Note that in-place operations require the global data layout to satisfy requirements documented in the page dedicated to configuring data layouts.
Warning
When using a function designed for in-place (resp. out-of-place) operations,
desc(function’s first argument) must have a configuration value ofoneapi::mkl::dft::config_value::INPLACE(resp.oneapi::mkl::dft::config_value::NOT_INPLACE) associated withoneapi::mkl::dft::config_param::PLACEMENT. And all the processes should be configured uniformly. The function’s behavior is undefined otherwise.When using a function designed for out-of-place operations,
inandoutmust not share common elements.The sizes of the
inandoutmust be greater than or equal to the queried sizes after commit.
Template parameters#
For in-place operations#
The compute_forward and compute_backward function templates for in-place operations are parameterized by two type template parameters, in the following order:
descriptor_typerepresenting the type ofdesc, an instance of a specialization of the descriptor class template;data_typerepresenting the elementary data type of the data-containing argument being used.
The available specializations are listed in the table below.
function template |
|
|
|---|---|---|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
compute_forwardcompute_backward |
|
|
For out-of-place operations#
The compute_forward and compute_backward function templates for out-of-place operations are parameterized by three type template parameters, in the following order:
descriptor_typerepresenting the type ofdesc, an instance of a specialization of the descriptor class template;input_typerepresenting the elementary data type of the first (input) data-containing argument being used;output_typerepresenting the elementary data type of the second (output) data-containing argument being used.
The available specializations are listed in the table below.
function template |
|
|
|
|---|---|---|---|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
|
|
|
|
|
|
|
|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
compute_forwardcompute_backward |
|
|
|
|
|
|
|
|
|
|
|
Input parameters and returned value#
The compute_forward and compute_backward template functions’ input parameters are documented below. These functions return a sycl::event object that can be used to track the completion of the computations that the function call enqueues.
For in-place operations#
Name |
Supported types |
Description |
|---|---|---|
|
|
Committed instance of a specialization of the distributed_descriptor class template, defining the global DFT to compute |
|
data_type* |
Data-containing argument for the DFT (local input data on input, local output results on output) |
|
|
Vector of dependencies to be honored by the enqueued DFT computation
|
For out-of-place operations#
Name |
Supported types |
Description |
|---|---|---|
|
|
Committed instance of a specialization of the descriptor class template, defining the DFT to compute |
|
input_type* |
Data-containing argument for the local input data of the DFT |
|
output_type* |
Data-containing argument for the local output data of the DFT |
|
|
Vector of dependencies to be honored by the enqueued DFT computation
|
Exceptions#
The compute_forward and compute_backward template functions may throw an oneapi::mkl::exception in the following cases:
an issue is found with
desc.descis uncommitted.a failure is detected when computing the DFT.
an MPI issues is detected when computing the DFT.
Note
The distributed DFT interface does not support SYCL buffers.