42 std::size_t
size = 10;
65 viennacl::linalg::host_based::detail::extract_raw_pointer<float>(host_x), 1, 2,
66 viennacl::linalg::host_based::detail::extract_raw_pointer<float>(host_y), 0, 2);
68 std::cout <<
" --- Host ---" << std::endl;
69 std::cout <<
"host_x: " << host_x << std::endl;
70 std::cout <<
"host_y: " << host_y << std::endl;
78 #ifdef VIENNACL_WITH_CUDA
86 std::cout <<
" --- CUDA ---" << std::endl;
87 std::cout <<
"cuda_x: " << cuda_x << std::endl;
88 std::cout <<
"cuda_y: " << cuda_y << std::endl;
97 #ifdef VIENNACL_WITH_OPENCL
104 ViennaCLOpenCLSswap(my_backend, half_size,
105 viennacl::traits::opencl_handle(opencl_x).
get(), 1, 2,
106 viennacl::traits::opencl_handle(opencl_y).
get(), 1, 2);
108 std::cout <<
" --- OpenCL ---" << std::endl;
109 std::cout <<
"opencl_x: " << opencl_x << std::endl;
110 std::cout <<
"opencl_y: " << opencl_y << std::endl;
118 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendCreate(ViennaCLBackend *backend)
Generic backend for CUDA, OpenCL, host-based stuff.
VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendSetOpenCLContextID(ViennaCLBackend backend, ViennaCLInt context_id)
VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSswap(ViennaCLBackend backend, ViennaCLInt n, float *x, ViennaCLInt offx, ViennaCLInt incx, float *y, ViennaCLInt offy, ViennaCLInt incy)
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.)
VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendDestroy(ViennaCLBackend *backend)
VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASswap(ViennaCLBackend backend, ViennaCLInt n, float *x, ViennaCLInt offx, ViennaCLInt incx, float *y, ViennaCLInt offy, ViennaCLInt incy)
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
NumericT * cuda_arg(scalar< NumericT > &obj)
Convenience helper function for extracting the CUDA handle from a ViennaCL scalar. Non-const version.
viennacl::ocl::context & get_context(long i)
Convenience function for returning the current context.