ViennaCL - The Vienna Computing Library  1.6.0
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BLAS Level 3 Functionality

In this tutorial it is shown how BLAS level 3 functionality in ViennaCL can be used.

We begin with defining preprocessor constants and including the necessary headers.

//disable debug mechanisms to have a fair comparison with ublas:
#ifndef NDEBUG
#define NDEBUG
#endif
// System headers
#include <iostream>
// ublas headers
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/lu.hpp>
#include <boost/numeric/ublas/io.hpp>
// Must be set if you want to use ViennaCL algorithms on ublas objects
#define VIENNACL_WITH_UBLAS 1
// ViennaCL headers
// Some helper functions for this tutorial:
#include "Random.hpp"
#include "vector-io.hpp"
#include "../benchmarks/benchmark-utils.hpp"
#define BLAS3_MATRIX_SIZE 400
using namespace boost::numeric;

Later in this tutorial we will iterate over all available OpenCL devices. To ensure that this tutorial also works if no OpenCL backend is activated, we need this dummy-struct.

#ifndef VIENNACL_WITH_OPENCL
struct dummy
{
std::size_t size() const { return 1; }
};
#endif

We don't need additional auxiliary routines, so let us start straight away with main():

Level 3 Functionality