ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
AthCUDA::KernelStatus Class Reference

Helper object used for synchronising GPU kernel tasks. More...

#include <KernelStatus.h>

Collaboration diagram for AthCUDA::KernelStatus:

Public Member Functions

 KernelStatus ()
 Default constructor. More...
 
void finished (int code)
 Function called by "the framework" when the CUDA kernel finished. More...
 
int wait ()
 Wait for the execution of the kernel to finish. More...
 

Private Attributes

int m_code
 The result of the kernel execution. More...
 
std::mutex m_mutex
 Mutex used for waiting for the CUDA task to finish. More...
 

Detailed Description

Helper object used for synchronising GPU kernel tasks.

It is meant to be used as a mixture of std::future and StatusCode. Client code can use it to wait for the (asynchronous) execution of a GPU calculation.

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 21 of file KernelStatus.h.

Constructor & Destructor Documentation

◆ KernelStatus()

AthCUDA::KernelStatus::KernelStatus ( )

Default constructor.

Definition at line 10 of file KernelStatus.cxx.

11  : m_code( 0 ), m_mutex() {
12 
13  m_mutex.lock();
14  }

Member Function Documentation

◆ finished()

void AthCUDA::KernelStatus::finished ( int  code)

Function called by "the framework" when the CUDA kernel finished.

Definition at line 16 of file KernelStatus.cxx.

16  {
17 
18  m_code = code;
19  m_mutex.unlock();
20  return;
21  }

◆ wait()

int AthCUDA::KernelStatus::wait ( )

Wait for the execution of the kernel to finish.

Definition at line 23 of file KernelStatus.cxx.

23  {
24 
25  // Wait for the task to finish.
26  std::lock_guard< std::mutex > lock( m_mutex );
27  // Return the final status code of the kernel.
28  return m_code;;
29  }

Member Data Documentation

◆ m_code

int AthCUDA::KernelStatus::m_code
private

The result of the kernel execution.

Definition at line 35 of file KernelStatus.h.

◆ m_mutex

std::mutex AthCUDA::KernelStatus::m_mutex
private

Mutex used for waiting for the CUDA task to finish.

Definition at line 37 of file KernelStatus.h.


The documentation for this class was generated from the following files:
AthCUDA::KernelStatus::m_code
int m_code
The result of the kernel execution.
Definition: KernelStatus.h:35
pmontree.code
code
Definition: pmontree.py:443
AthCUDA::KernelStatus::m_mutex
std::mutex m_mutex
Mutex used for waiting for the CUDA task to finish.
Definition: KernelStatus.h:37