MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / main

Function main

compute/example/threefry_engine.cpp:20–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#include <iostream>
19
20int main()
21{
22 using boost::compute::uint_;
23 boost::compute::device device = boost::compute::system::default_device();
24 boost::compute::context context(device);
25 boost::compute::command_queue queue(context, device);
26 boost::compute::threefry_engine<> rng(queue);
27 boost::compute::vector<uint_> vector_ctr(20, context);
28
29 uint32_t ctr[20];
30 for(int i = 0; i < 10; i++) {
31 ctr[i*2] = i;
32 ctr[i*2+1] = 0;
33 }
34 boost::compute::copy(ctr, ctr+20, vector_ctr.begin(), queue);
35 rng.generate(vector_ctr.begin(), vector_ctr.end(), queue);
36 boost::compute::copy(vector_ctr.begin(), vector_ctr.end(), ctr, queue);
37
38 for(int i = 0; i < 10; i++) {
39 std::cout << std::hex << ctr[i*2] << " " << ctr[i*2+1] << std::endl;
40 }
41 return 0;
42}
43

Callers

nothing calls this directly

Calls 4

copyFunction · 0.85
beginMethod · 0.45
generateMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected