30 #ifndef VIENNACL_WITH_OPENCL 
   31   #define VIENNACL_WITH_OPENCL 
   54 static const char * my_compute_program =
 
   55 "__kernel void elementwise_prod(\n" 
   56 "          __global const float * vec1,\n" 
   57 "          __global const float * vec2, \n" 
   58 "          __global float * result,\n" 
   59 "          unsigned int size) \n" 
   61 "  for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0))\n" 
   62 "    result[i] = vec1[i] * vec2[i];\n" 
   64 "__kernel void elementwise_div(\n" 
   65 "          __global const float * vec1,\n" 
   66 "          __global const float * vec2, \n" 
   67 "          __global float * result,\n" 
   68 "          unsigned int size) \n" 
   70 "  for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0))\n" 
   71 "    result[i] = vec1[i] / vec2[i];\n" 
   84   unsigned int vector_size = 10;
 
   93   for (
unsigned int i=0; i<vector_size; ++i)
 
   95     vec1[i] = 
static_cast<ScalarType
>(i);
 
   96     vec2[i] = 
static_cast<ScalarType
>(vector_size-i);
 
  124   std::cout << 
"        vec1: " << vec1 << std::endl;
 
  125   std::cout << 
"        vec2: " << vec2 << std::endl;
 
  126   std::cout << 
"vec1 .* vec2: " << result_mul << std::endl;
 
  127   std::cout << 
"vec1 /* vec2: " << result_div << std::endl;
 
  134   std::cout << 
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
 
T norm_2(std::vector< T, A > const &v1)
Generic interface for the l^2-norm. See viennacl/linalg/vector_operations.hpp for implementations...
Represents an OpenCL kernel within ViennaCL. 
viennacl::ocl::context & current_context()
Convenience function for returning the current context. 
viennacl::ocl::program & add_program(cl_program p, std::string const &prog_name)
Adds a program to the context. 
Wrapper class for an OpenCL program. 
Implementations of the OpenCL backend, where all contexts are stored in. 
void enqueue(KernelType &k, viennacl::ocl::command_queue const &queue)
Enqueues a kernel in the provided queue. 
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
viennacl::ocl::kernel & get_kernel(std::string const &name)
Returns the kernel with the provided name.