Closed kilasuelika closed 4 years ago
I want to generate some random normal numbers. My code:
#include <iostream> #include <boost/compute.hpp> namespace compute = boost::compute; int main() { // get the default device compute::device device = compute::system::default_device(); compute::context context(device); compute::command_queue queue(context, device); // print the device's name and platform std::cout << "hello from " << device.name(); std::cout << " (platform: " << device.platform().name() << ")" << std::endl; compute::vector<float> vec(100, context); compute::default_random_engine engine(queue); // setup the uniform distribution to produce floats between 1 and 100 //compute::uniform_real_distribution<float> distribution(1.0, 100.0); //distribution.generate(vec.begin(), vec.end(), engine, queue); return 0; }
Error occurs at compute::default_random_engine engine(queue); on runtime. Saying:
compute::default_random_engine engine(queue);
terminate called after throwing an instance of 'boost::wrapexcept<boost::compute::program_build_failure>' what(): Build Program Failure
I also tried mersenne_twister_engine<int>, no luck.
mersenne_twister_engine<int>
By catch the error and print build_log, I realized it's because my GPU opencl version is 1.1 which is too low.
build_log
I want to generate some random normal numbers. My code:
Error occurs at
compute::default_random_engine engine(queue);
on runtime. Saying:I also tried
mersenne_twister_engine<int>
, no luck.