Apache Singa
A General Distributed Deep Learning Library
Public Member Functions | Protected Member Functions | List of all members
singa::CppCPU Class Reference

Represent a CPU device which may have multiple threads/executors. More...

#include <device.h>

Inheritance diagram for singa::CppCPU:
Inheritance graph
[legend]
Collaboration diagram for singa::CppCPU:
Collaboration graph
[legend]

Public Member Functions

std::shared_ptr< Devicehost () const override
 
void SetRandSeed (unsigned seed) override
 
- Public Member Functions inherited from singa::Device
 Device (int id, int num_executors)
 Constructor with device ID, num of executors (e.g., cuda streams), max mem size to use (in MB)
 
BlockNewBlock (int size)
 Called by Tensor.
 
void FreeBlock (Block *block)
 Called by Tensor.
 
virtual size_t GetAllocatedMem ()
 Return the size (bytes) of memory in use TODO(wangwei) override this function for all devices. More...
 
virtual void CopyDataToFrom (Block *dst, Block *src, size_t nBytes, CopyDirection direction, int dst_offset, int src_offset)
 Copy data within or across devices.
 
void CopyDataFromHostPtr (Block *dst, const void *src, size_t nBytes, size_t dst_offset=0)
 
void Exec (function< void(Context *)> &&fn, const vector< Block *> read_blocks, const vector< Block *> write_blocks, bool use_rand_generator=false)
 Submit the operation to the device, which may execute it right now or delay it depending on the scheduler. More...
 
void Sync ()
 wait for all operations submitted to this device.
 
LangType lang () const
 Return the programming language for this device.
 
Contextcontext (int k)
 
int id () const
 

Protected Member Functions

void DoExec (function< void(Context *)> &&fn, int executor) override
 Execute one operation on one executor.
 
void CopyToFrom (void *dst, const void *src, size_t nBytes, CopyDirection direction, Context *ctx) override
 
void * Malloc (int size) override
 Allocate cpu memory.
 
void Free (void *ptr) override
 Free cpu memory.
 

Additional Inherited Members

- Protected Attributes inherited from singa::Device
int id_ = 0
 
int num_executors_ = 0
 
unsigned seed_ = 0
 
LangType lang_
 Programming language type, could be kCpp, kCuda, kOpencl.
 
std::shared_ptr< Devicehost_
 The host device.
 
Context ctx_
 

Detailed Description

Represent a CPU device which may have multiple threads/executors.

It runs cpp code.


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