Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //g++ boostset.cpp -o bs -O2
- #include <boost/compute/system.hpp>
- #include <boost/compute/algorithm/set_intersection.hpp>
- #include <boost/compute/container/vector.hpp>
- #include "stdc++.h"
- int main(){
- boost::compute::device device = boost::compute::system::default_device();
- boost::compute::context context(device);
- boost::compute::command_queue queue(context, device);
- std::vector<uint32_t> a;
- std::vector<uint32_t> b;
- boost::compute::vector<uint32_t> c;
- a.push_back(4);
- a.push_back(5);
- a.push_back(6);
- a.push_back(7);
- b.push_back(4);
- b.push_back(5);
- b.push_back(6);
- b.push_back(9);
- boost::compute::vector<uint32_t> aBoost(context);
- boost::compute::vector<uint32_t> bBoost(context);
- boost::compute::copy(
- a.begin(), a.end(), aBoost.begin(), queue
- );
- boost::compute::copy(
- b.begin(), b.end(), bBoost.begin(), queue
- );
- boost::compute::set_intersection(aBoost.begin(), aBoost.end(), bBoost.begin(), bBoost.end(), c.begin(), queue);
- queue.finish();
- std::cout << "Working fine\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement