/usr/include/viennacl/linalg/opencl/common.hpp is in libviennacl-dev 1.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #ifndef VIENNACL_LINALG_OPENCL_COMMON_HPP_
#define VIENNACL_LINALG_OPENCL_COMMON_HPP_
/* =========================================================================
Copyright (c) 2010-2014, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the PDF manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
/** @file viennacl/linalg/opencl/common.hpp
@brief Common implementations shared by OpenCL-based operations
*/
#include <cmath>
#include "viennacl/forwards.h"
#include "viennacl/ocl/platform.hpp"
namespace viennacl
{
namespace linalg
{
namespace opencl
{
namespace detail
{
inline cl_uint make_options(vcl_size_t length, bool reciprocal, bool flip_sign)
{
return static_cast<cl_uint>( ((length > 1) ? (cl_uint(length) << 2) : 0) + (reciprocal ? 2 : 0) + (flip_sign ? 1 : 0) );
}
/** @brief Returns the OpenCL kernel string for the operation C = A * B with A sparse, B, C dense matrices. */
inline std::string sparse_dense_matmult_kernel_name(bool B_transposed, bool B_row_major, bool C_row_major)
{
if (B_transposed)
{
if (B_row_major && C_row_major)
return "trans_mat_mult_row_row";
if (B_row_major && !C_row_major)
return "trans_mat_mult_row_col";
if (!B_row_major && C_row_major)
return "trans_mat_mult_col_row";
return "trans_mat_mult_col_col";
}
if (B_row_major && C_row_major)
return "mat_mult_row_row";
if (B_row_major && !C_row_major)
return "mat_mult_row_col";
if (!B_row_major && C_row_major)
return "mat_mult_col_row";
return "mat_mult_col_col";
}
inline std::string op_to_string(op_abs) { return "abs"; }
inline std::string op_to_string(op_acos) { return "acos"; }
inline std::string op_to_string(op_asin) { return "asin"; }
inline std::string op_to_string(op_atan) { return "atan"; }
inline std::string op_to_string(op_ceil) { return "ceil"; }
inline std::string op_to_string(op_cos) { return "cos"; }
inline std::string op_to_string(op_cosh) { return "cosh"; }
inline std::string op_to_string(op_exp) { return "exp"; }
inline std::string op_to_string(op_fabs) { return "fabs"; }
inline std::string op_to_string(op_floor) { return "floor"; }
inline std::string op_to_string(op_log) { return "log"; }
inline std::string op_to_string(op_log10) { return "log10"; }
inline std::string op_to_string(op_sin) { return "sin"; }
inline std::string op_to_string(op_sinh) { return "sinh"; }
inline std::string op_to_string(op_sqrt) { return "sqrt"; }
inline std::string op_to_string(op_tan) { return "tan"; }
inline std::string op_to_string(op_tanh) { return "tanh"; }
}
} //namespace opencl
} //namespace linalg
} //namespace viennacl
#endif
|