Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup TBB Linking #4

Open
andrjohns opened this issue Oct 20, 2019 · 13 comments
Open

Setup TBB Linking #4

andrjohns opened this issue Oct 20, 2019 · 13 comments

Comments

@andrjohns
Copy link

The tests won't compile with the latest version of the math library because of the dependency on TBB. I've added the compiler flags -I$(TBB)/include -DSTAN_THREADS -DSTAN_TBB but it still fails with:

andrew@Lappinux:~/perf-math$ make -j8 matstuff
g++ -O3 -march=native -Ibenchmark/include -std=c++1y -Imath/ -Imath/lib/boost_1.69.0  -Imath/lib/sundials_4.1.0/include -Imath/lib/eigen_3.3.3 -Imath/lib/tbb_2019_U8/include -DSTAN_THREADS -DSTAN_TBB  -Lbenchmark/build/src  matstuff.cpp  -lbenchmark -lpthread -o matstuff
/usr/bin/ld: /tmp/cckTp8H1.o: in function `tbb::internal::task_scheduler_observer_v3::~task_scheduler_observer_v3()':
matstuff.cpp:(.text._ZN3tbb8internal26task_scheduler_observer_v3D2Ev[_ZN3tbb8internal26task_scheduler_observer_v3D5Ev]+0x14): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
/usr/bin/ld: /tmp/cckTp8H1.o: in function `tbb::internal::task_scheduler_observer_v3::~task_scheduler_observer_v3()':
matstuff.cpp:(.text._ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D5Ev]+0x18): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
/usr/bin/ld: /tmp/cckTp8H1.o: in function `tbb::interface6::task_scheduler_observer::~task_scheduler_observer()':
matstuff.cpp:(.text._ZN3tbb10interface623task_scheduler_observerD2Ev[_ZN3tbb10interface623task_scheduler_observerD5Ev]+0x18): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
/usr/bin/ld: matstuff.cpp:(.text._ZN3tbb10interface623task_scheduler_observerD2Ev[_ZN3tbb10interface623task_scheduler_observerD5Ev]+0x34): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
/usr/bin/ld: /tmp/cckTp8H1.o: in function `tbb::interface6::task_scheduler_observer::~task_scheduler_observer()':
matstuff.cpp:(.text._ZN3tbb10interface623task_scheduler_observerD0Ev[_ZN3tbb10interface623task_scheduler_observerD5Ev]+0x18): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
/usr/bin/ld: /tmp/cckTp8H1.o:matstuff.cpp:(.text._ZN3tbb10interface623task_scheduler_observerD0Ev[_ZN3tbb10interface623task_scheduler_observerD5Ev]+0x33): more undefined references to `tbb::internal::task_scheduler_observer_v3::observe(bool)' follow
collect2: error: ld returned 1 exit status
make: *** [<builtin>: matstuff] Error 1

Is there an additional flag or setup step that I'm missing?

@seantalts
Copy link
Member

Yeah, I think we'll also need to build and link against the TBB. @wds15 or @rok-cesnovar do you have a suggestion here? Should we somehow rely on part of the makefiles in Math instead?

@wds15
Copy link

wds15 commented Oct 20, 2019

Yes, we should use some of the math makefile magic for the tbb stuff...or you install the tbb yourself. Let me have a look.

@wds15
Copy link

wds15 commented Oct 22, 2019

@andrjohns
Copy link
Author

Almost:

andrew@Lappinux:~/perf-math$ make -j8 matstuff
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare     -I math/lib/tbb_2019_U8/include -O3  -I math/ -I math/lib/eigen_3.3.3 -I math/lib/boost_1.69.0 -I math/lib/sundials_4.1.0/include -O3 -march=native -Ibenchmark/include math/lib/tbb/libtbb.so.2    -DBOOST_DISABLE_ASSERTS            -Wl,-L,"/home/andrew/perf-math/math/lib/tbb" -Wl,-rpath,"/home/andrew/perf-math/math/lib/tbb" -Lbenchmark/build/src  matstuff.cpp          -lbenchmark -lpthread -o matstuff
g++: error: math/lib/tbb/libtbb.so.2: No such file or directory
make: *** [<builtin>: matstuff] Error 1

Which I'm assuming is indicating that the TBB hasn't been compiled. Is there a flag to add that will kick-off the compilation and linking?

@wds15
Copy link

wds15 commented Oct 24, 2019

I added a libs target. So do a make libs first

@andrjohns
Copy link
Author

One of these days I'll learn to read properly, thanks.

I'm back to getting the same errors in my first post. I've done a fresh clone and copied your makefile but the errors are still there

@wds15
Copy link

wds15 commented Oct 24, 2019

can you post the branch somewhere?

@andrjohns
Copy link
Author

Sure, branch is here: https://github.com/andrjohns/perf-math/blob/feature/tbb_test/Makefile

My workflow start to finish is:

git clone --recursive https://github.com/andrjohns/perf-math.git
cd perf-math && git checkout feature/tbb_test
cd math && git checkout develop
cd ../benchmark && git clone https://github.com/google/googletest
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make -j8
cd ../../
make -j8 libs
make -j8 eigen_return

@wds15
Copy link

wds15 commented Oct 25, 2019

Running this on my Mac gives me a running eigen_return binary.

What OS + compiler are you on?

@andrjohns
Copy link
Author

Curiouser and curiouser. I'm on Linux with g++ 8.3.0

@andrjohns
Copy link
Author

I've just tried clang 8.0 and that works without an issue, so I'm not sure why g++ is having an issue

@wds15
Copy link

wds15 commented Oct 25, 2019

Is this some Ubuntu?

@andrjohns
Copy link
Author

Yep, Kubuntu 19.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants