Browse Source

examples/incrementer: unload opencl program

Nathalie Furmento 9 years ago
parent
commit
c1d81a1774

+ 5 - 1
examples/incrementer/incrementer.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2009-2011, 2013-2015  Université de Bordeaux
  * Copyright (C) 2009-2011, 2013-2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2016  CNRS
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
  * it under the terms of the GNU Lesser General Public License as published by
@@ -113,6 +113,10 @@ int main(int argc, char **argv)
 
 
 	end = starpu_timing_now();
 	end = starpu_timing_now();
 
 
+#ifdef STARPU_USE_OPENCL
+	starpu_opencl_unload_opencl(&opencl_program);
+#endif
+
 	FPRINTF(stderr, "array -> %f, %f, %f, %f\n", float_array[0],
 	FPRINTF(stderr, "array -> %f, %f, %f, %f\n", float_array[0],
                 float_array[1], float_array[2], float_array[3]);
                 float_array[1], float_array[2], float_array[3]);
 
 

+ 2 - 2
examples/incrementer/incrementer_kernels_opencl.c

@@ -48,7 +48,7 @@ void opencl_codelet(void *descr[], void *_args)
 
 
 		err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, &local, 0, NULL, NULL);
 		err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, &local, 0, NULL, NULL);
 		if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 		if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
-
-		starpu_opencl_release_kernel(kernel);
 	}
 	}
+
+	starpu_opencl_release_kernel(kernel);
 }
 }