Ginkgo  Generated from pipelines/207021245 branch based on develop. Ginkgo version 1.3.0
A numerical linear algebra library targeting many-core architectures
Modules | Classes | Macros
Executors

A module dedicated to the implementation and usage of the executors in Ginkgo. More...

Collaboration diagram for Executors:

Modules

 CUDA Executor
 A module dedicated to the implementation and usage of the CUDA executor in Ginkgo.
 
 HIP Executor
 A module dedicated to the implementation and usage of the HIP executor in Ginkgo.
 
 OpenMP Executor
 A module dedicated to the implementation and usage of the OpenMP executor in Ginkgo.
 
 Reference Executor
 A module dedicated to the implementation and usage of the Reference executor in Ginkgo.
 

Classes

class  gko::Operation
 Operations can be used to define functionalities whose implementations differ among devices. More...
 
class  gko::Executor
 The first step in using the Ginkgo library consists of creating an executor. More...
 
class  gko::executor_deleter< T >
 This is a deleter that uses an executor's free method to deallocate the data. More...
 
class  gko::OmpExecutor
 This is the Executor subclass which represents the OpenMP device (typically CPU). More...
 
class  gko::ReferenceExecutor
 This is a specialization of the OmpExecutor, which runs the reference implementations of the kernels used for debugging purposes. More...
 
class  gko::CudaExecutor
 This is the Executor subclass which represents the CUDA device. More...
 
class  gko::HipExecutor
 This is the Executor subclass which represents the HIP enhanced device. More...
 

Macros

#define GKO_REGISTER_OPERATION(_name, _kernel)
 Binds a set of device-specific kernels to an Operation. More...
 

Detailed Description

A module dedicated to the implementation and usage of the executors in Ginkgo.

Below, we provide a brief introduction to executors in Ginkgo, how they have been implemented, how to best make use of them and how to add new executors.

Executors in Ginkgo.

The first step in using the Ginkgo library consists of creating an executor. Executors are used to specify the location for the data of linear algebra objects, and to determine where the operations will be executed. Ginkgo currently supports three different executor types:

Macro Definition Documentation

◆ GKO_REGISTER_OPERATION

#define GKO_REGISTER_OPERATION (   _name,
  _kernel 
)

Binds a set of device-specific kernels to an Operation.

It also defines a helper function which creates the associated operation. Any input arguments passed to the helper function are forwarded to the kernel when the operation is executed.

The kernels used to bind the operation are searched in kernels::DEV_TYPE namespace, where DEV_TYPE is replaced by omp, cuda, hip and reference.

Parameters
_nameoperation name
_kernelkernel which will be bound to the operation

Example

{c++}
// define the omp, cuda, hip and reference kernels which will be bound to the
// operation
namespace kernels {
namespace omp {
void my_kernel(int x) {
// omp code
}
}
namespace cuda {
void my_kernel(int x) {
// cuda code
}
}
namespace hip {
void my_kernel(int x) {
// hip code
}
}
namespace reference {
void my_kernel(int x) {
// reference code
}
}
// Bind the kernels to the operation
GKO_REGISTER_OPERATION(my_op, my_kernel);
int main() {
// create executors
auto omp = OmpExecutor::create();
auto cuda = CudaExecutor::create(omp, 0);
auto hip = HipExecutor::create(omp, 0);
auto ref = ReferenceExecutor::create();
// create the operation
auto op = make_my_op(5); // x = 5
omp->run(op); // run omp kernel
cuda->run(op); // run cuda kernel
hip->run(op); // run hip kernel
ref->run(op); // run reference kernel
}
GKO_REGISTER_OPERATION
#define GKO_REGISTER_OPERATION(_name, _kernel)
Binds a set of device-specific kernels to an Operation.
Definition: executor.hpp:309