mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 10:35:17 +03:00
929758b320
* new file: projects/github.com/oneapi-src/oneTBB/cores-types.cpp new file: projects/github.com/oneapi-src/oneTBB/package.yml new file: projects/github.com/oneapi-src/oneTBB/sum1-100.cpp * display-name * well, this is complicated * hmmm * wip * wip * remove tea/gx * wip * let's try without Python first * --std=c++14 * wip * sure * add in gnu make on linux * wip * test * python tbb * PYTHONPATH & LDFLAGS * done * will the magic happen? * compiler to env? * it's redundant > install_log.txt 2>&1 * oh new python * problems with linux/aarch64 * i'll stop messing with this --------- Co-authored-by: Jacob Heider <jacob@tea.xyz> Co-authored-by: Jacob Heider <jacob@pkgx.dev>
22 lines
422 B
C++
22 lines
422 B
C++
#include <iostream>
|
|
#include <tbb/blocked_range.h>
|
|
#include <tbb/parallel_reduce.h>
|
|
|
|
int main()
|
|
{
|
|
auto total = tbb::parallel_reduce(
|
|
tbb::blocked_range<int>(0, 100),
|
|
0.0,
|
|
[&](tbb::blocked_range<int> r, int running_total)
|
|
{
|
|
for (int i=r.begin(); i < r.end(); ++i) {
|
|
running_total += i + 1;
|
|
}
|
|
|
|
return running_total;
|
|
}, std::plus<int>()
|
|
);
|
|
|
|
std::cout << total << std::endl;
|
|
return 0;
|
|
} |