ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
scheduler_vector.cpp File Reference
#include <iostream>
#include <iomanip>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#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 VIENNACL_WITH_UBLAS   1
 
#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 (ublas::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 UblasVectorType , typename ViennaCLVectorType1 , typename ViennaCLVectorType2 >
int test (Epsilon const &epsilon, UblasVectorType &ublas_v1, UblasVectorType &ublas_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:
ublas_v1 = ublas::scalar_vector<NumericT>(ublas_v1.size(), NumericT(0.21)); \
ublas_v2 = NumericT(3.1415) * ublas_v1; \
viennacl::copy(ublas_v1.begin(), ublas_v1.end(), vcl_v1.begin()); \
viennacl::copy(ublas_v2.begin(), ublas_v2.end(), vcl_v2.begin()); \
{ \
for (std::size_t i=0; i<ublas_v1.size(); ++i) \
ublas_v1[i] = std::OPNAME(ublas_v2[i]); \
viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2)); \
if (check(ublas_v1, vcl_v1, epsilon) != EXIT_SUCCESS) \
return EXIT_FAILURE; \
} \
{ \
for (std::size_t i=0; i<ublas_v1.size(); ++i) \
ublas_v1[i] = std::OPNAME(ublas_v2[i] / NumericT(2)); \
viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2 / NumericT(2))); \
if (check(ublas_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) ...
#define VIENNACL_WITH_UBLAS   1

Definition at line 41 of file scheduler_vector.cpp.

Function Documentation

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

Definition at line 114 of file scheduler_vector.cpp.

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

Definition at line 62 of file scheduler_vector.cpp.

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

Definition at line 73 of file scheduler_vector.cpp.

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

Definition at line 84 of file scheduler_vector.cpp.

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

Definition at line 95 of file scheduler_vector.cpp.

int main ( )

Definition at line 727 of file scheduler_vector.cpp.

template<typename NumericT , typename Epsilon , typename UblasVectorType , typename ViennaCLVectorType1 , typename ViennaCLVectorType2 >
int test ( Epsilon const &  epsilon,
UblasVectorType &  ublas_v1,
UblasVectorType &  ublas_v2,
ViennaCLVectorType1 &  vcl_v1,
ViennaCLVectorType2 &  vcl_v2 
)

Definition at line 134 of file scheduler_vector.cpp.

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

Definition at line 571 of file scheduler_vector.cpp.