Add try/catch around kernel executions
This commit is contained in:
parent
807af7d679
commit
3c248195ea
@ -262,45 +262,73 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
std::vector<double> times;
|
||||
t1 = std::chrono::high_resolution_clock::now();
|
||||
try
|
||||
{
|
||||
copy(
|
||||
cl::EnqueueArgs(
|
||||
queue,
|
||||
cl::NDRange(ARRAY_SIZE)),
|
||||
d_a, d_c);
|
||||
queue.finish();
|
||||
}
|
||||
catch (cl::Error &e)
|
||||
{
|
||||
die("Executing copy", e);
|
||||
}
|
||||
t2 = std::chrono::high_resolution_clock::now();
|
||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||
|
||||
|
||||
t1 = std::chrono::high_resolution_clock::now();
|
||||
try
|
||||
{
|
||||
mul(
|
||||
cl::EnqueueArgs(
|
||||
queue,
|
||||
cl::NDRange(ARRAY_SIZE)),
|
||||
d_b, d_c);
|
||||
queue.finish();
|
||||
}
|
||||
catch (cl::Error &e)
|
||||
{
|
||||
die("Executing mul", e);
|
||||
}
|
||||
t2 = std::chrono::high_resolution_clock::now();
|
||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||
|
||||
|
||||
t1 = std::chrono::high_resolution_clock::now();
|
||||
try
|
||||
{
|
||||
add(
|
||||
cl::EnqueueArgs(
|
||||
queue,
|
||||
cl::NDRange(ARRAY_SIZE)),
|
||||
d_a, d_b, d_c);
|
||||
queue.finish();
|
||||
}
|
||||
catch (cl::Error &e)
|
||||
{
|
||||
die("Executing add", e);
|
||||
}
|
||||
t2 = std::chrono::high_resolution_clock::now();
|
||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||
|
||||
|
||||
t1 = std::chrono::high_resolution_clock::now();
|
||||
try
|
||||
{
|
||||
triad(
|
||||
cl::EnqueueArgs(
|
||||
queue,
|
||||
cl::NDRange(ARRAY_SIZE)),
|
||||
d_a, d_b, d_c);
|
||||
queue.finish();
|
||||
}
|
||||
catch (cl::Error &e)
|
||||
{
|
||||
die("Executing triad", e);
|
||||
}
|
||||
t2 = std::chrono::high_resolution_clock::now();
|
||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user