void level_scheduling_substitute(vector<ScalarType> & vec,
                              viennacl::backend::mem_handle const & row_index_array,
                              viennacl::backend::mem_handle const & row_buffer,
                              viennacl::backend::mem_handle const & col_buffer,
                              viennacl::backend::mem_handle const & element_buffer,
                              std::size_t num_rows
                             )
 {
   viennacl::linalg::kernels::ilu<ScalarType, 1>::init();
   viennacl::ocl::kernel & k = viennacl::ocl::get_kernel(viennacl::linalg::kernels::ilu<ScalarType, 1>::program_name(), "level_scheduling_substitute");
   
   viennacl::ocl::enqueue(k(row_index_array.opencl_handle(), row_buffer.opencl_handle(), col_buffer.opencl_handle(), element_buffer.opencl_handle(),
                            vec, 
                            static_cast<cl_uint>(num_rows)));
 }
Example #2
0
void level_scheduling_substitute(vector<NumericT> & x,
                                 viennacl::backend::mem_handle const & row_index_array,
                                 viennacl::backend::mem_handle const & row_buffer,
                                 viennacl::backend::mem_handle const & col_buffer,
                                 viennacl::backend::mem_handle const & element_buffer,
                                 vcl_size_t num_rows
                                )
{
  viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(x).context());

  viennacl::linalg::opencl::kernels::ilu<NumericT>::init(ctx);
  viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::ilu<NumericT>::program_name(), "level_scheduling_substitute");

  viennacl::ocl::enqueue(k(row_index_array.opencl_handle(), row_buffer.opencl_handle(), col_buffer.opencl_handle(), element_buffer.opencl_handle(),
                           x,
                           static_cast<cl_uint>(num_rows)));
}
Example #3
0
/** @brief Returns an ID for the currently active memory domain of an object */
inline viennacl::context context(viennacl::backend::mem_handle const & h)
{
#ifdef VIENNACL_WITH_OPENCL
  if (h.get_active_handle_id() == OPENCL_MEMORY)
    return viennacl::context(h.opencl_handle().context());
#endif

  return viennacl::context(h.get_active_handle_id());
}
Example #4
0
static ViennaCLStatus init_opencl_vector(viennacl::backend::mem_handle & h, ViennaCLVector x)
{
#ifdef VIENNACL_WITH_OPENCL
  h.switch_active_handle_id(viennacl::OPENCL_MEMORY);
  h.opencl_handle() = x->opencl_mem;
  h.opencl_handle().inc();
  if (x->precision == ViennaCLFloat)
    h.raw_size(static_cast<viennacl::vcl_size_t>(x->inc) * static_cast<viennacl::vcl_size_t>(x->size) * sizeof(float)); // not necessary, but still set for conciseness
  else if (x->precision == ViennaCLDouble)
    h.raw_size(static_cast<viennacl::vcl_size_t>(x->inc) * static_cast<viennacl::vcl_size_t>(x->size) * sizeof(double)); // not necessary, but still set for conciseness
  else
    return ViennaCLGenericFailure;

  return ViennaCLSuccess;
#else
  (void)h;
  (void)x;
  return ViennaCLGenericFailure;
#endif
}
Example #5
0
 static void dump(viennacl::backend::mem_handle const & buff, uniform_tag tag, cl_uint start, cl_uint size){
   viennacl::ocl::kernel & k = viennacl::ocl::get_kernel(viennacl::linalg::kernels::rand<ScalarType,1>::program_name(),"dump_uniform");
   k.global_work_size(0, viennacl::tools::roundUpToNextMultiple<unsigned int>(size,k.local_work_size(0)));
   viennacl::ocl::enqueue(k(buff.opencl_handle(), start, size, cl_float(tag.a), cl_float(tag.b) , cl_uint(time(0))));
 }