本文整理汇总了C++中viennacl::ocl::context::add_program方法的典型用法代码示例。如果您正苦于以下问题:C++ context::add_program方法的具体用法?C++ context::add_program怎么用?C++ context::add_program使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viennacl::ocl::context
的用法示例。
在下文中一共展示了context::add_program方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<TYPE>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<TYPE>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<TYPE>(ctx, source);
// fully parametrized kernels:
generate_asbs(source, numeric_string);
generate_scalar_swap(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例2: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// only generate for floating points (forces error for integers)
if (numeric_string == "float" || numeric_string == "double")
{
generate_nmf_el_wise_mul_div(source, numeric_string);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例3: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(1024);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
generate_coordinate_matrix_vec_mul(source, numeric_string);
generate_coordinate_matrix_dense_matrix_multiplication(source, numeric_string);
generate_coordinate_matrix_row_info_extractor(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例4: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
bool is_row_major = viennacl::is_row_major<F>::value;
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// unary operations
if (numeric_string == "float" || numeric_string == "double")
{
generate_matrix_unary_element_ops(source, numeric_string, "acos", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "acosh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "asin", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "asinh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "atan", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "atanh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "ceil", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "cos", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "cosh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "erf", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "erfc", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp2", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp10", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "fabs", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "floor", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log2", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log10", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "round", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "rsqrt", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sign", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sin", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sinh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sqrt", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "tan", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "tanh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "trunc", is_row_major);
}
else
{
generate_matrix_unary_element_ops(source, numeric_string, "abs", is_row_major);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例5: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<TYPE>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<TYPE>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<TYPE>(ctx, source);
// unary operations
generate_vector_unary_element_ops(source, numeric_string, "acos");
generate_vector_unary_element_ops(source, numeric_string, "asin");
generate_vector_unary_element_ops(source, numeric_string, "atan");
generate_vector_unary_element_ops(source, numeric_string, "ceil");
generate_vector_unary_element_ops(source, numeric_string, "cos");
generate_vector_unary_element_ops(source, numeric_string, "cosh");
generate_vector_unary_element_ops(source, numeric_string, "exp");
generate_vector_unary_element_ops(source, numeric_string, "fabs");
generate_vector_unary_element_ops(source, numeric_string, "floor");
generate_vector_unary_element_ops(source, numeric_string, "log");
generate_vector_unary_element_ops(source, numeric_string, "log10");
generate_vector_unary_element_ops(source, numeric_string, "sin");
generate_vector_unary_element_ops(source, numeric_string, "sinh");
generate_vector_unary_element_ops(source, numeric_string, "sqrt");
generate_vector_unary_element_ops(source, numeric_string, "tan");
generate_vector_unary_element_ops(source, numeric_string, "tanh");
// binary operations
generate_vector_binary_element_ops(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例6: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
bool row_major_A = viennacl::is_row_major<F_A>::value;
bool row_major_B = viennacl::is_row_major<F_B>::value;
bool row_major_C = viennacl::is_row_major<F_C>::value;
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// only generate for floating points (forces error for integers)
if (numeric_string == "float" || numeric_string == "double")
{
generate_matrix_prod_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, false, false);
generate_matrix_prod_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, false, true);
generate_matrix_prod_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, true, false);
generate_matrix_prod_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, true, true);
generate_matrix_prod16_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, false, false);
generate_matrix_prod16_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, false, true);
generate_matrix_prod16_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, true, false);
generate_matrix_prod16_blas3(source, numeric_string, row_major_A, row_major_B, row_major_C, true, true);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例7: init
static void init(viennacl::ocl::context & ctx)
{
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
std::string source;
source.reserve(1024);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// only generate for floating points (forces error for integers)
if (numeric_string == "float" || numeric_string == "double")
{
generate_ilu_level_scheduling_substitute(source, numeric_string);
generate_icc_extract_L_1(source);
generate_icc_extract_L_2(source, numeric_string);
generate_icc_chow_patel_sweep_kernel(source, numeric_string);
generate_ilu_extract_LU_1(source);
generate_ilu_extract_LU_2(source, numeric_string);
generate_ilu_scale_kernel_1(source, numeric_string);
generate_ilu_scale_kernel_2(source, numeric_string);
generate_ilu_chow_patel_sweep_kernel(source, numeric_string);
generate_ilu_form_neumann_matrix_kernel(source, numeric_string);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例8: init
static void init(viennacl::ocl::context & ctx)
{
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// unary operations
if (numeric_string == "float" || numeric_string == "double")
{
generate_fft_bluestein_post(source, numeric_string);
generate_fft_bluestein_pre(source, numeric_string);
generate_fft_complex_to_real(source, numeric_string);
generate_fft_div_vec_scalar(source, numeric_string);
generate_fft_mult_vec(source, numeric_string);
generate_fft_real_to_complex(source, numeric_string);
generate_fft_reverse_inplace(source, numeric_string);
generate_fft_transpose(source, numeric_string);
generate_fft_transpose_inplace(source, numeric_string);
generate_fft_vandermonde_prod(source, numeric_string);
generate_fft_zero2(source, numeric_string);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init