Commit 516df6a5 authored by Kazutomo Yoshii's avatar Kazutomo Yoshii
Browse files

latest update

parent 107ff552
......@@ -34,6 +34,9 @@ extern "C" void aocl_mmd_card_info(const char *name , int id,
class clwrap {
public:
const int version_major = 0;
const int version_minor = 1;
// VALUE: pass by value, otherwise passed by reference
enum dir_enum { VALUE, HOST2DEV, DEV2HOST, DUPLEX };
struct arg_struct {
......@@ -43,8 +46,8 @@ public:
bool buffered;
cl::Buffer buf;
};
const int version_major = 0;
const int version_minor = 1;
typedef const char* here_t;
private:
std::vector<cl::Platform> pfs; // initialized only in c'tor
std::vector<cl::Device> devs; // initialized only in c'tor
......
......@@ -7,8 +7,8 @@ __kernel void dummy(__global int *restrict g1,
int g_idx = get_global_id(0);
int l_idx = get_local_id(0);
g1[g_idx] = g_idx;
g2[g_idx] = l_idx;
g1[g_idx] = g_idx + 10;
g2[g_idx] = l_idx + 20;
#ifdef EMULATOR
printf("dummy: dim=%d global_size=%2lu global_id=%2lu local_size=%2lu local_id=%2lu num_groups=%2lu group_id=%2lu\n",
......
......@@ -14,6 +14,7 @@ using namespace std;
static void test_clwrap()
{
clwrap cw;
bool failed = false;
cw.info();
......@@ -34,15 +35,28 @@ static void test_clwrap()
cw.runKernel(gsiz, lsiz);
// validate the results
for (int i = 0; i < gsiz; i++) {
if (a0[i] != i + 10) {
cout << "Error: a0[" << i << "] should be " << i+10 << ", not " << a0[i] << endl;
failed = true;
}
if (a1[i] != (i%lsiz) + 20) {
cout << "Error: a1[" << i << "] should be " << (i%lsiz)+20 << ", not " << a1[i] << endl;
failed = true;
}
}
if (! failed) cout << "Validation passed" << endl;
cout << "Elapsed [sec]: " << cw.getKernelElapsedNanoSec() * 1e-9 << endl;
cout << "[output]" << endl;
cout << "gid: ";
cout << "a0: ";
for (int i = 0; i < gsiz; i++)
cout << setw(3) << a0[i];
cout << endl;
cout << "lid: ";
cout << "a1: ";
for (int i = 0; i < gsiz; i++)
cout << setw(3) << a1[i];
cout << endl;
......
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