ATLAS Offline Software
Loading...
Searching...
No Matches
Info.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2//
3// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4//
5#ifndef ATHCUDACORE_INFO_H
6#define ATHCUDACORE_INFO_H
7
8// System include(s).
9#include <cstddef>
10#include <iosfwd>
11#include <string>
12#include <vector>
13
14namespace AthCUDA {
15
24 class Info {
25
26 public:
28 static const Info& instance();
29
31 int nDevices() const;
32
34 const std::vector< std::string >& names() const;
36 const std::vector< int >& maxThreadsPerBlock() const;
38 const std::vector< bool >& concurrentKernels() const;
40 const std::vector< std::size_t >& totalMemory() const;
41
43 void print() const;
44
45 private:
48
50 int m_nDevices = 0;
52 std::vector< std::string > m_names;
54 std::vector< int > m_maxThreadsPerBlock;
56 std::vector< bool > m_concurrentKernels;
58 std::vector< std::size_t > m_totalMemory;
59
60 }; // class Info
61
63 std::ostream& operator<< ( std::ostream& out, const AthCUDA::Info& info );
64
65} // namespace AthCUDA
66
67#endif // ATHCUDACORE_INFO_H
Class providing information about the CUDA devices at runtime.
Definition Info.h:24
int nDevices() const
Get the number of available devices.
std::vector< int > m_maxThreadsPerBlock
The maximum number of threads per block for each available device.
Definition Info.h:54
const std::vector< std::size_t > & totalMemory() const
Get the total amount of memory for all devices.
int m_nDevices
The number of CUDA devices available at runtime.
Definition Info.h:50
Info()
The constructor is private to implement the singleton behaviour.
std::vector< std::string > m_names
The names of all available devices.
Definition Info.h:52
std::vector< std::size_t > m_totalMemory
The total amount of memory for all devices.
Definition Info.h:58
static const Info & instance()
Singleton accessor function.
void print() const
Print the properties of all detected devices.
std::vector< bool > m_concurrentKernels
The multi-kernel capabilities of all devices.
Definition Info.h:56
const std::vector< int > & maxThreadsPerBlock() const
Get the maximum number of threads per execution block on all devices.
const std::vector< std::string > & names() const
Get the names of all of the devices.
const std::vector< bool > & concurrentKernels() const
Get the multi-kernel capabilities of all devices.
Definition Info.h:14
std::ostream & operator<<(std::ostream &out, const AthCUDA::Info &info)
Print operator for AthCUDA::Info.