diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-09-22 20:47:22 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2016-09-22 20:47:22 +0200 |
commit | d595a8ed7e416dd40c2971ef5e3ec7f36b7db362 (patch) | |
tree | 054e0d97b5f26c3d40b5e9d863e5b009423b978a /samples | |
parent | b1929d8ce7022cacbd1812d62098ebd0681bc1ef (diff) |
Fixed a bug waiting for an invalid event in case of a non-succesfull CLBlast call in the tests and samples
Diffstat (limited to 'samples')
-rw-r--r-- | samples/cache.c | 6 | ||||
-rw-r--r-- | samples/dgemv.c | 6 | ||||
-rw-r--r-- | samples/haxpy.c | 6 | ||||
-rw-r--r-- | samples/sasum.c | 6 | ||||
-rw-r--r-- | samples/sgemm.c | 6 | ||||
-rw-r--r-- | samples/sgemm.cpp | 6 |
6 files changed, 24 insertions, 12 deletions
diff --git a/samples/cache.c b/samples/cache.c index a592824d..abc8ad4b 100644 --- a/samples/cache.c +++ b/samples/cache.c @@ -112,8 +112,10 @@ void run_example_routine(const cl_device_id device) { &queue, &event); // Wait for completion - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } // Retrieves the execution time clock_t diff = clock() - start; diff --git a/samples/dgemv.c b/samples/dgemv.c index c22c9f37..a15d649a 100644 --- a/samples/dgemv.c +++ b/samples/dgemv.c @@ -84,8 +84,10 @@ int main(void) { &queue, &event); // Wait for completion - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } // Example completed. See "clblast_c.h" for status codes (0 -> success). printf("Completed DGEMV with status %d\n", status); diff --git a/samples/haxpy.c b/samples/haxpy.c index d5b98e12..5bab3d42 100644 --- a/samples/haxpy.c +++ b/samples/haxpy.c @@ -77,8 +77,10 @@ int main(void) { &queue, &event); // Wait for completion - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } // Copies the result back to the host clEnqueueReadBuffer(queue, device_b, CL_TRUE, 0, n*sizeof(cl_half), host_b, 0, NULL, NULL); diff --git a/samples/sasum.c b/samples/sasum.c index 1518cc13..02f924b0 100644 --- a/samples/sasum.c +++ b/samples/sasum.c @@ -73,8 +73,10 @@ int main(void) { &queue, &event); // Wait for completion - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } // Copies the result back to the host clEnqueueReadBuffer(queue, device_output, CL_TRUE, 0, 1*sizeof(float), host_output, 0, NULL, NULL); diff --git a/samples/sgemm.c b/samples/sgemm.c index b4827777..583fc261 100644 --- a/samples/sgemm.c +++ b/samples/sgemm.c @@ -87,8 +87,10 @@ int main(void) { &queue, &event); // Wait for completion - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } // Example completed. See "clblast_c.h" for status codes (0 -> success). printf("Completed SGEMM with status %d\n", status); diff --git a/samples/sgemm.cpp b/samples/sgemm.cpp index a4b89968..401ecff8 100644 --- a/samples/sgemm.cpp +++ b/samples/sgemm.cpp @@ -95,8 +95,10 @@ int main() { &queue_plain, &event); // Record the execution time - clWaitForEvents(1, &event); - clReleaseEvent(event); + if (status == clblast::StatusCode::kSuccess) { + clWaitForEvents(1, &event); + clReleaseEvent(event); + } auto elapsed_time = std::chrono::steady_clock::now() - start_time; auto time_ms = std::chrono::duration<double,std::milli>(elapsed_time).count(); |