imate
C++/CUDA Reference
DeviceProperties Class Reference

Properties of GPU devices. More...

#include <device_properties.h>

Public Member Functions

 DeviceProperties ()
 Constructor. More...
 
 ~DeviceProperties ()
 Destructor. More...
 
void deallocate_members ()
 Deallocates the member data. More...
 
void set_num_devices (int num_devices_)
 Sets the number of devices and allocates memory for member data with the size of devices. More...
 

Public Attributes

int num_devices
 
int * num_multiprocessors
 
int * num_threads_per_multiprocessor
 

Detailed Description

Properties of GPU devices.

Definition at line 23 of file device_properties.h.

Constructor & Destructor Documentation

◆ DeviceProperties()

DeviceProperties::DeviceProperties ( )

Constructor.

Definition at line 27 of file device_properties.cu.

27  :
28  num_devices(0),
29  num_multiprocessors(NULL),
31 {
32 }
int * num_threads_per_multiprocessor

◆ ~DeviceProperties()

DeviceProperties::~DeviceProperties ( )

Destructor.

Definition at line 42 of file device_properties.cu.

43 {
44  this->deallocate_members();
45 }
void deallocate_members()
Deallocates the member data.

References deallocate_members().

Here is the call graph for this function:

Member Function Documentation

◆ deallocate_members()

void DeviceProperties::deallocate_members ( )

Deallocates the member data.

Definition at line 55 of file device_properties.cu.

56 {
57  if (this->num_multiprocessors != NULL)
58  {
59  delete[] this->num_multiprocessors;
60  this->num_multiprocessors = NULL;
61  }
62 
63  if (this->num_threads_per_multiprocessor != NULL)
64  {
65  delete[] this->num_threads_per_multiprocessor;
66  this->num_threads_per_multiprocessor = NULL;
67  }
68 }

References num_multiprocessors, and num_threads_per_multiprocessor.

Referenced by set_num_devices(), and ~DeviceProperties().

Here is the caller graph for this function:

◆ set_num_devices()

void DeviceProperties::set_num_devices ( int  num_devices_)

Sets the number of devices and allocates memory for member data with the size of devices.

Parameters
[in]num_devices_Number of gpu devices.

Definition at line 81 of file device_properties.cu.

82 {
83  this->num_devices = num_devices_;
84 
85  // Deallocate members in case they were allocated before
86  this->deallocate_members();
87 
88  // Allocate members
89  this->num_multiprocessors = new int[this->num_devices];
90  this->num_threads_per_multiprocessor = new int[this->num_devices];
91 }

References deallocate_members(), num_devices, num_multiprocessors, and num_threads_per_multiprocessor.

Referenced by query_device().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ num_devices

int DeviceProperties::num_devices

Definition at line 32 of file device_properties.h.

Referenced by set_num_devices().

◆ num_multiprocessors

int* DeviceProperties::num_multiprocessors

Definition at line 33 of file device_properties.h.

Referenced by deallocate_members(), query_device(), and set_num_devices().

◆ num_threads_per_multiprocessor

int* DeviceProperties::num_threads_per_multiprocessor

Definition at line 34 of file device_properties.h.

Referenced by deallocate_members(), query_device(), and set_num_devices().


The documentation for this class was generated from the following files: