All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
misc_operations.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_MISC_OPERATIONS_HPP_
#define VIENNACL_LINALG_MISC_OPERATIONS_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include "viennacl/forwards.h"
#include "viennacl/scalar.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/matrix.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/linalg/host_based/misc_operations.hpp"
#ifdef VIENNACL_WITH_OPENCL
#include "viennacl/linalg/opencl/misc_operations.hpp"
#endif
#ifdef VIENNACL_WITH_CUDA
#include "viennacl/linalg/cuda/misc_operations.hpp"
#endif
namespace viennacl
{
namespace linalg
{
namespace detail
{
template<typename ScalarType>
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,
vcl_size_t num_rows
)
{
assert( viennacl::traits::handle(vec).get_active_handle_id() == row_index_array.get_active_handle_id() && bool("Incompatible memory domains"));
assert( viennacl::traits::handle(vec).get_active_handle_id() == row_buffer.get_active_handle_id() && bool("Incompatible memory domains"));
assert( viennacl::traits::handle(vec).get_active_handle_id() == col_buffer.get_active_handle_id() && bool("Incompatible memory domains"));
assert( viennacl::traits::handle(vec).get_active_handle_id() == element_buffer.get_active_handle_id() && bool("Incompatible memory domains"));
switch (viennacl::traits::handle(vec).get_active_handle_id())
{
case viennacl::MAIN_MEMORY:
viennacl::linalg::host_based::detail::level_scheduling_substitute(vec, row_index_array, row_buffer, col_buffer, element_buffer, num_rows);
break;
#ifdef VIENNACL_WITH_OPENCL
case viennacl::OPENCL_MEMORY:
viennacl::linalg::opencl::detail::level_scheduling_substitute(vec, row_index_array, row_buffer, col_buffer, element_buffer, num_rows);
break;
#endif
#ifdef VIENNACL_WITH_CUDA
case viennacl::CUDA_MEMORY:
viennacl::linalg::cuda::detail::level_scheduling_substitute(vec, row_index_array, row_buffer, col_buffer, element_buffer, num_rows);
break;
#endif
case viennacl::MEMORY_NOT_INITIALIZED:
throw memory_exception("not initialised!");
default:
throw memory_exception("not implemented");
}
}
} //namespace detail
} //namespace linalg
} //namespace viennacl
#endif
viennacl::memory_exception
Exception class in case of memory errors.
Definition: forwards.h:572
matrix.hpp
Implementation of the dense matrix class.
tools.hpp
Various little tools used here and there in ViennaCL.
viennacl::OPENCL_MEMORY
Definition: forwards.h:349
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::linalg::detail::level_scheduling_substitute
void level_scheduling_substitute(viennacl::vector< NumericT > &vec, std::list< viennacl::backend::mem_handle > const &row_index_arrays, std::list< viennacl::backend::mem_handle > const &row_buffers, std::list< viennacl::backend::mem_handle > const &col_buffers, std::list< viennacl::backend::mem_handle > const &element_buffers, std::list< vcl_size_t > const &row_elimination_num_list)
Definition: common.hpp:224
misc_operations.hpp
Implementations of miscellaneous operations on the CPU using a single thread or OpenMP.
viennacl::MEMORY_NOT_INITIALIZED
Definition: forwards.h:347
viennacl::CUDA_MEMORY
Definition: forwards.h:350
misc_operations.hpp
Implementations of operations using compressed_matrix and OpenCL.
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::linalg::opencl::detail::level_scheduling_substitute
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)
Definition: misc_operations.hpp:45
viennacl::vector< ScalarType >
viennacl::MAIN_MEMORY
Definition: forwards.h:348
vector.hpp
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
viennacl::linalg::cuda::detail::level_scheduling_substitute
void level_scheduling_substitute(vector< NumericT > &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, vcl_size_t num_rows)
Definition: misc_operations.hpp:68
viennacl::backend::mem_handle
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
Definition: mem_handle.hpp:89
viennacl::traits::handle
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
Definition: handle.hpp:41
viennacl::linalg::host_based::detail::level_scheduling_substitute
void level_scheduling_substitute(vector< NumericT > &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, vcl_size_t num_rows)
Definition: misc_operations.hpp:42
misc_operations.hpp
Implementations of miscellaneous operations using CUDA.
scalar.hpp
Implementation of the ViennaCL scalar class.
viennacl::backend::mem_handle::get_active_handle_id
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...
Definition: mem_handle.hpp:118