ViennaCL - The Vienna Computing Library
1.5.2
|
00001 #ifndef VIENNACL_RAND_UNIFORM_HPP_ 00002 #define VIENNACL_RAND_UNIFORM_HPP_ 00003 00004 /* ========================================================================= 00005 Copyright (c) 2010-2014, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 Portions of this software are copyright by UChicago Argonne, LLC. 00009 00010 ----------------- 00011 ViennaCL - The Vienna Computing Library 00012 ----------------- 00013 00014 Project Head: Karl Rupp rupp@iue.tuwien.ac.at 00015 00016 (A list of authors and contributors can be found in the PDF manual) 00017 00018 License: MIT (X11), see file LICENSE in the base directory 00019 ============================================================================= */ 00020 00021 #include "viennacl/backend/mem_handle.hpp" 00022 #include "viennacl/rand/utils.hpp" 00023 00029 namespace viennacl{ 00030 00031 namespace rand{ 00032 00033 struct uniform_tag{ 00034 uniform_tag(unsigned int _a = 0, unsigned int _b = 1) : a(_a), b(_b){ } 00035 float a; 00036 float b; 00037 }; 00038 00039 template<class ScalarType> 00040 struct buffer_dumper<ScalarType, uniform_tag>{ 00041 static void dump(viennacl::backend::mem_handle const & buff, uniform_tag tag, cl_uint start, cl_uint size){ 00042 viennacl::ocl::kernel & k = viennacl::ocl::get_kernel(viennacl::linalg::kernels::rand<ScalarType,1>::program_name(),"dump_uniform"); 00043 k.global_work_size(0, viennacl::tools::align_to_multiple<unsigned int>(size,k.local_work_size(0))); 00044 viennacl::ocl::enqueue(k(buff.opencl_handle(), start, size, cl_float(tag.a), cl_float(tag.b) , cl_uint(time(0)))); 00045 } 00046 }; 00047 00048 00049 00050 } 00051 00052 } 00053 00056 #endif