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;
|
std::vector<double> times;
|
||||||
t1 = std::chrono::high_resolution_clock::now();
|
t1 = std::chrono::high_resolution_clock::now();
|
||||||
copy(
|
try
|
||||||
cl::EnqueueArgs(
|
{
|
||||||
queue,
|
copy(
|
||||||
cl::NDRange(ARRAY_SIZE)),
|
cl::EnqueueArgs(
|
||||||
d_a, d_c);
|
queue,
|
||||||
queue.finish();
|
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();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||||
|
|
||||||
|
|
||||||
t1 = std::chrono::high_resolution_clock::now();
|
t1 = std::chrono::high_resolution_clock::now();
|
||||||
mul(
|
try
|
||||||
cl::EnqueueArgs(
|
{
|
||||||
queue,
|
mul(
|
||||||
cl::NDRange(ARRAY_SIZE)),
|
cl::EnqueueArgs(
|
||||||
d_b, d_c);
|
queue,
|
||||||
queue.finish();
|
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();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||||
|
|
||||||
|
|
||||||
t1 = std::chrono::high_resolution_clock::now();
|
t1 = std::chrono::high_resolution_clock::now();
|
||||||
add(
|
try
|
||||||
cl::EnqueueArgs(
|
{
|
||||||
queue,
|
add(
|
||||||
cl::NDRange(ARRAY_SIZE)),
|
cl::EnqueueArgs(
|
||||||
d_a, d_b, d_c);
|
queue,
|
||||||
queue.finish();
|
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();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||||
|
|
||||||
|
|
||||||
t1 = std::chrono::high_resolution_clock::now();
|
t1 = std::chrono::high_resolution_clock::now();
|
||||||
triad(
|
try
|
||||||
cl::EnqueueArgs(
|
{
|
||||||
queue,
|
triad(
|
||||||
cl::NDRange(ARRAY_SIZE)),
|
cl::EnqueueArgs(
|
||||||
d_a, d_b, d_c);
|
queue,
|
||||||
queue.finish();
|
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();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
times.push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user