ATLAS Offline Software
Public Types | Public Member Functions | List of all members
AthCUDA::IKernelTask Class Referenceabstract

Abstract interface for setting up / running a CUDA task. More...

#include <IKernelTask.h>

Collaboration diagram for AthCUDA::IKernelTask:

Public Types

enum  KernelExecMode { Synchronous = 0, Asynchronous = 1 }
 Possible modes in which the kernel was executed. More...
 

Public Member Functions

virtual ~IKernelTask ()=default
 Virtual destructor, to make vtable happy. More...
 
virtual int execute (StreamHolder &stream)=0
 Execute the kernel using a specific stream. More...
 
virtual int finished (int code, KernelExecMode mode)=0
 Function called when an asynchronous execution finishes. More...
 

Detailed Description

Abstract interface for setting up / running a CUDA task.

The expectation is that the implementation of such a task would either schedule itself to CUDA for execution, or if no GPU is available (at the time), would execute its calculation on the CPU instead.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 22 of file IKernelTask.h.

Member Enumeration Documentation

◆ KernelExecMode

Possible modes in which the kernel was executed.

Enumerator
Synchronous 

The kernel was executed synchronously on the CPU.

Asynchronous 

The kernel was executed asynchronously on a CUDA device.

Definition at line 29 of file IKernelTask.h.

29  {
31  Synchronous = 0,
33  Asynchronous = 1
34  };

Constructor & Destructor Documentation

◆ ~IKernelTask()

virtual AthCUDA::IKernelTask::~IKernelTask ( )
virtualdefault

Virtual destructor, to make vtable happy.

Member Function Documentation

◆ execute()

virtual int AthCUDA::IKernelTask::execute ( StreamHolder stream)
pure virtual

Execute the kernel using a specific stream.

If the stream is "invalid", the task needs to be executed in the current thread on the CPU instead.

Parameters
streamThe stream to use in the task execution
Returns
0 if the call succeeded, something else otherwise

◆ finished()

virtual int AthCUDA::IKernelTask::finished ( int  code,
KernelExecMode  mode 
)
pure virtual

Function called when an asynchronous execution finishes.

This function is set up to be called automatically when the task's execution is offloaded to a GPU, and that execution has finished. It can be used to notify some listener about the finish of the task.

Parameters
codeA code representing the "successfulness" of the asynchronous task
modeThe mode in which the kernel was executed
Returns
0 if the call succeeded, something else otherwise

The documentation for this class was generated from the following file:
AthCUDA::IKernelTask::Synchronous
@ Synchronous
The kernel was executed synchronously on the CPU.
Definition: IKernelTask.h:31
AthCUDA::IKernelTask::Asynchronous
@ Asynchronous
The kernel was executed asynchronously on a CUDA device.
Definition: IKernelTask.h:33