写了一个Dockerfile
FROM ubuntu:18.04
ADD sources.list /etc/apt/sources.list
RUN apt-get update && apt-get install -y \
gcc \
g++ \
make \
vim \
wget \
git
RUN cd / && git clone https://github.com/01org/tbb.git && cd tbb && \
make -j56 && cd build && sh generate_tbbvars.sh && sh tbbvars.sh && \
cp linux_intel64_gcc_cc7_libc2.27_kernel3.10.0_release/*.so* /usr/lib/ && \
cd ../include && cp -r ./* /usr/local/include && \
/sbin/ldconfig
sources.list内容
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
build:
docker build -t tbb:v0 .
测试:
docker run -it --network=host --name=tbb -v `pwd`:/work -w /work tbb:v0 bash
root@host:/work# ls
CHANGES Doxyfile Makefile README.md cmake examples index.html python src
Dockerfile LICENSE README build doc include jni sources.list
root@host:/work# cd examples/
GettingStarted/ concurrent_priority_queue/ parallel_for/ task_arena/
Makefile graph/ parallel_reduce/ task_group/
common/ index.html pipeline/ test_all/
concurrent_hash_map/ parallel_do/ task/
root@host:/work# cd examples/pipeline/
index.html square/
root@host:/work# cd examples/pipeline/square/
root@host:/work/examples/pipeline/square# make
g++ -O2 -DNDEBUG -o square square.cpp gen_input.cpp -ltbb -lrt
./square 0 input.txt output.txt
serial run time = 0.151666
parallel run time = 0.0278103
elapsed time : 0.271129 seconds