COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
CarmaContext Class Reference

this class provides the context in which CarmaObj are created More...

#include <carma_context.h>

Collaboration diagram for CarmaContext:

Public Member Functions

 ~CarmaContext ()
 
int get_ndevice ()
 
CarmaDeviceget_device (int dev)
 
int get_active_device ()
 
int get_active_real_device ()
 
int get_cuda_runtime_get_version ()
 
int get_cuda_driver_get_version ()
 
std::string get_device_name (int device)
 
std::string get_device_info (int device)
 
std::string get_device_mem_info (int device)
 
int _set_active_device_for_copy (int new_device, int silent, std::string file, int line)
 
int _set_active_device (int new_device, int silent, std::string file, int line)
 
int _set_active_device_force (int new_device, int silent, std::string file, int line)
 
int get_max_gflops_device_id ()
 
cublasHandle_t get_cublas_handle ()
 
cusparseHandle_t get_cusparse_handle ()
 
cublasHandle_t get_cublas_handle (int device)
 
cusparseHandle_t get_cusparse_handle (int device)
 
bool can_p2p (int dev1, int dev2)
 
std::string magma_info ()
 

Static Public Member Functions

static CarmaContextinstance_1gpu (int num_device)
 
static CarmaContextinstance_ngpu (int nb_devices, int32_t *devices_id)
 
static CarmaContextinstance ()
 

Detailed Description

this class provides the context in which CarmaObj are created

Author
COMPASS Team https://github.com/ANR-COMPASS
Version
5.0.0
Date
2011/01/28

Definition at line 104 of file carma_context.h.

Constructor & Destructor Documentation

◆ ~CarmaContext()

CarmaContext::~CarmaContext ( )

Member Function Documentation

◆ _set_active_device()

int CarmaContext::_set_active_device ( int  new_device,
int  silent,
std::string  file,
int  line 
)

Definition at line 159 of file carma_context.h.

160  {
161  return (this->active_device != new_device)
162  ? _set_active_device_force(new_device, silent, file, line)
163  : active_device;
164  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _set_active_device_for_copy()

int CarmaContext::_set_active_device_for_copy ( int  new_device,
int  silent,
std::string  file,
int  line 
)

Definition at line 152 of file carma_context.h.

153  {
154  if (new_device > ndevice) return -1;
155  return (can_access_peer[active_device][new_device] != 1)
156  ? _set_active_device(new_device, silent, file, line)
157  : active_device;
158  }
Here is the call graph for this function:

◆ _set_active_device_force()

int CarmaContext::_set_active_device_force ( int  new_device,
int  silent,
std::string  file,
int  line 
)
Here is the caller graph for this function:

◆ can_p2p()

bool CarmaContext::can_p2p ( int  dev1,
int  dev2 
)

Definition at line 179 of file carma_context.h.

179 { return can_access_peer[dev1][dev2]; }

◆ get_active_device()

int CarmaContext::get_active_device ( )

Definition at line 133 of file carma_context.h.

133 { return active_device; }

◆ get_active_real_device()

int CarmaContext::get_active_real_device ( )

Definition at line 134 of file carma_context.h.

134 { return devices[active_device]->get_id(); }

◆ get_cublas_handle() [1/2]

cublasHandle_t CarmaContext::get_cublas_handle ( )

Definition at line 168 of file carma_context.h.

168 { return get_cublas_handle(active_device); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cublas_handle() [2/2]

cublasHandle_t CarmaContext::get_cublas_handle ( int  device)

Definition at line 173 of file carma_context.h.

173  {
174  return devices[device]->get_cublas_handle();
175  }

◆ get_cuda_driver_get_version()

int CarmaContext::get_cuda_driver_get_version ( )

Definition at line 142 of file carma_context.h.

142  {
143  int driver_version;
144  carma_safe_call(cudaRuntimeGetVersion(&driver_version));
145  return driver_version;
146  }

◆ get_cuda_runtime_get_version()

int CarmaContext::get_cuda_runtime_get_version ( )

Definition at line 136 of file carma_context.h.

136  {
137  int runtime_version;
138  carma_safe_call(cudaRuntimeGetVersion(&runtime_version));
139  return runtime_version;
140  }

◆ get_cusparse_handle() [1/2]

cusparseHandle_t CarmaContext::get_cusparse_handle ( )

Definition at line 169 of file carma_context.h.

169  {
170  return get_cusparse_handle(active_device);
171  }
Here is the caller graph for this function:

◆ get_cusparse_handle() [2/2]

cusparseHandle_t CarmaContext::get_cusparse_handle ( int  device)

Definition at line 176 of file carma_context.h.

176  {
177  return devices[device]->get_cusparse_handle();
178  }

◆ get_device()

CarmaDevice* CarmaContext::get_device ( int  dev)

Definition at line 132 of file carma_context.h.

132 { return devices[dev]; }
Here is the caller graph for this function:

◆ get_device_info()

std::string CarmaContext::get_device_info ( int  device)

◆ get_device_mem_info()

std::string CarmaContext::get_device_mem_info ( int  device)

◆ get_device_name()

std::string CarmaContext::get_device_name ( int  device)

◆ get_max_gflops_device_id()

int CarmaContext::get_max_gflops_device_id ( )

◆ get_ndevice()

int CarmaContext::get_ndevice ( )

Definition at line 131 of file carma_context.h.

131 { return ndevice; }

◆ instance()

static CarmaContext& CarmaContext::instance ( )
static

◆ instance_1gpu()

static CarmaContext& CarmaContext::instance_1gpu ( int  num_device)
static

◆ instance_ngpu()

static CarmaContext& CarmaContext::instance_ngpu ( int  nb_devices,
int32_t *  devices_id 
)
static

◆ magma_info()

std::string CarmaContext::magma_info ( )

The documentation for this class was generated from the following file:
carma_safe_call
#define carma_safe_call(err)
Definition: carma_utils.h:145
benchmark_script.device
int device
Definition: benchmark_script.py:408
CarmaContext::get_cusparse_handle
cusparseHandle_t get_cusparse_handle()
Definition: carma_context.h:169
CarmaContext::_set_active_device_force
int _set_active_device_force(int new_device, int silent, std::string file, int line)
CarmaContext::get_cublas_handle
cublasHandle_t get_cublas_handle()
Definition: carma_context.h:168
CarmaContext::_set_active_device
int _set_active_device(int new_device, int silent, std::string file, int line)
Definition: carma_context.h:159