From 1a77b1a5aa13ba18635845b837bc26cf5aff859a Mon Sep 17 00:00:00 2001 From: Benjamin Segovia Date: Tue, 9 Oct 2012 21:25:24 +0000 Subject: Fixed select OCL builtin Added a new mandelbrot (more efficient) still to improve regression and funtionality coverage --- utests/compiler_mandelbrot.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 utests/compiler_mandelbrot.cpp (limited to 'utests/compiler_mandelbrot.cpp') diff --git a/utests/compiler_mandelbrot.cpp b/utests/compiler_mandelbrot.cpp new file mode 100644 index 00000000..61751500 --- /dev/null +++ b/utests/compiler_mandelbrot.cpp @@ -0,0 +1,46 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: Benjamin Segovia + */ + +#include "utest_helper.hpp" + +static int *dst = NULL; +static const size_t w = 16; +static const size_t h = 16; +static const size_t iter = 4; + +static void compiler_mandelbrot(void) +{ + const size_t global[2] = {w, h}; + const size_t local[2] = {16, 1}; + const size_t sz = w * h * sizeof(char[4]); + + OCL_CREATE_KERNEL("compiler_mandelbrot"); + + cl_mem cl_dst = clCreateBuffer(ctx, 0, sz, NULL, NULL); + OCL_CALL (clSetKernelArg, kernel, 0, sizeof(cl_mem), &cl_dst); + OCL_CALL (clEnqueueNDRangeKernel, queue, kernel, 2, NULL, global, local, 0, NULL, NULL); + dst = (int *) clIntelMapBuffer(cl_dst, NULL); + + cl_write_bmp(dst, w, h, "mandelbrot.bmp"); + OCL_CALL (clIntelUnmapBuffer, cl_dst); + OCL_CALL (clReleaseMemObject, cl_dst); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_mandelbrot); + -- cgit v1.2.1