mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-30 12:02:16 +03:00
matrix class
This commit is contained in:
parent
022db251b8
commit
1dec5d658e
@ -11,23 +11,52 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Matrix
|
||||
{
|
||||
public:
|
||||
Matrix(unsigned a, unsigned b, bool rowMajor)
|
||||
{
|
||||
dim_[0] = a;
|
||||
dim_[1] = b;
|
||||
rowMajor_ = rowMajor;
|
||||
}
|
||||
|
||||
cl_mem &data()
|
||||
{ return mem_; }
|
||||
|
||||
const cl_mem &data() const
|
||||
{ return mem_; }
|
||||
|
||||
bool isRowMajor() const
|
||||
{ return rowMajor_; }
|
||||
|
||||
protected:
|
||||
unsigned dim_[2];
|
||||
cl_mem mem_;
|
||||
bool rowMajor_;
|
||||
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
cerr << "Starting..." << endl;
|
||||
|
||||
OpenCLInfo openCLInfo_;
|
||||
OpenCLInfo openCLInfo;
|
||||
|
||||
openCLInfo_.context = CreateContext(100, openCLInfo_.devices, openCLInfo_.numDevices);
|
||||
openCLInfo.context = CreateContext(100, openCLInfo.devices, openCLInfo.numDevices);
|
||||
cerr << "CreateContext done" << endl;
|
||||
|
||||
openCLInfo_.device = openCLInfo_.devices[0];
|
||||
openCLInfo_.commands = CreateCommandQueue(openCLInfo_);
|
||||
openCLInfo.device = openCLInfo.devices[0];
|
||||
openCLInfo.commands = CreateCommandQueue(openCLInfo);
|
||||
cerr << "CreateCommandQueue done" << endl;
|
||||
|
||||
cl_kernel kernel = CreateKernel("kernels/OutputLayer.cl", "square", openCLInfo_);
|
||||
cl_kernel kernel = CreateKernel("kernels/OutputLayer.cl", "square", openCLInfo);
|
||||
cerr << "CreateKernel done" << endl;
|
||||
|
||||
cl_mem mem_;
|
||||
Matrix W(85000, 512, true);
|
||||
Matrix X(512, 640, true);
|
||||
Matrix B(1, 85000, true);
|
||||
Matrix Y(85000, 640, true);
|
||||
|
||||
cerr << "Finished" << endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user