Browse Source

Check the return value of starpu_opencl_unload_opencl().

starpu_opencl_unload_opencl() always returns 0, but that might change, so it is
probably useful to check its return value.

This was generated by the following semantic patch:

@@
int err;
identifier func;
@@
func(...)
{
<...
(
err = starpu_opencl_load_opencl_from_file(...)
|
err = starpu_opencl_load_opencl_from_string(...)
)
...
-starpu_opencl_unload_opencl(
+err = starpu_opencl_unload_opencl(
...);
+STARPU_CHECK_RETURN_VALUE(err, "starpu_opencl_unload_opencl");
...>
}
Cyril Roelandt 13 years ago
parent
commit
d6fd124ae4

+ 2 - 1
examples/axpy/axpy.c

@@ -215,7 +215,8 @@ enodev:
 	starpu_free((void *)vec_y);
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	/* Stop StarPU */
 	starpu_shutdown();

+ 2 - 1
examples/basic_examples/multiformat.c

@@ -314,7 +314,8 @@ main(void)
 	print_it();
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
         starpu_opencl_unload_opencl(&opencl_conversion_program);
 #endif
 	starpu_shutdown();

+ 2 - 1
examples/basic_examples/vector_scal.c

@@ -157,7 +157,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(vector_handle);
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 
 	/* terminate StarPU, no task can be submitted after */

+ 4 - 2
examples/interface/complex.c

@@ -160,14 +160,16 @@ int main(int argc, char **argv)
 	starpu_task_wait_for_all();
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 	return 0;
 
 enodev:
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_data_unregister(handle1);
 	starpu_data_unregister(handle2);

+ 2 - 1
examples/reductions/dot_product.c

@@ -412,7 +412,8 @@ int main(int argc, char **argv)
 	starpu_helper_cublas_shutdown();
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 

+ 4 - 2
tests/datawizard/acquire_release.c

@@ -116,7 +116,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(token_handle);
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 
@@ -133,7 +134,8 @@ enodev:
 	/* yes, we do not perform the computation but we did detect that no one
  	 * could perform the kernel, so this is not an error from StarPU */
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 	return STARPU_TEST_SKIPPED;

+ 4 - 2
tests/datawizard/acquire_release2.c

@@ -115,7 +115,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(token_handle);
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 
@@ -132,7 +133,8 @@ enodev:
 	/* yes, we do not perform the computation but we did detect that no one
  	 * could perform the kernel, so this is not an error from StarPU */
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 	return STARPU_TEST_SKIPPED;

+ 2 - 1
tests/datawizard/interfaces/bcsr/bcsr_opencl.c

@@ -126,5 +126,6 @@ test_bcsr_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/interfaces/block/block_opencl.c

@@ -116,5 +116,6 @@ test_block_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/interfaces/csr/csr_opencl.c

@@ -126,5 +126,6 @@ test_csr_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/interfaces/matrix/matrix_opencl.c

@@ -124,6 +124,7 @@ void test_matrix_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&matrix_program);
+        ret = starpu_opencl_unload_opencl(&matrix_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }
 

+ 2 - 1
tests/datawizard/interfaces/multiformat/multiformat_conversion_codelets_opencl.c

@@ -107,5 +107,6 @@ void cpu_to_opencl_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_conversion_program);
+        ret = starpu_opencl_unload_opencl(&opencl_conversion_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/interfaces/multiformat/multiformat_opencl.c

@@ -130,5 +130,6 @@ void test_multiformat_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&multiformat_program);
+        ret = starpu_opencl_unload_opencl(&multiformat_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/interfaces/variable/variable_opencl.c

@@ -123,6 +123,7 @@ void test_variable_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 	return;
 }

+ 2 - 1
tests/datawizard/interfaces/vector/test_vector_opencl.c

@@ -126,5 +126,6 @@ test_vector_opencl_func(void *buffers[], void *args)
 	clReleaseEvent(event);
 
 	starpu_opencl_release_kernel(kernel);
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 }

+ 2 - 1
tests/datawizard/mpi_like.c

@@ -224,7 +224,8 @@ int main(int argc, char **argv)
 	}
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 

+ 2 - 1
tests/datawizard/mpi_like_async.c

@@ -390,7 +390,8 @@ int main(int argc, char **argv)
 	}
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 

+ 4 - 2
tests/datawizard/scratch.c

@@ -114,7 +114,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(A_handle);
 	starpu_data_unregister(B_handle);
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 
@@ -138,7 +139,8 @@ enodev:
 	starpu_data_unregister(A_handle);
 	starpu_data_unregister(B_handle);
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();
 	/* yes, we do not perform the computation but we did detect that no one

+ 2 - 1
tests/perfmodels/non_linear_regression_based.c

@@ -126,7 +126,8 @@ int main(int argc, char **argv)
 	}
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 
 	starpu_shutdown();

+ 2 - 1
tests/perfmodels/regression_based.c

@@ -190,7 +190,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(handle);
 
 #ifdef STARPU_USE_OPENCL
-        starpu_opencl_unload_opencl(&opencl_program);
+        ret = starpu_opencl_unload_opencl(&opencl_program);
+        STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_unload_opencl");
 #endif
 	starpu_shutdown();