ViennaCL - The Vienna Computing Library  1.5.2
viennacl/linalg/opencl/misc_operations.hpp
Go to the documentation of this file.
00001 #ifndef VIENNACL_LINALG_OPENCL_MISC_OPERATIONS_HPP_
00002 #define VIENNACL_LINALG_OPENCL_MISC_OPERATIONS_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 
00025 #include "viennacl/forwards.h"
00026 #include "viennacl/ocl/device.hpp"
00027 #include "viennacl/ocl/handle.hpp"
00028 #include "viennacl/ocl/kernel.hpp"
00029 #include "viennacl/scalar.hpp"
00030 #include "viennacl/vector.hpp"
00031 #include "viennacl/tools/tools.hpp"
00032 #include "viennacl/linalg/opencl/kernels/ilu.hpp"
00033 
00034 
00035 namespace viennacl
00036 {
00037   namespace linalg
00038   {
00039     namespace opencl
00040     {
00041 
00042       namespace detail
00043       {
00044 
00045         template <typename ScalarType>
00046         void level_scheduling_substitute(vector<ScalarType> & vec,
00047                                      viennacl::backend::mem_handle const & row_index_array,
00048                                      viennacl::backend::mem_handle const & row_buffer,
00049                                      viennacl::backend::mem_handle const & col_buffer,
00050                                      viennacl::backend::mem_handle const & element_buffer,
00051                                      vcl_size_t num_rows
00052                                     )
00053         {
00054           viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(vec).context());
00055 
00056           viennacl::linalg::opencl::kernels::ilu<ScalarType>::init(ctx);
00057           viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::ilu<ScalarType>::program_name(), "level_scheduling_substitute");
00058 
00059           viennacl::ocl::enqueue(k(row_index_array.opencl_handle(), row_buffer.opencl_handle(), col_buffer.opencl_handle(), element_buffer.opencl_handle(),
00060                                    vec,
00061                                    static_cast<cl_uint>(num_rows)));
00062         }
00063 
00064       } //namespace detail
00065 
00066 
00067     } // namespace opencl
00068   } //namespace linalg
00069 } //namespace viennacl
00070 
00071 
00072 #endif