ViennaCL - The Vienna Computing Library  1.7.1
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scheduler_vector.cpp File Reference
#include <iostream>
#include <iomanip>
#include <vector>
#include "viennacl/vector.hpp"
#include "viennacl/matrix.hpp"
#include "viennacl/vector_proxy.hpp"
#include "viennacl/linalg/inner_prod.hpp"
#include "viennacl/linalg/norm_1.hpp"
#include "viennacl/linalg/norm_2.hpp"
#include "viennacl/linalg/norm_inf.hpp"
#include "viennacl/scheduler/execute.hpp"
#include "viennacl/scheduler/io.hpp"
#include "viennacl/tools/random.hpp"

Go to the source code of this file.

Macros

#define GENERATE_UNARY_OP_TEST(OPNAME)
 

Functions

template<typename ScalarType >
ScalarType diff (ScalarType const &s1, ScalarType const &s2)
 
template<typename ScalarType >
ScalarType diff (ScalarType const &s1, viennacl::scalar< ScalarType > const &s2)
 
template<typename ScalarType >
ScalarType diff (ScalarType const &s1, viennacl::entry_proxy< ScalarType > const &s2)
 
template<typename ScalarType , typename ViennaCLVectorType >
ScalarType diff (std::vector< ScalarType > const &v1, ViennaCLVectorType const &vcl_vec)
 
template<typename T1 , typename T2 >
int check (T1 const &t1, T2 const &t2, double epsilon)
 
template<typename NumericT , typename Epsilon , typename STLVectorType , typename ViennaCLVectorType1 , typename ViennaCLVectorType2 >
int test (Epsilon const &epsilon, STLVectorType &std_v1, STLVectorType &std_v2, ViennaCLVectorType1 &vcl_v1, ViennaCLVectorType2 &vcl_v2)
 
template<typename NumericT , typename Epsilon >
int test (Epsilon const &epsilon)
 
int main ()
 

Detailed Description

Tests the scheduler for vector-operations.

Test:
Tests the scheduler for vector-operations.

Definition in file scheduler_vector.cpp.

Macro Definition Documentation

#define GENERATE_UNARY_OP_TEST (   OPNAME)
Value:
std_v1 = std::vector<NumericT>(std_v1.size(), NumericT(0.21)); \
for (std::size_t i=0; i<std_v1.size(); ++i) \
std_v2[i] = NumericT(3.1415) * std_v1[i]; \
viennacl::copy(std_v1.begin(), std_v1.end(), vcl_v1.begin()); \
viennacl::copy(std_v2.begin(), std_v2.end(), vcl_v2.begin()); \
{ \
for (std::size_t i=0; i<std_v1.size(); ++i) \
std_v1[i] = std::OPNAME(std_v2[i]); \
viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2)); \
if (check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS) \
return EXIT_FAILURE; \
} \
{ \
for (std::size_t i=0; i<std_v1.size(); ++i) \
std_v1[i] = std::OPNAME(std_v2[i] / NumericT(2)); \
viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2 / NumericT(2))); \
if (check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS) \
return EXIT_FAILURE; \
}
A tag class representing assignment.
Definition: forwards.h:81
int check(T1 const &t1, T2 const &t2, double epsilon)
float NumericT
Definition: bisect.cpp:40
void execute(template_base const &T, statements_container const &statements, viennacl::ocl::context &ctx=viennacl::ocl::current_context(), bool force_compilation=false)
Definition: execute.hpp:44
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...

Function Documentation

template<typename T1 , typename T2 >
int check ( T1 const &  t1,
T2 const &  t2,
double  epsilon 
)

Definition at line 106 of file scheduler_vector.cpp.

template<typename ScalarType >
ScalarType diff ( ScalarType const &  s1,
ScalarType const &  s2 
)

Definition at line 52 of file scheduler_vector.cpp.

template<typename ScalarType >
ScalarType diff ( ScalarType const &  s1,
viennacl::scalar< ScalarType > const &  s2 
)

Definition at line 63 of file scheduler_vector.cpp.

template<typename ScalarType >
ScalarType diff ( ScalarType const &  s1,
viennacl::entry_proxy< ScalarType > const &  s2 
)

Definition at line 74 of file scheduler_vector.cpp.

template<typename ScalarType , typename ViennaCLVectorType >
ScalarType diff ( std::vector< ScalarType > const &  v1,
ViennaCLVectorType const &  vcl_vec 
)

Definition at line 85 of file scheduler_vector.cpp.

int main ( )

Definition at line 770 of file scheduler_vector.cpp.

template<typename NumericT , typename Epsilon , typename STLVectorType , typename ViennaCLVectorType1 , typename ViennaCLVectorType2 >
int test ( Epsilon const &  epsilon,
STLVectorType &  std_v1,
STLVectorType &  std_v2,
ViennaCLVectorType1 &  vcl_v1,
ViennaCLVectorType2 &  vcl_v2 
)

Definition at line 126 of file scheduler_vector.cpp.

template<typename NumericT , typename Epsilon >
int test ( Epsilon const &  epsilon)

Definition at line 608 of file scheduler_vector.cpp.