Commit 0d365e37 authored by Kazutomo Yoshii's avatar Kazutomo Yoshii
Browse files

elapsedtime report: works w/ neo

parent bbb176af
......@@ -182,6 +182,7 @@ public:
device_id = did;
program_id = 0; //
}
void listPlatforms(void) {
......@@ -199,6 +200,16 @@ public:
cout << "Device" << i << ": " << devs[i].getInfo<CL_DEVICE_NAME>();
// cout << " " << devs[i].getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>() << " ";
if (i == device_id) cout << " [selected]";
#if 0
// to query shared virtual memory capabilities
cl_device_svm_capabilities svmcap;
devs[i].getInfo(CL_DEVICE_SVM_CAPABILITIES, &svmcap);
// CL_INVALID_VALUE is returned, no svm is supported
if( svmcap&CL_DEVICE_SVM_COARSE_GRAIN_BUFFER ) cout << "CGBUF ";
if( svmcap&CL_DEVICE_SVM_FINE_GRAIN_BUFFER ) cout << "FGBUF ";
if( svmcap&CL_DEVICE_SVM_FINE_GRAIN_SYSTEM ) cout << "FGSYS ";
if( svmcap&CL_DEVICE_SVM_ATOMICS ) cout << "ATOM "; // only for fine grain
#endif
cout << endl;
}
}
......@@ -221,7 +232,7 @@ public:
return false;
}
queue = cl::CommandQueue(ctx, devs[device_id], 0, &err);
queue = cl::CommandQueue(ctx, devs[device_id], CL_QUEUE_PROFILING_ENABLE, &err);
kernel = cl::Kernel(prgs[program_id], funcname, &err);
if (err != CL_SUCCESS) {
switch(err) {
......@@ -313,6 +324,7 @@ public:
queue.enqueueReadBuffer(it->buf, CL_TRUE, 0, it->sz, it->data);
}
}
queue.finish();
}
void runKernel(int gsz, int lsz = 1) {
......
// just a dummy OpenCL kernel for testing
// Kaz Yoshii <ky@anl.gov>
__kernel void dummy(__global int *restrict g1,
__global int *restrict g2)
{
int g_idx = get_global_id(0);
int l_idx = get_local_id(0);
g1[g_idx] = g_idx;
g2[g_idx] = l_idx;
#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",
get_work_dim(),
get_global_size(0), get_global_id(0),
get_local_size(0), get_local_id(0),
get_num_groups(0), get_group_id(0));
#endif
}
dummy2.cl
\ No newline at end of file
......@@ -36,6 +36,8 @@ static void test_clwrap()
for (int i = 0; i < gsiz; i++)
cout << i << ":" << a0[i] << "," << a1[i] << " ";
cout << endl;
cout << "Elapsed [sec]: " << cw.getKernelElapsedNanoSec() * 1e-9 << endl;
};
int main()
......
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