14 Matrix(
const int rows,
const int cols,
const bool on_gpu);
18 void AllocateGPUMemory(
const int rows,
const int cols,
const string& name);
19 void AllocateGPUMemory(
const int rows,
const int cols);
20 void AllocateMainMemory(
const int rows,
const int cols);
23 void Set(
const float val);
25 void GetSlice(
Matrix& slice,
int start,
int end);
30 void CopyToDeviceSlice(
const int start,
const int end);
31 void CopyToHostSlice(
const int start,
const int end);
32 void CopyFromMainMemory(
Matrix& mat);
33 void Reshape(
const int rows,
const int cols);
36 void WriteToFile(FILE* file);
37 void ReadFromFile(FILE* file);
38 void WriteHDF5(hid_t file,
const string& name);
39 void ReadHDF5(hid_t file,
const string& name);
40 void AllocateAndReadHDF5(hid_t file,
const string& name);
41 string GetShapeString();
42 cudamat* GetMat() {
return &mat_; }
43 cudamat* GetMatTranspose() {
return &mat_t_; }
44 float* GetHostData() {
return mat_.data_host; }
45 int GetRows()
const {
return mat_.size[0];}
46 int GetCols()
const {
return mat_.size[1];}
47 int GetNumEls()
const {
return mat_.size[1] * mat_.size[0]; }
52 int GetGPUId()
const {
return gpu_id_; }
56 static void GetOnes(
int rows,
int cols,
Matrix& ones);
57 static void RegisterTempMemory(
int size);
58 static void RegisterTempMemory(
int size,
const string& why);
59 static void RegisterOnes(
int size);
60 static void GetTemp(
int rows,
int cols,
Matrix& temp);
61 static void InitRandom(
int seed);
62 static void SetupCUDADevice(
int gpu_id);
63 static void SetupCUDADevices(
const vector<int>& boards);
64 static void SetDevice(
int gpu_id);
65 static void SyncAllDevices();
66 static int GetDevice();
67 static int GetNumBoards() {
return num_boards_;}
69 static vector<Matrix> ones_, temp_;
70 static vector<rnd_struct> rnd_;
77 static int num_boards_;
78 static int current_gpu_id_;
79 static vector<int> boards_, temp_size_, ones_size_;
Definition: cudamat.cuh:28
A GPU matrix class.
Definition: matrix.h:11