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

Function main

compute/example/print_vector.cpp:22–45  ·  view source on GitHub ↗

this example demonstrates how to print the values in a vector

Source from the content-addressed store, hash-verified

20
21// this example demonstrates how to print the values in a vector
22int main()
23{
24 // get default device and setup context
25 compute::device gpu = compute::system::default_device();
26 compute::context context(gpu);
27 compute::command_queue queue(context, gpu);
28 std::cout << "device: " << gpu.name() << std::endl;
29
30 // create vector on the device and fill with the sequence 1..10
31 compute::vector<int> vector(10, context);
32 compute::iota(vector.begin(), vector.end(), 1, queue);
33
34//[print_vector_example
35 std::cout << "vector: [ ";
36 boost::compute::copy(
37 vector.begin(), vector.end(),
38 std::ostream_iterator<int>(std::cout, ", "),
39 queue
40 );
41 std::cout << "]" << std::endl;
42//]
43
44 return 0;
45}

Callers

nothing calls this directly

Calls 5

iotaFunction · 0.85
copyFunction · 0.85
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected