ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
scheduler_matrix.cpp File Reference
#include <utility>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <ctime>
#include "viennacl/scalar.hpp"
#include "viennacl/matrix.hpp"
#include "viennacl/linalg/prod.hpp"
#include "viennacl/matrix_proxy.hpp"
#include "viennacl/vector_proxy.hpp"
#include "boost/numeric/ublas/vector.hpp"
#include "boost/numeric/ublas/matrix.hpp"
#include "boost/numeric/ublas/matrix_proxy.hpp"
#include "boost/numeric/ublas/vector_proxy.hpp"
#include "boost/numeric/ublas/io.hpp"
#include "viennacl/scheduler/execute.hpp"

Go to the source code of this file.

Macros

#define VIENNACL_WITH_UBLAS
 
#define GENERATE_UNARY_OP_TEST(OPNAME)
 

Functions

template<typename MatrixType , typename VCLMatrixType >
bool check_for_equality (MatrixType const &ublas_A, VCLMatrixType const &vcl_A, double epsilon)
 
template<typename UBLASMatrixType , typename ViennaCLMatrixType1 , typename ViennaCLMatrixType2 , typename ViennaCLMatrixType3 >
int run_test (double epsilon, UBLASMatrixType &ublas_A, UBLASMatrixType &ublas_B, UBLASMatrixType &ublas_C, ViennaCLMatrixType1 &vcl_A, ViennaCLMatrixType2 &vcl_B, ViennaCLMatrixType3 vcl_C)
 
template<typename T , typename ScalarType >
int run_test (double epsilon)
 
int main (int, const char **)
 

Detailed Description

Tests the scheduler for matrix-operations (no matrix-matrix).

Test:
Tests the scheduler for matrix-operations (no matrix-matrix).

Definition in file scheduler_matrix.cpp.

Macro Definition Documentation

#define GENERATE_UNARY_OP_TEST (   OPNAME)
Value:
ublas_A = ublas::scalar_matrix<cpu_value_type>(ublas_A.size1(), ublas_A.size2(), cpu_value_type(0.21)); \
ublas_B = cpu_value_type(3.1415) * ublas_A; \
viennacl::copy(ublas_A, vcl_A); \
viennacl::copy(ublas_B, vcl_B); \
{ \
for (std::size_t i=0; i<ublas_C.size1(); ++i) \
for (std::size_t j=0; j<ublas_C.size2(); ++j) \
ublas_C(i,j) = static_cast<cpu_value_type>(OPNAME(ublas_A(i,j))); \
viennacl::scheduler::statement my_statement(vcl_C, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_A)); \
if (!check_for_equality(ublas_C, vcl_C, epsilon) != EXIT_SUCCESS) \
return EXIT_FAILURE; \
} \
{ \
for (std::size_t i=0; i<ublas_C.size1(); ++i) \
for (std::size_t j=0; j<ublas_C.size2(); ++j) \
ublas_C(i,j) = static_cast<cpu_value_type>(OPNAME(ublas_A(i,j) / cpu_value_type(2))); \
viennacl::scheduler::statement my_statement(vcl_C, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_A / cpu_value_type(2))); \
if (!check_for_equality(ublas_C, vcl_C, epsilon) != EXIT_SUCCESS) \
return EXIT_FAILURE; \
}
A tag class representing assignment.
Definition: forwards.h:81
bool check_for_equality(MatrixType const &ublas_A, VCLMatrixType const &vcl_A, double epsilon)
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

Definition at line 24 of file scheduler_matrix.cpp.

Function Documentation

template<typename MatrixType , typename VCLMatrixType >
bool check_for_equality ( MatrixType const &  ublas_A,
VCLMatrixType const &  vcl_A,
double  epsilon 
)

Definition at line 59 of file scheduler_matrix.cpp.

int main ( int  ,
const char **   
)

Definition at line 945 of file scheduler_matrix.cpp.

template<typename UBLASMatrixType , typename ViennaCLMatrixType1 , typename ViennaCLMatrixType2 , typename ViennaCLMatrixType3 >
int run_test ( double  epsilon,
UBLASMatrixType &  ublas_A,
UBLASMatrixType &  ublas_B,
UBLASMatrixType &  ublas_C,
ViennaCLMatrixType1 &  vcl_A,
ViennaCLMatrixType2 &  vcl_B,
ViennaCLMatrixType3  vcl_C 
)

Definition at line 92 of file scheduler_matrix.cpp.

template<typename T , typename ScalarType >
int run_test ( double  epsilon)

Definition at line 454 of file scheduler_matrix.cpp.