Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Baiyun-u-smartAI opened this issue Mar 14, 2020 · 0 comments

Comments

@Baiyun-u-smartAI
Copy link

`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<int_> vector(1, context);

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

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

boost::compute::transform(vector.begin(), vector.end(), out.begin(), add_four, queue);
cout<<out[0];`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant