Context information about the execution environment.  
 More...
#include <base.h>
Context information about the execution environment. 
Type of device. 
| Enumerator | 
|---|
| kCPU |  | 
| kGPU |  | 
| kCPUPinned |  | 
| kCPUShared |  | 
 
 
| 
| mxnet::Context::Context | ( |  | ) |  |  | inline | 
 
 
| 
| static Context mxnet::Context::CPU | ( | int32_t | dev_id = 0 | ) |  |  | inlinestatic | 
 
 
| 
| static Context mxnet::Context::CPUPinned | ( | int32_t | dev_id = -1 | ) |  |  | inlinestatic | 
 
Create a pinned CPU context. 
- Parameters
- 
| dev_id | the device id for corresponding GPU. |  
 
- Returns
- Pinned CPU context. -1 for current GPU. 
 
 
| 
| static Context mxnet::Context::CPUShared | ( | int32_t | dev_id = 0 | ) |  |  | inlinestatic | 
 
Create a CPU shared memory context. 
- Parameters
- 
- Returns
- CPU shared memory context. 
 
 
Create a new context. 
- Parameters
- 
| dev_type | device type. |  | dev_id | device id. -1 for current device. |  
 
 
 
Get corresponding device mask. 
- Returns
- cpu::kDevMask or gpu::kDevMask 
 
 
| 
| static Context mxnet::Context::FromString | ( | const std::string & | str | ) |  |  | inlinestatic | 
 
Create a context from string of the format [cpu|gpu|cpu_pinned](n) 
- Parameters
- 
- Returns
- Context 
 
 
| 
| static int32_t mxnet::Context::GetGPUCount | ( |  | ) |  |  | inlinestatic | 
 
Get the number of GPUs available. 
- Returns
- The number of GPUs that are available. 
 
 
| 
| static void mxnet::Context::GetGPUMemoryInformation | ( | int | dev, |  
|  |  | uint64_t * | free, |  
|  |  | uint64_t * | total |  
|  | ) |  |  |  | inlinestatic | 
 
get the free and total available memory on a GPU 
- Parameters
- 
| dev | the GPU number to query |  | free_mem | pointer to the uint64_t holding free GPU memory |  | total_mem | pointer to the uint64_t holding total GPU memory |  
 
- Returns
- No return value 
 
 
| 
| static Context mxnet::Context::GPU | ( | int32_t | dev_id = -1 | ) |  |  | inlinestatic | 
 
Create a GPU context. 
- Parameters
- 
- Returns
- GPU Context. -1 for current GPU. 
 
 
| 
| bool mxnet::Context::Load | ( | dmlc::Stream * | strm | ) |  |  | inline | 
 
load the content from binary stream 
- Parameters
- 
- Returns
- whether the load is successful 
 
 
| 
| bool mxnet::Context::operator!= | ( | const Context & | b | ) | const |  | inline | 
 
check if current context not equals another one 
- Parameters
- 
| b | another context to compare |  
 
- Returns
- whether they are not the same 
 
 
| 
| bool mxnet::Context::operator< | ( | const Context & | b | ) | const |  | inline | 
 
Comparator, used to enable Context as std::map key. 
- Parameters
- 
| b | another context to compare |  
 
- Returns
- compared result 
 
 
| 
| bool mxnet::Context::operator== | ( | const Context & | b | ) | const |  | inline | 
 
check if current context equals another one 
- Parameters
- 
| b | another context to compare |  
 
- Returns
- whether dev mask and id are same 
 
 
| 
| int mxnet::Context::real_dev_id | ( |  | ) | const |  | inline | 
 
Returns dev_id for kGPU, 0 otherwise. 
 
 
| 
| void mxnet::Context::Save | ( | dmlc::Stream * | strm | ) | const |  | inline | 
 
save the content into binary stream 
- Parameters
- 
 
 
| int32_t mxnet::Context::dev_id | 
 
device id we are going to run it on 
 
 
the device type we run the op on 
 
 
| 
| const int32_t mxnet::Context::kMaxDevID = 16 |  | static | 
 
 
| 
| const int32_t mxnet::Context::kMaxDevType = 6 |  | static | 
 
 
The documentation for this struct was generated from the following file: