STORMM Source Documentation
Loading...
Searching...
No Matches
gpu_details.h
1// -*-c++-*-
2#ifndef STORMM_HPC_STATUS
3#define STORMM_HPC_STATUS
4
5#include <vector>
6#include <string>
7#ifdef STORMM_USE_HPC
8# ifdef STORMM_USE_CUDA
9# include <cuda_runtime.h>
10# endif
11#endif
12#include "copyright.h"
13#include "Constants/scaling.h"
14
15namespace stormm {
16namespace card {
17
22constexpr long long int significant_gpu_memory = constants::mega;
24
28public:
29
36 GpuDetails();
37#ifdef STORMM_USE_HPC
38# ifdef STORMM_USE_CUDA
39 GpuDetails(const cudaDeviceProp &devprop, int dev_index);
40# endif
41#endif
43
45 bool getAvailability() const;
46
48 bool getGpuSupported() const;
49
51 int getArchMajor() const;
52
54 int getArchMinor() const;
55
57 int getSMPCount() const;
58
61 int getCardRam() const;
62
64 int getMaxThreadsPerBlock() const;
65
67 int getMaxThreadsPerSMP() const;
68
70 int getMaxBlocksPerSMP() const;
71
73 int getMaxSharedPerBlock() const;
74
76 int getMaxSharedPerSMP() const;
77
79 int getGlobalCacheSize() const;
80
82 int getRegistersPerBlock() const;
83
85 int getRegistersPerSMP() const;
86
88 std::string getCardName() const;
89
94 void setSMPCount(int smp_count_in);
95
100 bool operator==(const GpuDetails &right) const;
101 bool operator!=(const GpuDetails &right) const;
103
104private:
105 bool available;
106 bool supported;
107 int arch_major;
108 int arch_minor;
109 int smp_count;
110 int card_ram;
111 int max_threads_per_block;
112 int max_threads_per_smp;
113 int max_blocks_per_smp;
114 int max_shared_per_block;
115 int max_shared_per_smp;
116 int global_cache_size;
117 int registers_per_block;
118 int registers_per_smp;
119 std::string card_name;
120};
121
122} // namespace card
123} // namespace stormm
124
129extern stormm::card::GpuDetails null_gpu;
130
131#endif
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
int getMaxBlocksPerSMP() const
Get the maximum number of blocks per streaming multiprocessor on this GPU.
Definition gpu_details.cpp:64
int getMaxSharedPerBlock() const
Get the maximum amount of L1 shared memory per block on this GPU.
Definition gpu_details.cpp:69
int getRegistersPerSMP() const
Get the maximum number of registers available per streaming multiprocessor on this GPU.
Definition gpu_details.cpp:89
int getArchMajor() const
Get the major architectural number of the GPU.
Definition gpu_details.cpp:34
bool operator==(const GpuDetails &right) const
Overload the == and != operators to compare GpuDetails objects.
Definition gpu_details.cpp:104
int getMaxThreadsPerSMP() const
Get the maximum number of threads per streaming multiprocessor on this GPU.
Definition gpu_details.cpp:59
int getArchMinor() const
Get the minor architectural number of the GPU.
Definition gpu_details.cpp:39
bool getGpuSupported() const
Get whether the architecture of the GPU is supported.
Definition gpu_details.cpp:29
int getMaxThreadsPerBlock() const
Get the maximum number of threads per block supported by this GPU.
Definition gpu_details.cpp:54
int getGlobalCacheSize() const
Get the total amount of global cache (L2) on the card, in bytes.
Definition gpu_details.cpp:79
void setSMPCount(int smp_count_in)
Set the number of streaming multiprocessors. This is useful for experimentation in mock settings,...
Definition gpu_details.cpp:99
int getRegistersPerBlock() const
Get the maximum number of registers available per block on this GPU.
Definition gpu_details.cpp:84
GpuDetails()
Constructors include a blank constructor (which automatically labels the GPU as unavailable) and cons...
Definition gpu_details.cpp:15
std::string getCardName() const
Get the name of the GPU.
Definition gpu_details.cpp:94
int getCardRam() const
Get the amount of RAM on the GPU, in megabytes (assuming that all of the device RAM is available for ...
Definition gpu_details.cpp:49
int getSMPCount() const
Get the number of streaming multiprocessors on the GPU.
Definition gpu_details.cpp:44
bool getAvailability() const
Get the availability of the GPU.
Definition gpu_details.cpp:24
int getMaxSharedPerSMP() const
Get the available L1 shared memory per streaming multiprocessor on this GPU.
Definition gpu_details.cpp:74