Commit 7516209b authored by Kazutomo Yoshii's avatar Kazutomo Yoshii
Browse files

added runProducer()

parent e499ab34
......@@ -35,7 +35,7 @@ extern "C" void aocl_mmd_card_info(const char *name , int id,
class clwrap {
public:
const int version_major = 0;
const int version_minor = 3;
const int version_minor = 4;
// VALUE: pass by value, otherwise passed by reference
enum dir_enum { VALUE, HOST2DEV, DEV2HOST, DUPLEX };
......@@ -426,16 +426,40 @@ public:
return idx;
}
void runKernel(cl::NDRange &gsz, cl::NDRange &lsz) {
// copy data to dev
// do timing later
void write_to_dev(void) {
for (std::vector<arg_struct>::iterator it = kargs.begin(); it != kargs.end(); ++it) {
if (it->dir == HOST2DEV || it->dir == DUPLEX) {
queue.enqueueWriteBuffer(it->buf, CL_TRUE, 0, it->sz, it->data);
}
}
}
void read_from_dev(void) {
for (std::vector<arg_struct>::iterator it = kargs.begin(); it != kargs.end(); ++it) {
if (it->dir == DEV2HOST || it->dir == DUPLEX) {
queue.enqueueReadBuffer(it->buf, CL_TRUE, 0, it->sz, it->data);
}
}
}
void runProducer(void) {
cl::NDRange gsz(1);
cl::NDRange lsz(1);
write_to_dev();
queue.enqueueNDRangeKernel(
kernel,
cl::NullRange, // offset
gsz,
lsz,
NULL,
NULL);
}
void runKernel(cl::NDRange &gsz, cl::NDRange &lsz) {
write_to_dev();
queue.enqueueNDRangeKernel(
kernel,
......@@ -446,14 +470,9 @@ public:
&kernel_event);
kernel_event.wait();
// copy data from dev
// do timing later
for (std::vector<arg_struct>::iterator it = kargs.begin(); it != kargs.end(); ++it) {
if (it->dir == DEV2HOST || it->dir == DUPLEX) {
queue.enqueueReadBuffer(it->buf, CL_TRUE, 0, it->sz, it->data);
}
}
queue.finish();
read_from_dev();
queue.finish(); // needed?
}
void runKernel(int gsz, int lsz = 1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment