Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
cmake/ | 12-May-2024 | - | 690 | 609 | ||
doc/ | 12-May-2024 | - | 50,291 | 27,979 | ||
example/ | 12-May-2024 | - | 5,060 | 3,153 | ||
include/boost/ | 12-May-2024 | - | 43,526 | 28,981 | ||
meta/ | 12-May-2024 | - | 15 | 14 | ||
perf/ | 12-May-2024 | - | 7,461 | 4,795 | ||
test/ | 12-May-2024 | - | 21,347 | 15,133 | ||
CMakeLists.txt | D | 12-May-2024 | 4.2 KiB | 130 | 109 | |
CONTRIBUTING.md | D | 12-May-2024 | 1.5 KiB | 47 | 31 | |
LICENSE_1_0.txt | D | 12-May-2024 | 1.3 KiB | 24 | 20 | |
README.md | D | 12-May-2024 | 3.3 KiB | 91 | 65 | |
index.html | D | 12-May-2024 | 495 | 21 | 20 |
README.md
1# Boost.Compute # 2 3[](https://travis-ci.org/boostorg/compute) 4[](https://ci.appveyor.com/project/jszuppe/compute/branch/master) 5[](https://coveralls.io/r/boostorg/compute) 6[](https://gitter.im/boostorg/compute?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 7 8Boost.Compute is a GPU/parallel-computing library for C++ based on OpenCL. 9 10The core library is a thin C++ wrapper over the OpenCL API and provides 11access to compute devices, contexts, command queues and memory buffers. 12 13On top of the core library is a generic, STL-like interface providing common 14algorithms (e.g. `transform()`, `accumulate()`, `sort()`) along with common 15containers (e.g. `vector<T>`, `flat_set<T>`). It also features a number of 16extensions including parallel-computing algorithms (e.g. `exclusive_scan()`, 17`scatter()`, `reduce()`) and a number of fancy iterators (e.g. 18`transform_iterator<>`, `permutation_iterator<>`, `zip_iterator<>`). 19 20The full documentation is available at http://boostorg.github.io/compute/. 21 22## Example ## 23 24The following example shows how to sort a vector of floats on the GPU: 25 26```c++ 27#include <vector> 28#include <algorithm> 29#include <boost/compute.hpp> 30 31namespace compute = boost::compute; 32 33int main() 34{ 35 // get the default compute device 36 compute::device gpu = compute::system::default_device(); 37 38 // create a compute context and command queue 39 compute::context ctx(gpu); 40 compute::command_queue queue(ctx, gpu); 41 42 // generate random numbers on the host 43 std::vector<float> host_vector(1000000); 44 std::generate(host_vector.begin(), host_vector.end(), rand); 45 46 // create vector on the device 47 compute::vector<float> device_vector(1000000, ctx); 48 49 // copy data to the device 50 compute::copy( 51 host_vector.begin(), host_vector.end(), device_vector.begin(), queue 52 ); 53 54 // sort data on the device 55 compute::sort( 56 device_vector.begin(), device_vector.end(), queue 57 ); 58 59 // copy data back to the host 60 compute::copy( 61 device_vector.begin(), device_vector.end(), host_vector.begin(), queue 62 ); 63 64 return 0; 65} 66``` 67 68Boost.Compute is a header-only library, so no linking is required. The example 69above can be compiled with: 70 71`g++ -I/path/to/compute/include sort.cpp -lOpenCL` 72 73More examples can be found in the [tutorial]( 74http://boostorg.github.io/compute/boost_compute/tutorial.html) and under the 75[examples](https://github.com/boostorg/compute/tree/master/example) directory. 76 77## Support ## 78Questions about the library (both usage and development) can be posted to the 79[mailing list](https://groups.google.com/forum/#!forum/boost-compute). 80 81Bugs and feature requests can be reported through the [issue tracker]( 82https://github.com/boostorg/compute/issues?state=open). 83 84Also feel free to send me an email with any problems, questions, or feedback. 85 86## Help Wanted ## 87The Boost.Compute project is currently looking for additional developers with 88interest in parallel computing. 89 90Please send an email to Kyle Lutz (kyle.r.lutz@gmail.com) for more information. 91