boostorg / boostorg/compute

Why I cannot get result from boost::compute::function make_function_from_source

Open
#846 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

`using namespace boost;

using compute::int_;
// get default device and setup context
compute::device device = compute::system::default_device();
compute::context context(device);
compute::command_queue queue(context, device);

// point coordinates
int a[]={2};

// create vector for five points
compute::vector vector(1, context);

// copy point data to the device
compute::copy(
reinterpret_cast(a),
reinterpret_cast(a) + 1,
vector.begin(),
queue
);

compute::vector out(1, context);
boost::compute::function add_four =
boost::compute::make_function_from_source(
"add_four",
"int add_four(int x) { return x + 4; }"
);

boost::compute::transform(vector.begin(), vector.end(), out.begin(), add_four, queue);
cout<

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.