github.com/oneapi-src/oneTBB (#3278)

* 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>
This commit is contained in:
Andrew 2023-10-06 21:45:45 +03:00 committed by GitHub
parent 2936f5c579
commit 929758b320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#include <cstdlib>
#include <tbb/task_arena.h>
int main() {
const auto numa_nodes = tbb::info::numa_nodes();
const auto size = numa_nodes.size();
const auto type = numa_nodes.front();
return size == 1 && type == tbb::task_arena::automatic ? EXIT_SUCCESS : EXIT_FAILURE;
}

View file

@ -0,0 +1,97 @@
distributable:
url: https://github.com/oneapi-src/oneTBB/archive/v{{version}}.tar.gz
strip-components: 1
display-name: tbb
platforms:
- darwin
- linux/x86-64
# FIXME: linux/aarch64 => undefined symbol: __aarch64_ldadd8_acq_rel
versions:
github: oneapi-src/oneTBB
strip: /^v/
ignore: # they moved _to_ calver
- /4\.4/
dependencies:
python.org: ~3.11
runtime:
env:
PYTHONPATH: '{{prefix}}/lib/python{{deps.python.org.version.major}}/site-packages:$PYTHONPATH'
build:
dependencies:
cmake.org: '*'
swig.org: '*'
freedesktop.org/pkg-config: '*'
linux:
llvm.org: '*'
gnu.org/gcc: '>=4.8.5<11.2.1'
gnu.org/make: '*'
working-directory: build
script:
#build shared
- run: |
cmake -S ../.. $CMAKE_ARGS -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_RPATH="{{prefix}}"
cmake --build .
cmake --install .
working-directory: shared
# build static
- run: |
cmake -S ../.. $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_RPATH="{{prefix}}"
cmake --build .
install ./*/libtbb*.a {{prefix}}/lib/
working-directory: static
# build python
- run: |
cmake -S ../.. $CMAKE_ARGS -DTBB4PY_BUILD=ON
make irml
install gnu*/* {{prefix}}/lib
export LDFLAGS="-L{{prefix}}/lib/libirml.so -lirml $LDFLAGS"
export PYTHONPATH="$PWD/build/python{{deps.python.org.version.marketing}}/site-packages:$PYTHONPATH"
export CXX=clang++
python ../../python/setup.py install --prefix=$PWD/build
working-directory: python
if: linux
- run: |
python3 -m pip install --prefix={{prefix}} .
working-directory: ../python
# python 3.xx => 3 symlink
- run: |
if [ ! -L "python{{deps.python.org.version.major}}" ]; then
ln -s python{{deps.python.org.version.marketing}} python{{deps.python.org.version.major}}
fi
working-directory: ${{prefix}}/lib
env:
TBBROOT: '{{prefix}}'
CMAKE_ARGS:
- -DCMAKE_INSTALL_PREFIX="{{prefix}}
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_FIND_FRAMEWORK=LAST
- -DCMAKE_VERBOSE_MAKEFILE=ON
- -Wno-dev
- -DTBB_TEST=OFF
PYTHONPATH: '{{prefix}}/lib/python{{deps.python.org.version.marketing}}/site-packages:$PYTHONPATH'
linux:
CC: gcc
CXX: g++
test:
dependencies:
freedesktop.org/pkg-config: '*'
script:
- pkg-config --modversion tbb | grep {{version}}
- c++ --std=c++14 cores-types.cpp $(pkg-config --libs tbb) -ltbb -o core-types
- ./core-types
- c++ --std=c++14 sum1-100.cpp $(pkg-config --libs tbb) -o sum1-100
- ./sum1-100 | grep 5050
- python -m TBB -h
- python -c "import TBB"

View file

@ -0,0 +1,22 @@
#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;
}