Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

problems with TBB app

akalu
Beginner
390 Views

Hello!

Ive downloaded TBB (tbb21_20080605oss) from this site, made simple application in Microsoft Visual Studio 2008 Express based on tree_sum sample.It works fine on my PC (Vista SP1/Core 2 Quad 2.4 Ghz).But when Im trying to start it on other computers (such as XP SP2/Pentium D 3 Ghz) I get an could not launch the application error.

Depends.exe shows that all needed dlls are present (tbb.dll, tbbmalloc.dll, msvcp90.dll, msvcr90.dll).

What could be the cause?

0 Kudos
5 Replies
robert-reed
Valued Contributor II
390 Views
Quoting - akalu

Ive downloaded TBB (tbb21_20080605oss) from this site, made simple application in Microsoft Visual Studio 2008 Express based on tree_sum sample.It works fine on my PC (Vista SP1/Core 2 Quad 2.4 Ghz).But when Im trying to start it on other computers (such as XP SP2/Pentium D 3 Ghz) I get an could not launch the application error.

Depends.exe shows that all needed dlls are present (tbb.dll, tbbmalloc.dll, msvcp90.dll, msvcr90.dll).

What could be the cause?

Have you installed "Express" or the Microsoft runtime redistribution package on your other machines? I haven't worked with "Express" but I do know that since Microsoft Visual Studio 2005 or so, running programs compiled with VS on other machines require the installation of a redistribution package of libraries, else you get a very cryptic message along the lines of what you describe.

0 Kudos
Dmitry_Vyukov
Valued Contributor I
390 Views
Quoting - akalu

Ive downloaded TBB (tbb21_20080605oss) from this site, made simple application in Microsoft Visual Studio 2008 Express based on tree_sum sample.It works fine on my PC (Vista SP1/Core 2 Quad 2.4 Ghz).But when Im trying to start it on other computers (such as XP SP2/Pentium D 3 Ghz) I get an could not launch the application error.

Depends.exe shows that all needed dlls are present (tbb.dll, tbbmalloc.dll, msvcp90.dll, msvcr90.dll).

What could be the cause?

I think that MSVC run-time is not installed on that machines.

The fact that msvcp90.dll, msvcr90.dll are situated near the executable is not enough. DLLs must be installed into SxS.

Here you can see how to create installer of your program which will include and correctly install MSVC run-time:

http://msdn.microsoft.com/en-us/library/zebw5zk9(VS.80).aspx

(see "Community Content" section)

0 Kudos
Dmitry_Vyukov
Valued Contributor I
390 Views
Quoting - akalu

Hello!

Ive downloaded TBB (tbb21_20080605oss) from this site, made simple application in Microsoft Visual Studio 2008 Express based on tree_sum sample.It works fine on my PC (Vista SP1/Core 2 Quad 2.4 Ghz).But when Im trying to start it on other computers (such as XP SP2/Pentium D 3 Ghz) I get an could not launch the application error.

Depends.exe shows that all needed dlls are present (tbb.dll, tbbmalloc.dll, msvcp90.dll, msvcr90.dll).

What could be the cause?

If you need self-contained executable, you can try following.

Compile your application with static versions of MSVC run-time (Project Properties -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded [Debug]).

Statically link TBB and TBBmalloc. Include all TBB and TBBmalloc sources into your project. Define USE_WINTHREAD and __TBB_TASK_CPP_DIRECTLY_INCLUDED=1. Manually call mallocThreadShutdownNotification() on thread end, and mallocProcessShutdownNotification() on program end.

This approach has some advantages (apart from the fact that it not 100% documented, however has some support in TBB sources):

- single executable

- no dependencies

- faster code, especially if you use LTCG

- possibly smaller size (linker is able to strip unused functionality)

0 Kudos
Dmitry_Vyukov
Valued Contributor I
390 Views
Quoting - Dmitriy V'jukov

Statically link TBB and TBBmalloc. Include all TBB and TBBmalloc sources into your project. Define USE_WINTHREAD and __TBB_TASK_CPP_DIRECTLY_INCLUDED=1. Manually call mallocThreadShutdownNotification() on thread end, and mallocProcessShutdownNotification() on program end.

Btw, you can automatically detect such events as process start/end, thread start/end.

See here for details:

http://www.codeguru.com/Cpp/misc/misc/threadsprocesses/article.php/c6945__2/

0 Kudos
eugene-klyuchnikov
390 Views
Quoting - Dmitriy Vyukov

If you need self-contained executable, you can try following.

Statically link TBB and TBBmalloc. Include all TBB and TBBmalloc sources into your project. Define USE_WINTHREAD and __TBB_TASK_CPP_DIRECTLY_INCLUDED=1. Manually call mallocThreadShutdownNotification() on thread end, and mallocProcessShutdownNotification() on program end.


That is the thing i was looking for! But I've got a question.

I'm compiling from command line with icc 11 + ms sdk 6.0a + some pieces of MSVS 2009.

First of all - it didn't start to compile before i defined _WIN32.
Next - it didn't compile before i've enabled exceptions. There are 2 choices - (/EHs) synchronous and (/EHa) asynchronous ones (and may be /Qcxx-features). What sould i use?
0 Kudos
Reply