ATLAS Offline Software
Loading...
Searching...
No Matches
KernelRunnerSvc.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2//
3// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4//
5#ifndef ATHCUDASERVICES_KERNELRUNNERSVC_H
6#define ATHCUDASERVICES_KERNELRUNNERSVC_H
7
8// Local include(s).
10
11// AthCUDA include(s).
14
15// Framework include(s).
16#include "GaudiKernel/ServiceHandle.h"
17#include "Gaudi/Property.h"
19
20// System include(s).
21#include <atomic>
22#include <memory>
23
24namespace AthCUDA {
25
33 class KernelRunnerSvc : public extends< AthService, IKernelRunnerSvc > {
34
35 public:
37 using extends::extends;
38
41
43 virtual StatusCode initialize() override;
44
46 virtual StatusCode finalize() override;
47
49
52
68 virtual StatusCode
69 execute( std::unique_ptr< IKernelTask > task ) override;
70
72
73 // Function telling the service that a task has finished its execution
74 void setTaskFinished();
75
76 private:
79
81 Gaudi::Property< int > m_nKernels{ this, "NParallelKernels", 2,
82 "The number of CUDA kernels to execute in parallel" };
83
86 "AthCUDA::StreamPoolSvc",
87 "The AthCUDA::StreamPoolSvc instance to use" };
88
90
92 std::atomic_int m_kernelsInFlight;
93
95 std::atomic_uint m_totalTasks;
97 std::atomic_uint m_gpuTasks;
98
100 std::unique_ptr< KernelRunnerSvcImpl > m_impl;
101
102 }; // class KernelRunnerSvc
103
104} // namespace AthCUDA
105
106#endif // ATHCUDASERVICES_KERNELRUNNERSVC_H
Service used for executing AthCUDA::IKernelTask tasks.
std::atomic_uint m_gpuTasks
The number of tasks sent to the GPU during the job.
std::atomic_uint m_totalTasks
The number of tasks executed during the job in total.
virtual StatusCode initialize() override
Initialise the service.
virtual StatusCode finalize() override
Finalise the service.
Gaudi::Property< int > m_nKernels
The number of streams to use.
ServiceHandle< IStreamPoolSvc > m_streamPoolSvc
Service managing CUDA the streams.
std::unique_ptr< KernelRunnerSvcImpl > m_impl
Implementation helper object.
virtual StatusCode execute(std::unique_ptr< IKernelTask > task) override
Execute a user specified kernel task.
std::atomic_int m_kernelsInFlight
The current number of kernels being executed.
Definition Info.h:14