The Gaudi Framework  master (37c0b60a)
CUDAStream.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 2023-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 // Gaudi
14 
15 // CUDA
16 #ifndef __CUDACC__
17 # include <cuda_runtime.h>
18 #endif
19 
20 namespace Gaudi::CUDA {
21  class Stream {
22  private:
23  cudaStream_t m_stream;
26 
27  public:
30  ~Stream();
31 
33  inline operator cudaStream_t() { return m_stream; }
34 
36  inline const Gaudi::AsynchronousAlgorithm* parent() { return m_parent; }
37 
39  StatusCode await();
40 
43 
46  };
47 } // namespace Gaudi::CUDA
Gaudi::CUDA::Stream::removeDependency
void removeDependency()
INTERNAL: Remove a dependency.
Definition: CUDAStream.h:45
Gaudi::CUDA::Stream::parent
const Gaudi::AsynchronousAlgorithm * parent()
Access the parent algorithm.
Definition: CUDAStream.h:36
Gaudi::CUDA::Stream::m_parent
const Gaudi::AsynchronousAlgorithm * m_parent
Definition: CUDAStream.h:24
AsynchronousAlgorithm.h
StatusCode
Definition: StatusCode.h:65
Gaudi::CUDA::Stream::Stream
Stream(const Gaudi::AsynchronousAlgorithm *parent)
Create a new Stream. Should happen once per algorithm.
Definition: CUDAStream.cpp:77
Gaudi::CUDA::Stream
Definition: CUDAStream.h:21
Gaudi::CUDA::Stream::await
StatusCode await()
Yield fiber until stream is done.
Definition: CUDAStream.cpp:102
Gaudi::AsynchronousAlgorithm
Base class for asynchronous algorithms.
Definition: AsynchronousAlgorithm.h:34
Gaudi::CUDA::Stream::~Stream
~Stream()
Definition: CUDAStream.cpp:93
Gaudi::CUDA::Stream::m_dependents
int m_dependents
Definition: CUDAStream.h:25
Gaudi::CUDA
Definition: CUDAStream.h:20
Gaudi::CUDA::Stream::registerDependency
void registerDependency()
INTERNAL: Register a dependency.
Definition: CUDAStream.h:42
Gaudi::CUDA::Stream::m_stream
cudaStream_t m_stream
Definition: CUDAStream.h:23